Download presentation
Presentation is loading. Please wait.
Published byΠοδαργη Δουρέντης Modified over 6 years ago
1
Uniprocessor Process Management & Process Scheduling
CS 314 Operating Systems Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Fall, 2018 Dr. Hiroshi Fujinoki Process_Management/000
2
CS 314 Operating Systems Three Different Layers of Process Scheduling
Long-term Scheduling Medium-term Scheduling Short-term Scheduling The scheduler invoked when a new process is started by a human user or by another process already active The scheduler that assigns a (the) processor to the processes ready to run in the memory The scheduler that is performed to the ready processes to temporarily swap them out of the memory (to make them temporarily inactive) Process_Management/001
3
CS 314 Operating Systems Long-Term Scheduling Your program must be in
memory for the processor to execute it Computer System Processor Multitasking requires multiple processes ready (waiting) in the memory User(s) Main Memory Two reasons your request to start a new process can be rejected: Your system does not have enough memory to hold more process (not enough memory) Process_Management/002
4
CS 314 Operating Systems Long-Term Scheduling Your program must be in
memory for the processor to execute it Computer System Processor Long-term Schedule Queue Multitasking requires multiple processes ready (waiting) in the memory User(s) Main Memory Two reasons your request to start a new process can be rejected: Your system does not have enough memory to hold more process (not enough memory) Process_Management/003
5
CS 314 Operating Systems Long-Term Scheduling Computer System
Processor User(s) Process Completed Main Memory Two reasons your request to start a new process can be rejected: Your system does not have enough memory to hold more process Process_Management/004
6
CS 314 Operating Systems Long-Term Scheduling Computer System
Processor User(s) Main Memory Two reasons your request to start a new process can be rejected: Degree of multitasking exceeds its limit and thrashing is happening (not enough processor resource) Process_Management/005
7
CS 314 Operating Systems Long-Term Scheduling Computer System
Processor User(s) Main Memory Process_Management/006
8
CS 314 Operating Systems Degree of Multitasking and Thrashing n
Process 1 7 10 5 n Processor is used for n seconds m Processor is NOT used for m seconds Process 2 5 2 4 3 Process 3 10 This is “short-term scheduling” Number of processes ready in the memory Process 1 7 10 5 Utilization = 17/32 = 53.1% 5 1 1 2 2 3 3 Utilization = 29/34 = 85.2% Process 2 2 3 5 2 3 Process 3 Utilization = 42/44 = 95.5% Process 4 = “Degree of multitasking” Process_Management/007
9
CS 314 Operating Systems Multiprogramming and Timesharing OS
Multiprogramming & Timesharing User Programs A Computer System B CPU C D Program Loader E D C B A user Memory Process_Management/008
10
CS 314 Operating Systems Degree of Multitasking Context Switching
Service time (Time Slice) All registers in the processor must be saved user Process_Management/009
11
CS 314 Operating Systems Degree of Multitasking
If we try to keep the response time for each user same, the service time (time slice) for each user must shrink user Overhead for Context Switching user user user user user Process_Management/010
12
CS 314 Operating Systems Degree of Multitasking
Most of the processor cycles are used For just switching between processes but not for processing them Degree of Multitasking (High) Throughput Long-term scheduling controls degree of multitasking so that the slowdown will not happen Slowdown Process_Management/011
13
CS 314 Operating Systems Three Different Layers of Process Scheduling
New user Ready System has enough resources Blocked System does not have enough resources Processor Running Selected for execution System has enough resources Another process is selected for execution I/O access is completed Blocked Process is making I/O accesses Completed Process_Management/012
14
CS 314 Operating Systems Three Different Layers of Process Scheduling
Short-term Scheduling Long-term Scheduling New user Processor Ready Blocked Running Blocked System does not have enough resources Completed Medium-term Scheduling Process_Management/013
15
CS 314 Operating Systems Short-term Scheduling
Major existing short-term scheduling algorithms: Preemptive Non-Preemptive FCFS (a.k.a. “FIFO”) Round-Robin SJF (Shortest Job First) (a.k.a. “SPN”) HRRN (Highest Response Rate Next) SRTF (Shortest Remaining Time First) Feed-back Priority-based (Highest Priority First) Process_Management/014
16
CS 314 Operating Systems Short-term Scheduling
The scheduler schedules assignments of the processor to each process to optimize some performance factor(s) Throughput Response time Resource utilization (especially processor utilization) Fairness (we can measure this as “customer satisfaction”) Turnaround time Each short-term scheduling algorithm is good at optimizing a performance factor, but it is hard to optimize all the factors Process_Management/015
17
CS 314 Operating Systems Uniprocessor Process Management
Core of process management Process scheduling Process scheduling = Decision-making for when to start (and stop) processes Why is process scheduling important? Because it has significant impact to the following performance factors: Throughput Response time Resource utilization Fairness Turnaround time (especially processor utilization) (we can measure this as “customer satisfaction”) Process_Management/016
18
CS 314 Operating Systems Throughput Throughput
= Number of jobs completed in unit time P14 9 P2 4 P8 P3 P9 P6 P4 P1 25 P5 15 P10 P13 P7 P12 P11 If all tasks submitted here 5 jobs / Minute 6 jobs / Minute P14 9 P13 15 P12 P11 P10 P9 4 P8 P7 P6 P5 P4 P3 P2 P1 25 25 29 33 42 57 61 111 102 74 93 70 78 126 135 Process_Management/017
19
CS 314 Operating Systems Response Time Response Time Two questions:
=The time since submission until the first response appears Two questions: How should “average response time” be defined? P14 9 P2 4 P8 P3 P9 P6 P4 P1 25 P5 15 P10 P13 P7 P12 P11 How can we improve “average response time (two methods)”? If all tasks submitted here P14 9 P13 15 P12 P11 P10 P9 4 P8 P7 P6 P5 P4 P3 P2 P1 25 111 102 74 61 33 25 29 42 93 57 70 78 126 P2 waits for 25 sec. Process_Management/018
20
CS 314 Operating Systems Response Time Response Time
=The time since submission until the first response appears If all tasks submitted here P14 9 111 102 74 61 33 25 29 42 93 57 70 78 126 P13 15 P12 P11 P10 P9 4 P8 P7 P6 P5 P4 P3 P2 P1 Average Response Time = 901/14 = 64.35 P1 25 P13 15 P10 P5 P14 9 P12 P11 P7 P4 P9 4 P8 P6 P3 P2 8 12 16 20 29 38 47 56 65 80 95 110 Average Response Time = 580/14 = 41.28 Average Response Time Optimized What did we loose ? Process_Management/019
21
CS 314 Operating Systems Resource Utilization (processor utilization)
Processor is used for n seconds m Processor is NOT used for m seconds Process 1 7 10 5 Process 2 12 2 3 6 Process 3 10 2 3 7 10 5 Process 1 12 2 3 6 10 2 3 Process 3 Process 2 73 51 Utilization = 51/73 = 69.9% Process_Management/020
22
CS 314 Operating Systems Turnaround Time Turnaround Time
= The time since submission to completion for each process P14 9 P2 4 P8 P3 P9 P6 P4 P1 25 P5 15 P10 P13 P7 P12 P11 If all tasks submitted here P1 25 P2 4 P3 4 P4 9 P5 15 P6 4 P7 9 P8 4 P9 4 P10 15 P11 9 P12 9 P13 15 P14 9 111 102 74 61 33 25 29 42 93 57 70 78 126 135 Process_Management/021
23
CS 314 Operating Systems Fairness
Reasonable resource allocation to each task (or process) Meaning of “fairness” depends on each system If some tasks are high-priority tasks Assigning exactly the same amount of resource to all tasks Will result in unfairness If all the tasks have exactly the same priority Each task should be assigned the same amount of resource If some tasks have lower priority Assigning more resource to high-priority tasks Will result in starvation for low-priority tasks Process_Management/022
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.