scheduling plans
play

Scheduling Plans Introductory Concepts CSCI [4|6] 730 Embellish on - PowerPoint PPT Presentation

Scheduling Plans Introductory Concepts CSCI [4|6] 730 Embellish on the introductory concepts Case studies Operating Systems Look at real time scheduling. Practical system have some theory, and lots of tweaking CPU Scheduling


  1. Scheduling Plans • Introductory Concepts CSCI [4|6] 730 • Embellish on the introductory concepts • Case studies Operating Systems • Look at real time scheduling. – Practical system have some theory, and lots of tweaking CPU Scheduling (hacking). Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Why Schedule? CPU Scheduling Questions? Management of Resources • Why is scheduling needed? • Resource: Anything that can be used by only a • What is preemptive scheduling? single [set] process(es) at any instant in time • What are scheduling criteria? – Not just the CPU, what else? • What are disadvantages and advantages of • Hardware device or a piece of information different scheduling policies, including: – Examples: – Fundamental Principles: • CPU (time, time slice) • First-come-first-serve? • Shortest job first? • Tape drive, Disk space, Memory (spatial) • Preemptive scheduling? • Locked record in a database (information, synchronization) – Practical Scheduling (and case studies): • Focus today managing the CPU, short term • Hybrid schemes (Multilevel feedback scheduling?) that includes hybrids of SJF, FIFO, Fair Schedulers scheduling. – Completely Fair Scheduling. • How are scheduling policies evaluated? – What are important metrics? Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA

  2. What is the Point? Resource Classification Can Scheduling make a difference? Process A • Pre-emptable Process B – Can forcibly removed the resource from a process (and I/O possibly return it later) without ill effects. • Non-preemptable CPU No Schedule – Cannot take a resource away from its current � owner � I/O Device without causing the computation to fail. CPU A Schedule I/O Device Time • No Schedule vs A Schedule • Schedule another waiting process while current CPU relinquish to CPU due to I/O. Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA “ Resource ” Classification • Allocation (Space): • Preemptable (forcible removable) – Space Sharing: Which process gets which resource – Characteristics (desirable): (control access to resource)? • small state (so that it is not costly too preempt it). • Scheduling (Time): • only one resource – Examples: – Time Sharing: Which process gets resource and at • CPU or Memory are typically a preemptable resources what time ? • Non-preemptable (not forcible removable) – In which order should requests be serviced – Order and Time – Characteristics: • Complicated state Time and • May need many instances of this resource Space – Examples: • CD recorder - once starting to burn a CD needs to record to completion otherwise the end up with a garbled CD. • Blocks on disk Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA

  3. The CPU Management Team Dispatch Mechanism • (How?) � The Dispatcher � (low level mechanism – the worker) Dispatcher is the module that gives control of the CPU to – Context Switch the process selected by the scheduler. • Save execution of old process in Process Control Block (PCB). • Add PCB to appropriate queue (ready or blocked) • OS runs dispatch loop: • Load state of next process from PCB to registers • Switch from kernel to user mode while( forever ) • Jump to instruction in user process { • (When?) � The Scheduler � (higher level mechanism - upper run process A for some time slice management) (schedules time). stop process A and save its context load context of another process B – Policy to determine when a specific process gets the CPU jump to proper location and restart program • (Where?) Sometimes also � The Allocator � (space) } – Policy to determine which processes compete for which CPU – Needed for multiprocessor, parallel, and distributed systems ● Review: How does the dispatcher gain control? Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Recall: Entering System Mode How does the dispatcher run? Option 1: Cooperative Multi-tasking Same as - How does OS (scheduler) get control? • (internal events) Trust process to relinquish CPU through traps • Synchronous interrupts, or traps (produced by CPU). – Trap: Event internal to process that gives control to OS – Event internal to a process that gives control to OS – Examples: System call, an explicit yield, page fault (access page not in – Examples: System calls, page faults (access page not in main main memory), or error (illegal instruction or divide by zero) memory), or errors (illegal instruction or divide by zero) • Disadvantages: Processes can misbehave • Asynchronous interrupts: generated at arbitrary times. – By avoiding all traps and performing no I/O, can take over entire – Events external to a process, generated by other hardware machine – Examples: Characters typed, or completion of a disk transfer – Only solution: Reboot! How are interrupts handled? • Not performed in modern operating systems • Each type of interrupt has corresponding routine (handler or interrupt service routine (ISR) • Hardware saves current process and passes control to ISR Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA

  4. Scheduler Types How does dispatcher run? • Non-preemptive scheduler (cooperative multi-tasking) – Process remains scheduled until voluntarily relinquishes CPU (yields) – Option 2: (external stimulus) True Multi-tasking Mac OS 9. • Guarantee OS can obtain control periodically – Scheduler may switch in two cases: • Enter OS by enabling periodic alarm clock • When process exits • When process blocks (e.g. on I/O) – Hardware generates timer interrupt (CPU or separate chip) • Preemptive scheduler (Most modern OS, including most UNIX – Example: Every 10 ms variants) • User must not be able to mask timer interrupt – Process may be � de-scheduled � at any time • Dispatcher counts interrupts between context switches – Additional cases: • Process creation (another process with higher process enters system) – Example: Waiting 20 timer ticks gives the process 200 ms time slice • When an I/O interrupt occurs – Common time slices range from 10 ms to 200 ms (Linux 2.6) • When a clock interrupt occurs Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Scheduling Goals: Performance Metrics • There is a tension between maximizing: – System � s point of view: Overall efficiency (favoring the whole, the forest, the whole system). – User � s point of view: Giving good service to individual processes (favoring the � individuals � , the trees). Satisfy both : fast process response time (low latency) and high process throughput. Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA

  5. System View: Utilization / Throughput Threshold - Overall Efficiency • Problem type: Job 1 Job 2 Job 3 0 4 8 12 – 3 jobs: • System Load ( uptime ): • 1 st job enters at time 0, – The amount of work the system is doing • Throughput: • 2 nd job at time 4, and Throughput • 3 rd job at 8 second – Want many jobs to complete per unit time • System Utilization: – Each job takes 2 seconds to process. – Keep expensive devices busy – Each job is processed immediately – unless a job is on the – Jobs arrive infrequently and both throughput CPU, then it waits and system utilization is low • Questions: • Example: Lightly loaded system - jobs arrive Offered Load infrequently - both throughput and system – (1) What is the CPU utilization at time t = 12? utilization is low. • Consider the CPU utilization from t =0 to t=12. • Scheduling Goal: Ensure that throughput • Percentage used over a time period. increase linearly with load – (2) What is the I/O device utilization at time t = 12? – (3) What is the throughput (jobs/sec)? Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Which Criteria is Appropriate? User View: Good Service Depends on Expectation of the System (often measured as an average ) • All Systems: • Ensure that processes quickly start, run and completes. – Fairness (give processes a fair shot to get the CPU). • {average} Turnaround time : The time between – Overall system utilization – job arrival and – Policy enforcement (priorities) – job completion. • Batch Systems (not interactive) • (average) Response time : The length of time when the job arrive and – Throughput when if first start to produce output – Turn-around time – e.g. interactive jobs, virtual reality (VR) games, click on mouse see VR change – CPU utilization • Waiting time : Time in ready queue - do not want to spend a lot of time • Real-time system (real time constraints) in the ready queue – Meeting deadlines (avoid losing data) – Better � scheduling � quality metric than turn-around time since scheduler – Predictability - avoid quality degradation in multimedia systems. does not have control over blocking time or time a process does actual computing. • Fairness : all jobs get the same amount of CPU over time • Overhead : reduce number of context switches • Penalty Ratio : Elapsed time / Required Service time – (normalizes according to the � ideal � service time) - more on this next week – Idle time would expand elapsed time. – Service time is actual time on CPU (or/and IO device) Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA Maria Hybinette, UGA

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend