1 / 32

MM Process Management

MM Process Management. Karrie Karahalios Spring 2007. (based off slides created by Brian Bailey). Announcements. 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

Download Presentation

MM Process Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MM Process Management Karrie KarahaliosSpring 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

  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. Assume workload shown on the right Compare FCFS, SJF, and RR (quantum=10) compare along each evaluation criteria Take Home Exercise

  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 • Ci is execution time of task i • Ti 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 C1 = 1 C2 = 1 T1 = 2 T2 = 5 T1 is higher priority Utilization (U) =

  22. Example 2 C1 = 1 C2 = 2 T1 = 2 T2 = 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 (C1, T1) and (C2, T2), with T1 < T2 • Within request period of T2, there can be at most ceil(T2 / T1) requests from T1 • Adjust C2 to fully utilize CPU

  25. Case 1 • Requests for task1 completed within T2 • no overlap with T2 • In this case, largest value of C2 can be C2 = T2 – C1*ceil(T2/T1) • U = 1 + C1[ (1/T1) – (1/T2) *ceil(T2 / T1)]

  26. Case 2 • Execution of ceil(T2/T1)th request from task1 overlaps second request from task2 • e.g. (C1=1,T1=1.5); (C2=1, T2=5) • In this case, largest value of C2 can be C2 = T1*fl(T2/T1) – C1*fl(T2/T1) • U = (T1/T2)*fl(T2/T1) + C1[ (1/T1) – (1/T2) *fl(T2 / T1)]

  27. Minimum Occurs at Boundary • Minimum of U occurs at the boundary between these two cases • Set equations equal and solve for C1 C1 = T2 – T1*fl(T2/T1) • U = 2(21/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 (21/3 - 1) ~= 0.78 • For n tasks • U < n (21/n – 1) -> 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? C1 = 1.5 C2 = 2.1 T1 = 2.5 T2 = 6

  30. Example • Is this configuration of tasks admissible? C1 = 1 C2 = 2 T1 = 2 T2 = 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 • C1 = 1.5 C2 = 2.1 • T1 = 2.5 T2 = 6 • Draw timing models for each • show failure with RM, but success with EDF

More Related