Presentation is loading. Please wait.

Presentation is loading. Please wait.

MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)

Similar presentations


Presentation on theme: "MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)"— Presentation transcript:

1 MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)

2 Announcements

3 CPU Scheduling Maintain many programs in memory Determine how to best schedule them Requires information about the processes and an understanding of the system goals Switch among processes rapidly so each user perceives direct ownership of system

4 Process State New – being created Terminated – finishing execution Running – executing on the CPU Waiting – blocking on an event Ready – waiting for the CPU

5 Process Control Block Represents a process in the OS –process state –program counter –CPU registers –scheduling information –virtual memory information (e.g., page tables) –I/O status information

6 Resource Queues Sem Queue head tail Ready Queue head tail PCB 6 State Registers … Disk Queue head tail PCB 5 State Registers … PCB 4 State Registers … PCB 3 State Registers … PCB 2 State Registers … PCB 1 State Registers …

7 CPU Scheduler When CPU becomes idle, select next process from the ready queue CPU may become idle when: –allotted time slice expires –interrupt occurs (timer, I/O, user input) –application makes an I/O request –application terminates

8 Evaluation Criteria Throughput: processes completed per unit time Turnaround: from submission to termination Wait: time waiting in the ready queue Response: from user request to system response Utilization: how busy the CPU is over time Want predictable system behavior

9 Scheduling Algorithms FCFS Shortest Job First Priority scheduling Round-robin Multi-level queue Rate monotonic Earliest deadline first

10 FCFS Process requests in order of arrival –non-preemptive algorithm –fairness (human vs. system perspective) –convoy effect

11 Shortest-Job-First Schedule process with smallest burst –difficult to know next CPU burst –use weighted average of past performance Gives min wait time for processes –if preemptive, may lead to starvation

12 Priority Associate priority with each process Schedule process with highest priority –equal priority resolved via FCFS –if priority is a function of time, gives SJF Combat CPU starvation using aging –increase priority of long-waiting processes

13 Round Robin Schedule process after a time quantum –circulate around queue, give each process single time quantum to execute –results in lots of context switches Selection of time quantum –short quantum results in longer waits –infinite quantum results in FCFS –should be large relative to context switch time

14 Take Home Exercise Assume workload shown on the right Compare FCFS, SJF, and RR (quantum=10) –compare along each evaluation criteria ProcessArrivalCPU Burst P1110 P2229 P333 P447 P5512

15 Multimedia Processes Exhibit continuous, periodic behavior Execute along with other processes Have perceptual constraints (QoS)

16 Scheduling Determine sharing of a resource such that all admitted tasks meet their deadlines Balance need to meet deadlines with maximizing throughput and utilization

17 Admissibility Test If test succeeds, the task can be added, and all tasks will still meet deadlines –called a feasible schedule Process utilization (U) <1 if deadlines considered

18 Rate Monotonic Scheduling Static, fixed priority-based, periodic tasks –C i is execution time of task i –T i is request period of task i Determines if a set of periodic tasks can be scheduled or not (feasible schedule) –no other fixed priority scheme can schedule a set of tasks which can’t be scheduled by RM Liu, C.L. and J.W. Layland. Journal of the ACM, 20(1): 46-61, 1973

19 Model Assumptions All requests to process tasks are periodic Each task must finish before next request Each request is independent Execution time for each task is constant Non-periodic tasks are special Tasks are preemptive based on priority –static: priorities assigned once at initialization –dynamic: priorities change during execution

20 Terminology Deadline –time of the next request for same task Feasible –no deadlines are missed Response time –time between request and completion of a task Critical instant –when a request for a task will have the largest response time –occurs when a task is requested simultaneously with requests for all higher priority tasks Critical time zone –time between a critical instant and the end of the response to the corresponding request of the lowest priority task

21 Example 1 T 1 = 2 C 1 = 1C 2 = 1 T 2 = 5 T1 is higher priority Utilization (U) =

22 Example 2 T 1 = 2 C 1 = 1C 2 = 2 T 2 = 5 T1 is higher priority Utilization (U) =

23 Feasibility Test If requests for all tasks at their critical instants can be fulfilled, then feasible Determine least upper bound of U –maximum utilization such that all deadlines are still satisfied, in the general case Assigning highest priority to task with the smallest period yields best utilization

24 Problem for Two Tasks Tasks (C 1, T 1 ) and (C 2, T 2 ), with T 1 < T 2 Within request period of T 2, there can be at most ceil(T 2 / T 1 ) requests from T 1 Adjust C 2 to fully utilize CPU

25 Case 1 Requests for task 1 completed within T 2 –no overlap with T 2 In this case, largest value of C 2 can be C 2 = T 2 – C 1 *ceil(T 2 /T 1 ) U = 1 + C 1 [ (1/T 1 ) – (1/T 2 ) *ceil(T 2 / T 1 )]

26 Case 2 Execution of ceil(T 2 /T 1 )th request from task 1 overlaps second request from task 2 –e.g. (C 1 =1,T 1 =1.5); (C 2 =1, T 2 =5) In this case, largest value of C 2 can be C 2 = T 1 *fl(T 2 /T 1 ) – C 1 *fl(T 2 /T 1 ) U = (T 1 /T 2 )*fl(T 2 /T 1 ) + C 1 [ (1/T 1 ) – (1/T 2 ) *fl(T 2 / T 1 )]

27 Minimum Occurs at Boundary Minimum of U occurs at the boundary between these two cases Set equations equal and solve for C 1 C 1 = T 2 – T 1 *fl(T 2 /T 1 ) U = 2(2 1/2 – 1) =~ 0.83 –highest utilization such that all deadlines met

28 General Case For two tasks –U < 2 (2 ½ - 1), ~= 0.83 For three tasks –U < 3 (2 1/3 - 1) ~= 0.78 For n tasks –U ln 2 ~= 0.69 If configuration of tasks pass the test, no deadlines will be missed –must limit utilization to 69% for large N !!!

29 Example Is this configuration of tasks admissible? C 1 = 1.5C 2 = 2.1 T 1 = 2.5T 2 = 6

30 Example Is this configuration of tasks admissible? C 1 = 1C 2 = 2 T 1 = 2T 2 = 4

31 Deadline Driven Scheduling (EDF) Assign priorities to tasks based on the deadlines of their current requests Execute task with highest priority and yet unfulfilled request Optimal scheduling algorithm –If tasks can be scheduled by any algorithm, then they can also be scheduled by EDF

32 Compare Rate Monotonic vs. EDF –C 1 = 1.5C 2 = 2.1 –T 1 = 2.5T 2 = 6 Draw timing models for each –show failure with RM, but success with EDF


Download ppt "MM Process Management Karrie Karahalios Spring 2007 (based off slides created by Brian Bailey)"

Similar presentations


Ads by Google