Presentation is loading. Please wait.

Presentation is loading. Please wait.

Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi.

Similar presentations


Presentation on theme: "Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi."— Presentation transcript:

1 Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu CS 314 Operating Systems Process_Management/000

2 Three Different Layers of Process Scheduling Process_Management/001 CS 314 Operating Systems 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  Long-term Scheduling  Medium-term Scheduling  Short-term Scheduling The scheduler that is performed to the ready processes to temporarily swap them out of the memory (to make them temporarily inactive)

3 Long-Term Scheduling Process_Management/002 CS 314 Operating Systems Computer System Processor Main Memory User(s) Your program must be in memory for the processor to execute it Multitasking requires multiple processes ready (waiting) in the 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)

4 Long-Term Scheduling Process_Management/003 CS 314 Operating Systems Computer System Processor Main Memory User(s) Your program must be in memory for the processor to execute it Multitasking requires multiple processes ready (waiting) in the 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) Long-term Schedule Queue

5 Process_Management/004 CS 314 Operating Systems Computer System Processor Main Memory User(s) Two reasons your request to start a new process can be rejected: Process Completed Long-Term Scheduling  Your system does not have enough memory to hold more process

6 Process_Management/005 CS 314 Operating Systems Computer System Processor Main Memory User(s) Two reasons your request to start a new process can be rejected: Long-Term Scheduling  Degree of multitasking exceeds its limit and thrashing is happening (not enough processor resource)

7 Process_Management/006 CS 314 Operating Systems Computer System Processor Main Memory User(s) Long-term Scheduling Long-Term Scheduling

8 Degree of Multitasking and Thrashing Process 2 5 2 4 3 3 Process 3 10 2 3 Process 1 710 5 5 5 n Processor is used for n seconds m Processor is NOT used for m seconds Process_Management/007 CS 314 Operating Systems Process 1 710 5 5 5 Utilization = 17/32 = 53.1% Process 2 3 2 5 3 1 1 2 Utilization = 29/34 = 85.2% Process 3 2 3 5 2 3 Utilization = 42/44 = 95.5% Process 4 Number of processes ready in the memory = “Degree of multitasking” This is “short-term scheduling”

9  Multiprogramming and Timesharing OS Computer System Memory User Programs A B C D E Program Loader ABCD Multiprogramming & Timesharing CPU user CS 314 Operating Systems Process_Management/008

10 Degree of Multitasking and Thrashing Process_Management/009 CS 314 Operating Systems user All registers in the processor must be saved Service time (Time Slice) Context Switching

11 Degree of Multitasking and Thrashing Process_Management/010 CS 314 Operating Systems user Overhead for Context Switching       If we try to keep the response time for each user same, the service time (time slice) for each user must shrink

12 Degree of Multitasking and Thrashing Process_Management/011 CS 314 Operating Systems Degree of Multitasking (High) Throughput Thrashing Thrashing = A situation where most of the processor cycles are used for just switching between processes but not for processing them Long-term scheduling controls degree of multitasking so that thrashing will not happen

13 Process_Management/012 CS 314 Operating Systems Completed user New Processor Three Different Layers of Process Scheduling Ready System has enough resources Blocked Process is making I/O accesses Running Selected for execution Another process is selected for execution I/O access is completed System has enough resources Blocked System does not have enough resources

14 Process_Management/013 CS 314 Operating Systems Running Processor Ready Blocked Completed New user Blocked Three Different Layers of Process Scheduling Long-term Scheduling System does not have enough resources Short-term Scheduling Medium-term Scheduling

15 Short-term Scheduling Process_Management/014 CS 314 Operating Systems Major existing short-term scheduling algorithms:  FCFS (a.k.a. “FIFO”)  Round-Robin  SJF (a.k.a. “SPN”)  HRRN (Highest Response Rate Next)  SRTF (Shortest Remaining Time First)  Feed-back   Preemptive  Non-Preemptive  Priority-based (Highest Priority First)

16 Short-term Scheduling Process_Management/015 CS 314 Operating Systems 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

17 Uniprocessor Process Management Core of process management Process scheduling Decision-making for when to start (and stop) processes Process scheduling = Why is process scheduling important? Because it has significant impact to the following performance factors: (especially processor utilization) (we can measure this as “customer satisfaction”) Process_Management/016 CS 314 Operating Systems  Throughput  Response time  Resource utilization  Fairness  Turnaround time

18 P 14 9 P2P2 4 P8P8 4 P3P3 4 P9P9 4 P6P6 4 P4P4 9 P1P1 25 P5P5 15 P 10 15 P 13 15 P7P7 9 P 12 9 P 11 9 If all tasks submitted here 61 25 33 29 42 57 111 102 74 93 70 78 126 135 P 14 9 P 13 15 P 12 9 P 11 9 P 10 15 P9P9 4 P8P8 4 P7P7 9 P6P6 4 P5P5 P4P4 9 P3P3 4 P2P2 4 P1P1 25 6 jobs / Minute CS 314 Operating Systems Process_Management/017 Throughput = Number of jobs completed in unit time 5 jobs / Minute

19 Response Time =The time since submission until the first response appears P 14 9 P2P2 4 P8P8 4 P3P3 4 P9P9 4 P6P6 4 P4P4 9 P1P1 25 P5P5 15 P 10 15 P 13 15 P7P7 9 P 12 9 P 11 9 111 102 74 61 33 25 29 4293 57 70 78 126 0 If all tasks submitted here P 14 9 P 13 15 P 12 9 P 11 9 P 10 15 P9P9 4 P8P8 4 P7P7 9 P6P6 4 P5P5 P4P4 9 P3P3 4 P2P2 4 P1P1 25 CS 314 Operating Systems Process_Management/018 P2 waits for 25 sec. Two questions:  How should “average response time” be defined?  How can we improve “average response time (two methods)”?

20 Response Time =The time since submission until the first response appears If all tasks submitted here P 14 9 111 102 74 61 33 25 29 4293 57 70 78 126 0 P 13 15 P 12 9 P 11 9 P 10 15 P9P9 4 P8P8 4 P7P7 9 P6P6 4 P5P5 P4P4 9 P3P3 4 P2P2 4 P1P1 25 CS 314 Operating Systems Process_Management/019 P1P1 25 P 13 15 P 10 15 P5P5 P 14 9 P 12 9 P 11 9 P7P7 9 P4P4 9 P9P9 4 P8P8 4 P6P6 4 P3P3 4 P2P2 4 48 12 1620 29 38 47 56 65 80 95 110 Average Response Time = 901/14 = 64.35 Average Response Time = 580/14 = 41.28 Average Response Time Optimized What did we loose  ?

21 Resource Utilization (processor utilization) Process 1 710 5 5 5 Process 2 12 2 3 6 3 Process 3 10 2 3 12 2 3 6 3 710 5 5 5 Process 1 Process 2 10 2 3 Process 3 73 51 Utilization = 51/73 = 69.9% n Processor is used for n seconds m Processor is NOT used for m seconds Process_Management/020 CS 314 Operating Systems

22 Turnaround Time = The time since submission to completion for each process P 14 9 P2P2 4 P8P8 4 P3P3 4 P9P9 4 P6P6 4 P4P4 9 P1P1 25 P5P5 15 P 10 15 P 13 15 P7P7 9 P 12 9 P 11 9 If all tasks submitted here P 14 9 111 102 74 61 33 25 29 4293 57 70 78 126 135 P 13 15 P 12 9 P 11 9 P 10 15 P9P9 4 P8P8 4 P7P7 9 P6P6 4 P5P5 P4P4 9 P3P3 4 P2P2 4 P1P1 25 CS 314 Operating Systems Process_Management/021

23 Fairness Process_Management/022 CS 314 Operating Systems Meaning of “fairness” depends on each system Reasonable resource allocation to each task (or process)  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


Download ppt "Uniprocessor Process Management & Process Scheduling Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi."

Similar presentations


Ads by Google