1 / 17

Operating System Concepts and Techniques Lecture 5

Operating System Concepts and Techniques Lecture 5. Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., 2011. To order: www.iUniverse.com , www.barnesandnoble.com , or www.amazon.com. Terms.

orrin
Download Presentation

Operating System Concepts and Techniques Lecture 5

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. Operating System Concepts and Techniques Lecture 5 Scheduling-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed., iUniverse Inc., 2011. To order: www.iUniverse.com, www.barnesandnoble.com, or www.amazon.com

  2. Terms • Scheduling policydescribes the guideline for selecting the next process to use a computer resource such as CPU. • Scheduling algorithm is a finite set of clearly stated unambiguous stepwise operations that when applied to a finite set of processes waiting to use a resource, either one or more of these processes are selected or a time table for the resource usage is produced • Scheduling mechanismdetermines how to do every step of the scheduling algorithm For example, the exact steps to be taken to modify a process-queue and process state

  3. Scheduling Criteria • Properties which influence the order in which active entities are selected to run  • request Time • Processing Time • Priority • Static priority • dynamic priority  • Deadline • Wait Time • Preemptability

  4. Scheduling Objectives • Throughput • Deadline • hard real-time • soft real-time • Turnaround Time • Average turnaround time • Normalized • Response Time • Priority • Processor Utilization • System Balance • Fairness

  5. Scheduling levels • High-Level: select requests • Medium-level: decide on process swapping • Low-level: decide on giving CPU time to ready processes • Input/output scheduling: decide on disk read/write order

  6. First-Come-First-Served (FCFS) • FCFS: take the request which arrived earliest • Nonpreemptive • Most natural, link banks, airport check-ins, post offices, and barber shops • Irregularity in arrival requires a queue • Simple to implement • A single-linked list with two pointers; each link points from each node to the node of the previous request • Ddisadvantages: a long request can increase others wait time

  7. Shortest Job Next (SJN) • SJN (SPN): take the request which needs the least execution time • Non-preemptive • Executes higher number of requests in one unit of time • To implement, a double-linked list with two pointers; keeps requests ordered • Disadvantages: need to know execution time, update overhead time of the list, and starvation

  8. SRTN & HRRN • Shortest Remaining Time Next (SRTN) • Nonpreemptive • Scheduling decision right after a process is completed • Disadvantages similar to SPN • Highest Response Rattio Next (HRRN) • RR=(w+e)/e; it increases as w increases • Nonpreemptive • Scheduling decision right after a process is completed • Disadvantages similar to SPN

  9. Two more • Fair-Share Scheduling • All users get equal shares of CPU • Prevents a user to get a big chunk of CPU time by creating many child processes or threads • Priority scheduling • Processes have priorities; A higher priority is executed before a lower priority one • Preemptive • Disadvantage: starvation of low priority request

  10. Round Robin (RR) • The most widely used scheduling policy • A time quantum is defined and an interval timer is set to send an interrupt whenever the time quantum has passed, since the timer is set or reset • Time quantum (slice) is very small, one millisecond or less • Upon timer interrupt a process switching is done • If a process cannot use its slice, processor switches to the next process and resets timer • All (same priority) processes share CPU time

  11. RR advantages/disadvantages • Advantages: • Quick response to interactive requests • Longer waiting time for a process that requires longer CPU time • Possibility of defining many priority levels, • Disadvantage: • Task switching overhead

  12. Process Scheduling in Linux • Many levels of priorities (100 or more) • Three schedulers • SCHED_FIFO: Nonpreemptive, highest priority, say from 70-100, for different processes. • SCHED_RR: Preemptive, second highest priority, say from 40-69 • Same level highest priority RR processes are scheduled using round robin • Priorities are assigned so that any SCHED_FIFO process has higher priority than any SCHED_RR; any SCHED_RR has higher priority than any SCHED_OTHER

  13. Process Scheduling in Linux… • SCHED_OTHER • Every process has a static priority • Time is divided into variable size frames called epoch • At start of every epoch, scheduler calculates every SCHED_OTHER process’ CPU share in integer number of scheduling-clock ticks; called credit, epoch length is calculated • Credit is related to static priority • Epoch length is related to how many processes are ready, what their priorities are etc.

  14. SCHED_OTHER... • If a process cannot use its credit it is saved for the next time (see details in the book) • Goodness shows which process is executed next • For SCHED_FIFO and SCHED_RR, goodness=priority+1000 • For SCHED_OTHER, goodness=credit

  15. Summary • It is not always the case that every service request arrives after the previous service request has been completely served. • Service requests may pile up, in which case we would like to serve requests in such an order so as to increase some metrics. • This process is called scheduling. Scheduling methodologies and algorithms for single-processor systems are considered • Many scheduling strategies are studied, FCFS, SJN, SRTN, HRRN, and RR • The Linux operating system was selected to present real-world schedulers

  16. Find out • What an interactive process is • The block structure of an interval timer • The time slice of your computer’s processor • Whether Linux scheduler is a complete one for real-time tasks • Why epoch length is not fixed • The goals of Linux schedulers • The difference between SCHED_FIFO and SCHED_RR

  17. Any questions?

More Related