CPU Scheduling – Outline

Total Page:16

File Type:pdf, Size:1020Kb

CPU Scheduling – Outline Chapter 5: CPU Scheduling – Outline What is scheduling in the OS ? What are common scheduling criteria ? How to evaluate scheduling algorithms ? What are common scheduling algorithms ? How is thread scheduling different from process scheduling ? What are the issues in multiple-processor scheduling ? Operating systems case studies. 1 Basic Concepts Multiprogramming most processes alternate between CPU bursts and I/O bursts PU free and idle during #$O burst schedule another process on the !" maximizes PU utilization !" bound process spends most of its time in the CPU at least a few long PU bursts #$O bound process spends most its time performing #$O several short PU bursts 2 CPU Scheduler 'esponsible for the selection of the ne%t running process part of the OS dispatcher selects from among the processes in memory that are ready to execute based on a particular strategy When does !" scheduling happen ? process switches from running to waiting state process switches from running to ready state process switches from waiting to ready state process terminates Scheduling under ( and ) is nonpreemptive *ll other scheduling is preemptive 3 Preemptive Vs. Non-preemptive CPU Scheduling +on-preemptive scheduling process voluntarily releases the CPU (conditions 1 and 4) easy, requires no special hardware poor response time for interactive and real-time systems !reemptive scheduling OS can force a running process involuntarily relinquish the !" arrival of a higher priority process running process exceeds its time-slot may require special hardware, eg., timer may require synchronization mechanisms to maintain data consistency complicates design of the kernel favored by most OSes 4 Dispatcher Scheduler is a part of the dispatcher module in the OS 1unctions of the dispatcher get the new process from the scheduler switch out the context of the current process give CPU control to the new process 2ump to the proper location in the new program to restart that program 3ime taken by the dispatcher to stop one process and start another running is called the dispatch latency 5 Scheduling Queues Job /ueue5 consists of all processes all jobs (processes), once submitted. are in the job queue scheduled by the long-term scheduler 'eady /ueue5 consists of processes in memory processes ready and waiting for execution scheduled by the short-term or CPU scheduler 6evice /ueue5 processes waiting for a device multiple processes can be blocked for the same device #$O completion moves process back to ready queue 6 Scheduling Queues (2) 7 Performance Metrics for CPU Scheduling !" utilization: percentage of time that the !U is busy 3hroughput: number of processes that complete their e%ecution per time unit 3urnaround time: amount of time to execute a particular process ,submission time to completion time- Waiting time: amount of time a process has been waiting in the ready /ueue 'esponse time: amount of time it takes from when a re/uest was submitted until the 7rst response is produced Scheduling goals maximize CPU utilization and throughput minimize turnaround time, waiting time and response time be fair to all processes and all users 8 Method for Evaluating CPU Scheduling Algorithms 8valuation criteria define relative importance of the performance metrics include other system-specific measures 6eterministic modeling takes a particular predetermined workload and defines the performance of each algorithm for that workload simple and fast, gives exact numbers difficult to generalize results can recognize algorithm performance trends over several inputs used for explaining scheduling algorithms used in the rest of this chapter ! 9 Workload Models and Gantt Charts Workload model: Process Arrival Time Burst Time P1 0 8 P2 1 4 P3 1 10 P4 6 2 :antt charts5 bar chart to illustrate a particular schedule figureP1 shows batch scheduleP2 P3 P4 0 8 12 22 24 10 Deterministic Modeling Example Suppose we have processes *. ;. and . submitted at time <. We want to 0now the response time. waiting time. and turnaround time of process A turnaround time wait time + + response time = 0 A B C A B C A C A C Time 11 Deterministic Modeling Example Suppose we have processes *. ;. and . submitted at time <. We want to 0now the response time. waiting time. and turnaround time of process B. turnaround time wait time + response time A B C A B C A C A C Time 12 Deterministic Modeling Example Suppose we have processes *. ;. and . submitted at time <. We want to 0now the response time. waiting time. and turnaround time of process turnaround time wait time + + + response time A B C A B C A C A C Time 13 Method for Evaluating CPU Scheduling Algorithms (2) =ueueing models analytically model the queue behavior ,under some assumptions) involves a lot of complicated math can only handle a limited number of distributions and algorithms may not be very accurate because of unrealistic assumptions Simulations get a workload information from a system simulate the scheduling algorithm compute the performance metrics time and space intensive is practically the best evaluation method 14 Simulation Illustration 15 Scheduling Algorithms 1irst Come. 1irst Served ,1 1S- Shortest Job 1irst ,S41- !riority Based 'ound Robin ,''- Multilevel =ueue Scheduling Multilevel 1eedback =ueue Scheduling 16 First Come, First Served Scheduling *ssigns the !" based on the order of the re/uests. #mplemented using a 1#1O /ueue. +o preemption *dvantages straightforward, simple to write and understand 6isadvantages average waiting time may be too long huge variation based on when processes arrive cannot balance CPU-bound and #$O-bound processes convoy effect, short process behind long process cannot be used for time-sharing systems 17 FCFS Scheduling Example Process Arrival Time Burst Time P1 0 24 P2 0 3 P3 0 3 Suppose that the processes arrive in the order5 P . P! . P" !( !@ !C < @) @A C< Waiting time for P > <? P! > @)? P" > @A *verage waiting time5 ,< B @) B @A-$C > (A 18 FCFS Scheduling (2) Suppose that the processes arrive in the order P! . P" . P 3he :antt chart for the schedule is5 !@ !C !( < C D C< Waiting time for P # D$ P! > <$ P" # C *verage waiting time5 ,D B < B C-$C > C Much better than previous case but large variation 19 Shortest Job First (SJF) Scheduling Order each process based on the length of its ne%t !" burst *llocate !" to the process from the front of the list shortest next PU burst *dvantages SJF is optimal achieves minimum average waiting time for a given set of processes 6isadvantages difficult to know the length of the next CPU request can ask the user, who may not know any better ! model-based prediction can lead to process starvation 20 Example of SJF Process Arrival Time Burst Time P1 0 6 P2 0 8 P3 0 7 P4 0 3 S41 scheduling chart ! !C !@ ) !( < C F (D @) *verage waiting time > ,C B (D B F B <- $ ) > A 21 Estimate Length of Next CPU Burst an only estimate the length next PU burst similar to previous !" bursts ? how relevant is the history of previous CPU bursts ? alculated as an exponential average of the previous !" bursts for the process 1ormula5 th 1. tn actual length of n CPU burst 2. n1 predicted value for the next CPU burst 3. , 0 1 4. Define : n1 tn 1 n . 22 Estimate Length of the Next CPU Burst (2) >< nB( > n 'ecent history does not count >( nB( = tn Only the actual last !" burst counts #f we expand the formula. we get5 nB( > tnB,( & ' tn & B G * ()( - ' tn - * B G n B( ()( - ' < Since both and ,( - - are less than or e/ual to (. each successive term has less weight than its predecessor 23 Estimate Length of the Next CPU Burst (3) 24 Preemptive SJF Scheduling +ew shorter process can preempt longer current running process Process Arrival Time Burst Time P1 0 8 P2 1 4 P3 2 9 P4 3 5 Shortest 'emaining 3ime 1irst scheduling chart5 P P P P P 1 2 4 1 3 0 1 5 10 17 26 *verage waiting time > D.H 25 Priority Scheduling * priority number associated with each process !" allocated to the process with the highest priority equal priority processes scheduled in F 1S order #nternally determined priorities time limit, memory requirements, etc SJF uses next CPU burst for its priority (how?- 8%ternally specified priorities process importance, user-level. etc an be preemptive or non-preemptive 3ext uses low numbers for high priorities 26 Priority Scheduling (2) *dvantages priorities can be made as general as needed 6isadvantage low priority process may never execute (indefinite blocking or starvation) *ging technique to prevent starvation increase priority of processes with time 27 Round Robin Scheduling (RR) 'ound robin algorithm arrange jobs in FCFS order allocate CPU to the first job in the /ueuefor one time-slice preempt job, add it to the end of the queue allocate CPU to the next job and continue... One time slice is called a time ,uantu+ #s by de7nition preemptive can be considered as 1 1S with preemption *dvantages I simple. avoids starvation 6isadvantages may involve a large context switch overhead higher average waiting time than S41 28 an I/O bound process on a heavily loaded system will run more slow Example of RR with Time Quantum = 4 Process Burst Times P1 24 P2 3 P3 3 3he :antt scheduling chart is: !( !@ !C !( !( !( !( !( < ) A (< () (J @@ @D C< *verage waiting time > H.DD 29 Round Robin Scheduling (2) !erformance depends on the length of the time quantum large time /uantum → FCFS like behavior small time /uantum → large context switch overhead :enerally, time /uanta range from (0 – 100 milliseconds context switch time is less than (0 microseconds 'R has larger waiting time. but provides better response time for interactive systems 3urnaround time depends on the size of the time /uantum 30 Turnaround Time Varies With The Time Quantum 31 Multilevel Queue 'eady /ueue is partitioned into separate /ueues: foreground ,interactive- background ,batch- 8ach /ueue has its own scheduling algorithm foreground I '' background – F 1S Scheduling must be done between the /ueues Fixed priority scheduling? (i.e., serve all from foreground then from background).
Recommended publications
  • Kernel-Scheduled Entities for Freebsd
    Kernel-Scheduled Entities for FreeBSD Jason Evans [email protected] November 7, 2000 Abstract FreeBSD has historically had less than ideal support for multi-threaded application programming. At present, there are two threading libraries available. libc r is entirely invisible to the kernel, and multiplexes threads within a single process. The linuxthreads port, which creates a separate process for each thread via rfork(), plus one thread to handle thread synchronization, relies on the kernel scheduler to multiplex ”threads” onto the available processors. Both approaches have scaling problems. libc r does not take advantage of multiple processors and cannot avoid blocking when doing I/O on ”fast” devices. The linuxthreads port requires one process per thread, and thus puts strain on the kernel scheduler, as well as requiring significant kernel resources. In addition, thread switching can only be as fast as the kernel's process switching. This paper summarizes various methods of implementing threads for application programming, then goes on to describe a new threading architecture for FreeBSD, based on what are called kernel- scheduled entities, or scheduler activations. 1 Background FreeBSD has been slow to implement application threading facilities, perhaps because threading is difficult to implement correctly, and the FreeBSD's general reluctance to build substandard solutions to problems. Instead, two technologies originally developed by others have been integrated. libc r is based on Chris Provenzano's userland pthreads implementation, and was significantly re- worked by John Birrell and integrated into the FreeBSD source tree. Since then, numerous other people have improved and expanded libc r's capabilities. At this time, libc r is a high-quality userland implementation of POSIX threads.
    [Show full text]
  • Lottery Scheduling in the Linux Kernel: a Closer Look
    LOTTERY SCHEDULING IN THE LINUX KERNEL: A CLOSER LOOK A Thesis presented to the Faculty of California Polytechnic State University, San Luis Obispo In Partial Fulfillment of the Requirements for the Degree Master of Science in Computer Science by David Zepp June 2012 © 2012 David Zepp ALL RIGHTS RESERVED ii COMMITTEE MEMBERSHIP TITLE: LOTTERY SCHEDULING IN THE LINUX KERNEL: A CLOSER LOOK AUTHOR: David Zepp DATE SUBMITTED: June 2012 COMMITTEE CHAIR: Michael Haungs, Associate Professor of Computer Science COMMITTEE MEMBER: John Bellardo, Assistant Professor of Computer Science COMMITTEE MEMBER: Aaron Keen, Associate Professor of Computer Science iii ABSTRACT LOTTERY SCHEDULING IN THE LINUX KERNEL: A CLOSER LOOK David Zepp This paper presents an implementation of a lottery scheduler, presented from design through debugging to performance testing. Desirable characteristics of a general purpose scheduler include low overhead, good overall system performance for a variety of process types, and fair scheduling behavior. Testing is performed, along with an analysis of the results measuring the lottery scheduler against these characteristics. Lottery scheduling is found to provide better than average control over the relative execution rates of processes. The results show that lottery scheduling functions as a good mechanism for sharing the CPU fairly between users that are competing for the resource. While the lottery scheduler proves to have several interesting properties, overall system performance suffers and does not compare favorably with the balanced performance afforded by the standard Linux kernel’s scheduler. Keywords: lottery scheduling, schedulers, Linux iv TABLE OF CONTENTS LIST OF TABLES…………………………………………………………………. vi LIST OF FIGURES……………………………………………………………….... vii CHAPTER 1. Introduction................................................................................................... 1 2.
    [Show full text]
  • Multilevel Feedback Queue Scheduling Program in C
    Multilevel Feedback Queue Scheduling Program In C Matias is featureless and carnalize lethargically while psychical Nestor ruralized and enamelling. Wallas live asleep while irreproducible Hallam immolate paramountly or ogle wholly. Pertussal Hale cutinize schismatically and circularly, she caponizes her exanimation licences ineluctably. Under these lengths, higher priority queue program just for scheduling program in multilevel feedback queue allows movement of this multilevel queue Operating conditions of scheduling program in multilevel feedback queue have issue. Operating System OS is but software which acts as an interface between. Jumping to propose proper location in the user program to restart. N Multilevel-feedback-queue scheduler defined by treaty following parameters number. A fixed time is allotted to every essence that arrives in better queue. Why review it where for the scheduler to distinguish IO-bound programs from. Computer Scheduler Multilevel Feedback to question. C Program For Multilevel Feedback Queue Scheduling Algorithm. Of the program but spend the parameters like a UNIX command line. Roadmap Multilevel Queue Scheduling Multilevel Queue Example. CPU Scheduling Algorithms in Operating Systems Guru99. How would a queue program as well organized as improving the survey covered include distributed computing. Multilevel Feedback Queue Scheduling MLFQ CPU Scheduling. A skip of Scheduling parallel program tasks DOI. Please chat if a computer systems and shortest tasks, the waiting time quantum increases context is quite complex, multilevel feedback queue scheduling algorithms like the higher than randomly over? Scheduling of Processes. Suppose now the dispatcher uses an algorithm that favors programs that have used. Data on a scheduling c time for example of the process? You need a feedback scheduling is longer than the line records? PowerPoint Presentation.
    [Show full text]
  • Lottery Scheduler for the Linux Kernel Planificador Lotería Para El Núcleo
    Lottery scheduler for the Linux kernel María Mejía a, Adriana Morales-Betancourt b & Tapasya Patki c a Universidad de Caldas and Universidad Nacional de Colombia, Manizales, Colombia, [email protected] b Departamento de Sistemas e Informática at Universidad de Caldas, Manizales, Colombia, [email protected] c Department of Computer Science, University of Arizona, Tucson, USA, [email protected] Received: April 17th, 2014. Received in revised form: September 30th, 2014. Accepted: October 20th, 2014 Abstract This paper describes the design and implementation of Lottery Scheduling, a proportional-share resource management algorithm, on the Linux kernel. A new lottery scheduling class was added to the kernel and was placed between the real-time and the fair scheduling class in the hierarchy of scheduler modules. This work evaluates the scheduler proposed on compute-intensive, I/O-intensive and mixed workloads. The results indicate that the process scheduler is probabilistically fair and prevents starvation. Another conclusion is that the overhead of the implementation is roughly linear in the number of runnable processes. Keywords: Lottery scheduling, Schedulers, Linux kernel, operating system. Planificador lotería para el núcleo de Linux Resumen Este artículo describe el diseño e implementación del planificador Lotería en el núcleo de Linux, este planificador es un algoritmo de administración de proporción igual de recursos, Una nueva clase, el planificador Lotería (Lottery scheduler), fue adicionado al núcleo y ubicado entre la clase de tiempo-real y la clase de planificador completamente equitativo (Complete Fair scheduler-CFS) en la jerarquía de los módulos planificadores. Este trabajo evalúa el planificador propuesto en computación intensiva, entrada-salida intensiva y cargas de trabajo mixtas.
    [Show full text]
  • 2. Virtualizing CPU(2)
    Operating Systems 2. Virtualizing CPU Pablo Prieto Torralbo DEPARTMENT OF COMPUTER ENGINEERING AND ELECTRONICS This material is published under: Creative Commons BY-NC-SA 4.0 2.1 Virtualizing the CPU -Process What is a process? } A running program. ◦ Program: Static code and static data sitting on the disk. ◦ Process: Dynamic instance of a program. ◦ You can have multiple instances (processes) of the same program (or none). ◦ Users usually run more than one program at a time. Web browser, mail program, music player, a game… } The process is the OS’s abstraction for execution ◦ often called a job, task... ◦ Is the unit of scheduling Program } A program consists of: ◦ Code: machine instructions. ◦ Data: variables stored and manipulated in memory. Initialized variables (global) Dynamically allocated (malloc, new) Stack variables (function arguments, C automatic variables) } What is added to a program to become a process? ◦ DLLs: Libraries not compiled or linked with the program (probably shared with other programs). ◦ OS resources: open files… Program } Preparing a program: Task Editor Source Code Source Code A B Compiler/Assembler Object Code Object Code Other A B Objects Linker Executable Dynamic Program File Libraries Loader Executable Process in Memory Process Creation Process Address space Code Static Data OS res/DLLs Heap CPU Memory Stack Loading: Code OS Reads on disk program Static Data and places it into the address space of the process Program Disk Eagerly/Lazily Process State } Each process has an execution state, which indicates what it is currently doing ps -l, top ◦ Running (R): executing on the CPU Is the process that currently controls the CPU How many processes can be running simultaneously? ◦ Ready/Runnable (R): Ready to run and waiting to be assigned by the OS Could run, but another process has the CPU Same state (TASK_RUNNING) in Linux.
    [Show full text]
  • Processor Affinity Or Bound Multiprocessing?
    Processor Affinity or Bound Multiprocessing? Easing the Migration to Embedded Multicore Processing Shiv Nagarajan, Ph.D. QNX Software Systems [email protected] Processor Affinity or Bound Multiprocessing? QNX Software Systems Abstract Thanks to higher computing power and system density at lower clock speeds, multicore processing has gained widespread acceptance in embedded systems. Designing systems that make full use of multicore processors remains a challenge, however, as does migrating systems designed for single-core processors. Bound multiprocessing (BMP) can help with these designs and these migrations. It adds a subtle but critical improvement to symmetric multiprocessing (SMP) processor affinity: it implements runmask inheritance, a feature that allows developers to bind all threads in a process or even a subsystem to a specific processor without code changes. QNX Neutrino RTOS Introduction The QNX® Neutrino® RTOS has been Effective use of multicore processors can multiprocessor capable since 1997, and profoundly improve the performance of embedded is deployed in hundreds of systems and applications ranging from industrial control systems thousands of multicore processors in to multimedia platforms. Designing systems that embedded environments. It supports make effective use of multiprocessors remains a AMP, SMP — and BMP. challenge, however. The problem is not just one of making full use of the new multicore environments to optimize performance. Developers must not only guarantee that the systems they themselves write will run correctly on multicore processors, but they must also ensure that applications written for single-core processors will not fail or cause other applications to fail when they are migrated to a multicore environment. To complicate matters further, these new and legacy applications can contain third-party code, which developers may not be able to change.
    [Show full text]
  • CPU Scheduling
    CPU Scheduling CS 416: Operating Systems Design Department of Computer Science Rutgers University http://www.cs.rutgers.edu/~vinodg/teaching/416 What and Why? What is processor scheduling? Why? At first to share an expensive resource ± multiprogramming Now to perform concurrent tasks because processor is so powerful Future looks like past + now Computing utility – large data/processing centers use multiprogramming to maximize resource utilization Systems still powerful enough for each user to run multiple concurrent tasks Rutgers University 2 CS 416: Operating Systems Assumptions Pool of jobs contending for the CPU Jobs are independent and compete for resources (this assumption is not true for all systems/scenarios) Scheduler mediates between jobs to optimize some performance criterion In this lecture, we will talk about processes and threads interchangeably. We will assume a single-threaded CPU. Rutgers University 3 CS 416: Operating Systems Multiprogramming Example Process A 1 sec start idle; input idle; input stop Process B start idle; input idle; input stop Time = 10 seconds Rutgers University 4 CS 416: Operating Systems Multiprogramming Example (cont) Process A Process B start B start idle; input idle; input stop A idle; input idle; input stop B Total Time = 20 seconds Throughput = 2 jobs in 20 seconds = 0.1 jobs/second Avg. Waiting Time = (0+10)/2 = 5 seconds Rutgers University 5 CS 416: Operating Systems Multiprogramming Example (cont) Process A start idle; input idle; input stop A context switch context switch to B to A Process B idle; input idle; input stop B Throughput = 2 jobs in 11 seconds = 0.18 jobs/second Avg.
    [Show full text]
  • CPU Scheduling
    Last Class: Processes • A process is the unit of execution. • Processes are represented as Process Control Blocks in the OS – PCBs contain process state, scheduling and memory management information, etc • A process is either New, Ready, Waiting, Running, or Terminated. • On a uniprocessor, there is at most one running process at a time. • The program currently executing on the CPU is changed by performing a context switch • Processes communicate either with message passing or shared memory Computer Science CS377: Operating Systems Lecture 5, page Today: Scheduling Algorithms • Goals for scheduling • FCFS & Round Robin • SJF • Multilevel Feedback Queues • Lottery Scheduling Computer Science CS377: Operating Systems Lecture 5, page 2 Scheduling Processes • Multiprogramming: running more than one process at a time enables the OS to increase system utilization and throughput by overlapping I/O and CPU activities. • Process Execution State • All of the processes that the OS is currently managing reside in one and only one of these state queues. Computer Science CS377: Operating Systems Lecture 5, page Scheduling Processes • Long Term Scheduling: How does the OS determine the degree of multiprogramming, i.e., the number of jobs executing at once in the primary memory? • Short Term Scheduling: How does (or should) the OS select a process from the ready queue to execute? – Policy Goals – Policy Options – Implementation considerations Computer Science CS377: Operating Systems Lecture 5, page Short Term Scheduling • The kernel runs the scheduler at least when 1. a process switches from running to waiting, 2. an interrupt occurs, or 3. a process is created or terminated. • Non-preemptive system: the scheduler must wait for one of these events • Preemptive system: the scheduler can interrupt a running process Computer Science CS377: Operating Systems Lecture 5, page 5 Criteria for Comparing Scheduling Algorithms • CPU Utilization The percentage of time that the CPU is busy.
    [Show full text]
  • Interactive Scheduling Two Level Scheduling Round Robin
    Two Level Scheduling • Interactive systems commonly employ two-level scheduling Interactive Scheduling – CPU scheduler and Memory Scheduler • Memory scheduler was covered in VM – We will focus on CPU scheduling 1 2 Round Robin Scheduling Our Earlier Example • Each process is given a timeslice to run in • 5 Process J1 • When the timeslice expires, the next – Process 1 arrives slightly before process J2 process preempts the current process, 2, etc… and runs for its timeslice, and so on J3 – All are immediately • Implemented with runnable J4 – Execution times – A ready queue indicated by scale on – A regular timer interrupt J5 x-axis 0246 8 10 12 1416 18 20 3 4 Round Robin Schedule Round Robin Schedule J1 J1 Timeslice = 3 units J2 Timeslice = 1 unit J2 J3 J3 J4 J4 J5 J5 0246 8 10 12 1416 18 20 0246 8 10 12 1416 18 20 5 6 1 Round Robin Priorities •Pros – Fair, easy to implement • Each Process (or thread) is associated with a •Con priority – Assumes everybody is equal • Issue: What should the timeslice be? • Provides basic mechanism to influence a – Too short scheduler decision: • Waste a lot of time switching between processes – Scheduler will always chooses a thread of higher • Example: timeslice of 4ms with 1 ms context switch = 20% round robin overhead priority over lower priority – Too long • Priorities can be defined internally or externally • System is not responsive • Example: timeslice of 100ms – Internal: e.g. I/O bound or CPU bound – If 10 people hit “enter” key simultaneously, the last guy to run will only see progress after 1 second.
    [Show full text]
  • CPU Scheduling
    Chapter 5: CPU Scheduling Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018 Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multi-Processor Scheduling Real-Time CPU Scheduling Operating Systems Examples Algorithm Evaluation Operating System Concepts – 10th Edition 5.2 Silberschatz, Galvin and Gagne ©2018 Objectives Describe various CPU scheduling algorithms Assess CPU scheduling algorithms based on scheduling criteria Explain the issues related to multiprocessor and multicore scheduling Describe various real-time scheduling algorithms Describe the scheduling algorithms used in the Windows, Linux, and Solaris operating systems Apply modeling and simulations to evaluate CPU scheduling algorithms Operating System Concepts – 10th Edition 5.3 Silberschatz, Galvin and Gagne ©2018 Basic Concepts Maximum CPU utilization obtained with multiprogramming CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait CPU burst followed by I/O burst CPU burst distribution is of main concern Operating System Concepts – 10th Edition 5.4 Silberschatz, Galvin and Gagne ©2018 Histogram of CPU-burst Times Large number of short bursts Small number of longer bursts Operating System Concepts – 10th Edition 5.5 Silberschatz, Galvin and Gagne ©2018 CPU Scheduler The CPU scheduler selects from among the processes in ready queue, and allocates the a CPU core to one of them Queue may be ordered in various ways CPU scheduling decisions may take place when a
    [Show full text]
  • Stride Scheduling: Deterministic Proportional-Share Resource
    Stride Scheduling: Deterministic Proportional-Share Resource Management Carl A. Waldspurger William E. Weihl Technical Memorandum MIT/LCS/TM-528 MIT Laboratory for Computer Science Cambridge, MA 02139 June 22, 1995 Abstract rates is required to achieve service rate objectives for users and applications. Such control is desirable across a This paper presents stride scheduling, a deterministic schedul- broad spectrum of systems, including databases, media- ing technique that ef®ciently supports the same ¯exible based applications, and networks. Motivating examples resource management abstractions introduced by lottery include control over frame rates for competing video scheduling. Compared to lottery scheduling, stride schedul- viewers, query rates for concurrent clients by databases ing achieves signi®cantly improved accuracy over relative and Web servers, and the consumption of shared re- throughput rates, with signi®cantly lower response time vari- sources by long-running computations. ability. Stride scheduling implements proportional-share con- trol over processor time and other resources by cross-applying Few general-purpose approaches have been proposed elements of rate-based ¯ow control algorithms designed for to support ¯exible, responsive control over service rates. networks. We introduce new techniques to support dynamic We recently introduced lottery scheduling, a random- changes and higher-level resource management abstractions. ized resource allocation mechanism that provides ef®- We also introduce a novel hierarchical stride scheduling al- cient, responsive control over relative computation rates gorithm that achieves better throughput accuracy and lower [Wal94]. Lottery scheduling implements proportional- response time variability than prior schemes. Stride schedul- share resource management ± the resource consumption ing is evaluated using both simulations and prototypes imple- rates of active clients are proportional to the relative mented for the Linux kernel.
    [Show full text]
  • Chapter 5: CPU Scheduling
    Chapter 5: CPU Scheduling 肖 卿 俊 办公室:九龙湖校区计算机楼212室 电邮:[email protected] 主页: https://csqjxiao.github.io/PersonalPage 电话:025-52091022 Chapter 5: CPU Scheduling ! Basic Concepts ! Scheduling Criteria ! Scheduling Algorithms ! Real System Examples ! Thread Scheduling ! Algorithm Evaluation ! Multiple-Processor Scheduling Operating System Concepts 5.2 Southeast University Basic Concepts ! Maximum CPU utilization obtained with multiprogramming ! A Fact: Process execution consists of an alternating sequence of CPU execution and I/O wait, called CPU–I/O Burst Cycle Operating System Concepts 5.3 Southeast University CPU-I/O Burst Cycle ! Process execution repeats the CPU burst and I/O burst cycle. ! When a process begins an I/O burst, another process can use the CPU for a CPU burst. Operating System Concepts 5.4 Southeast University CPU-bound and I/O-bound ! A process is CPU-bound if it generates I/O requests infrequently, using more of its time doing computation. ! A process is I/O-bound if it spends more of its time to do I/O than it spends doing computation. Operating System Concepts 5.5 Southeast University ! A CPU-bound process might have a few very long CPU bursts. ! An I/O-bound process typically has many short CPU bursts Operating System Concepts 5.6 Southeast University CPU Scheduler ! When the CPU is idle, the OS must select another process to run. ! This selection process is carried out by the short-term scheduler (or CPU scheduler). ! The CPU scheduler selects a process from the ready queue and allocates the CPU to it. ! The ready queue does not have to be a FIFO one.
    [Show full text]