Chapter 5: CPU Scheduling

2y ago
45 Views
4 Downloads
6.82 MB
43 Pages
Last View : 9d ago
Last Download : 3m ago
Upload by : Angela Sonnier
Transcription

Chapter 5: CPU Scheduling! Basic Concepts! Scheduling Criteria ! Scheduling Algorithms! Multiple-Processor Scheduling! Real-Time Scheduling! Algorithm Evaluation!Operating System Concepts!6.1!Silberschatz, Galvin and Gagne 2002

Basic Concepts! Long-term scheduler is invoked very infrequently (seconds,minutes) (may be slow)! The long-term scheduler controls the degree ofmultiprogramming (how many jobs are admitted to run on CPU)! Short-term scheduler is invoked very frequently (milliseconds) (must be fast) “process scheduling on CPU”! Processes can be described as either:! I/O-bound process – spends more time doing I/O thancomputations, many short CPU bursts! CPU-bound process – spends more time doingcomputations; few very long CPU bursts!6.2!Silberschatz, Galvin and Gagne 2002

Basic Concepts! Maximum CPU utilization obtained with multiprogramming! CPU–I/O Burst Cycle – Process execution consists of acycle of CPU execution and I/O wait.! CPU burst distribution!Operating System Concepts!6.3!Silberschatz, Galvin and Gagne 2002

Alternating Sequence of CPU And I/O Bursts!Operating System Concepts!6.4!Silberschatz, Galvin and Gagne 2002

Histogram of CPU-burst Times!Operating System Concepts!6.5!Silberschatz, Galvin and Gagne 2002

Diagram of Process State!CPU scheduling is a mechanism to migrate processes to various statesfrom/to various queues!Operating System Concepts!3.6!Silberschatz, Galvin and Gagne 2005!

CPU Scheduler! Selects from among the processes in memory (i.e. ReadyQueue) that are ready to execute, and allocates the CPU toone of them.!1. Preemptive: allows a process to be interrupted in the midstof its CPU execution, taking the CPU away to anotherprocess!2. Non- Preemptive: ensures that a process relinquishescontrol of CPU when it finishes with its current CPU burst!Operating System Concepts!Operating System Concepts!3.7!Silberschatz, Galvin and Gagne 2005!

CPU Scheduler! CPU scheduling decisions may take place when aprocess:!1. !Switches from running to waiting state.!2. !Switches from running to ready state.!3. !Switches from waiting to ready.!4. !Terminates.! Preemptive: allows a process to be interrupted! Non- Preemptive: allows a process finishes with itscurrent CPU burst! Scheduling under 1 and 4 is nonpreemptive.! All other scheduling is preemptive.!Operating System Concepts!6.8!Silberschatz, Galvin and Gagne 2002

Context Switching!6.9!Silberschatz, Galvin and Gagne 2002

Dispatcher! Dispatcher module gives control of the CPU to theprocess selected by the short-term scheduler; thisinvolves:! switching context! switching to user mode! jumping to the proper location in the user program to restartthat program! Dispatch latency – time it takes for the dispatcher to stopone process and start another running.!Operating System Concepts!6.10!Silberschatz, Galvin and Gagne 2002

What hardware components impactthe Dispatcher latency?!Operating System Concepts!6.11!Silberschatz, Galvin and Gagne 2002

Scheduling Criteria! CPU utilization – keep the CPU as busy as possible! Throughput – # of processes that complete theirexecution per time unit! Turnaround time – amount of time to execute a particularprocess (finishing time – arrival time)! Waiting time – amount of time a process has been waitingin the ready queue! Response time – amount of time it takes from when arequest was submitted until the first response isproduced, not output (for time-sharing environment)!Operating System Concepts!6.12!Silberschatz, Galvin and Gagne 2002

Optimization Criteria! Max CPU utilization! Max throughput! Min turnaround time ! Min waiting time ! Min response time!Operating System Concepts!6.13!Silberschatz, Galvin and Gagne 2002

First-Come, First-Served (FCFS) Scheduling!!!Process!Burst Time !!!!P1!24!!! P2!3!!! P3!3! Suppose that the processes arrive in the order: P1 , P2 , P3The Gantt Chart for the schedule is:P1!P2!0!24!P3!27!! Waiting time for P1 0; P2 24; P3 27! Average waiting time: (0 24 27)/3 17!Operating System Concepts!6.14!30!Silberschatz, Galvin and Gagne 2002

FCFS Scheduling (Cont.)!Suppose that the processes arrive in the order!!! P2 , P3 , P1 .! The Gantt chart for the schedule is:!P2!0!P3!3!P1!6!30! Waiting time for P1 6; P2 0; P3 3! Average waiting time: (6 0 3)/3 3! Much better than previous case.! Convoy effect short process behind long process!Operating System Concepts!6.15!Silberschatz, Galvin and Gagne 2002

Shortest-Job-First (SJR) Scheduling! Associate with each process the length of its next CPUburst. Use these lengths to schedule the process withthe shortest time.! Two schemes: ! nonpreemptive – once CPU given to the process it cannotbe preempted until completes its CPU burst.! preemptive – if a new process arrives with CPU burst lengthless than remaining time of current executing process,preempt. This scheme is know as theShortest-Remaining-Time-First (SRTF).! SJF is optimal – gives minimum average waiting time fora given set of processes.!Operating System Concepts!6.16!Silberschatz, Galvin and Gagne 2002

Example of Non-Preemptive SJF!!!Process!Arrival Time!!P1!0.0!! P2!2.0!! P3!4.0!! P4!5.0 SJF (non-preemptive)!P1!0!3!P3!7!!Burst Time!!7!!4!!1!!4!P2!8!P4!12!16! Average waiting time (0 6 3 7)/4 - 4!Operating System Concepts!6.17!Silberschatz, Galvin and Gagne 2002

Example of Preemptive SJF!!!Process!Arrival Time!!P1!0.0!! P2!2.0!! P3!4.0!! P4!5.0 SJF (preemptive)!P1!0!P2!2!P3!4!P2!5!!Burst Time!!7!!4!!1!!4!P4!7!P1!11!16! Average waiting time (9 1 0 2)/4 3!Operating System Concepts!6.18!Silberschatz, Galvin and Gagne 2002

In class exercise!!!!!!!Process!P1! P2! P3! P4!Arrival Time!0.0!2.0!4.0!5.0!Burst Time!!7!!4!!1!!4!FCFS & no preemption vs. SJF vs Preemptive SJF ! Wait time is an overall time that a process waits after thearrival! Compare Average waiting time of all algorithms!1.Operating System Concepts!6.19!Silberschatz, Galvin and Gagne 2002

Determining Length of Next CPU Burst! Can only estimate the length.! Can be done by using the length of previous CPU bursts,using exponential averaging.!!!1. tn actual lenght of n th CPU burst2. τ n 1 predicted value for the next CPU burst3. α, 0 α 14. Define:τ n 1 α tn (1 α ) τ n .Operating System Concepts!6.20!Silberschatz, Galvin and Gagne 2002

Prediction of the Length of the Next CPU Burst!Operating System Concepts!6.21!Silberschatz, Galvin and Gagne 2002

Examples of Exponential Averaging! α 0! τn 1 τn! Recent history does not count.! α 1! τn 1 tn! Only the actual last CPU burst counts.! If we expand the formula, we get:!τn 1 α tn (1 - α) α tn -1 ! (1 - α )j α tn -1 ! (1 - α )n 1 tn τ0! Since both α and (1 - α) are less than or equal to 1, eachsuccessive term has less weight than its predecessor.!Operating System Concepts!6.22!Silberschatz, Galvin and Gagne 2002

Important Announcements! Mid Term Exam: April 10, 2014 ! Assignment hand in policy! Submit your hardcopy in class! Send my grader (wenjingpro@gmail.com) anelectronic version & CC me(naibox@gmail.com)! Programming assignment 1: Apr 22!Term Paper: Apr 24!Operating System Concepts!6.23!Silberschatz, Galvin and Gagne 2002

Priority Scheduling! A priority number (integer) is associated with eachprocess! The CPU is allocated to the process with the highestpriority (smallest integer highest priority).! Preemptive! nonpreemptive! SJF is a priority scheduling where priority is the predictednext CPU burst time.! Problem Starvation – low priority processes may neverexecute.! Solution Aging – as time progresses increase thepriority of the process.!Operating System Concepts!6.24!Silberschatz, Galvin and Gagne 2002

Round Robin (RR)! Each process gets a small unit of CPU time (timequantum), usually 10-100 milliseconds. After this timehas elapsed, the process is preempted and added to theend of the ready queue.! If there are n processes in the ready queue and the timequantum is q, then each process gets 1/n of the CPU timein chunks of at most q time units at once. No processwaits more than (n-1)q time units.! Performance! q large FIFO! q small q must be large with respect to context switch,otherwise overhead is too high.!Operating System Concepts!6.25!Silberschatz, Galvin and Gagne 2002

Example of RR with Time Quantum 20!!!Process!!P1!! P2!! P3!! P4 The Gantt chart is:P1!0!P2!20! 37!P3!P4!57!!Burst Time!!53!! 17!!68!! 24!P1!P3!P4!P1!P3!P3!77! 97! 117! 121! 134! 154! 162!! Typically, higher average turnaround than SJF, but betterresponse.!Operating System Concepts!6.26!Silberschatz, Galvin and Gagne 2002

Time Quantum and Context Switch Time!Operating System Concepts!6.27!Silberschatz, Galvin and Gagne 2002

Scheduling Criteria! CPU utilization – keep the CPU as busy as possible! Throughput – # of processes that complete theirexecution per time unit! Turnaround time – amount of time toexecute a particular process (finishing time– arrival time)! Waiting time – amount of time a process has been waitingin the ready queue after arrival! Response time – amount of time it takes from when arequest was submitted until the first response isproduced, not output (for time-sharing environment)!Operating System Concepts!6.28!Silberschatz, Galvin and Gagne 2002

Class Exercise!Each team works on finding an average turnaround time for a !quantum time at 1, 2, 3, 4, 5, 6, 7!Turnaround time – amount of time to execute a particular process(finishing time – arrival time)!!Operating System berschatz, Galvin and Gagne 2002

Turnaround Time Varies With The Time Quantum!Operating System Concepts!6.30!Silberschatz, Galvin and Gagne 2002

Multilevel Queue! Ready queue is partitioned into separate queues:foreground (interactive)background (batch)! Each queue has its own scheduling algorithm,foreground – RRbackground – FCFS! Scheduling must be done between the queues.! Fixed priority scheduling; (i.e., serve all from foregroundthen from background). Possibility of starvation.! Time slice – each queue gets a certain amount of CPU timewhich it can schedule amongst its processes; i.e., 80% toforeground in RR! 20% to background in FCFS !Operating System Concepts!6.31!Silberschatz, Galvin and Gagne 2002

Multilevel Queue Scheduling!Operating System Concepts!6.32!Silberschatz, Galvin and Gagne 2002

Multilevel Feedback Queue! A process can move between the various queues; agingcan be implemented this way.! Multilevel-feedback-queue scheduler defined by thefollowing parameters:! number of queues! scheduling algorithms for each queue! method used to determine when to upgrade a process! method used to determine when to demote a process! method used to determine which queue a process will enterwhen that process needs service!Operating System Concepts!6.33!Silberschatz, Galvin and Gagne 2002

Multilevel Feedback Queues!Operating System Concepts!6.34!Silberschatz, Galvin and Gagne 2002

Example of Multilevel Feedback Queue! Three queues: ! Q0 – time quantum 8 milliseconds! Q1 – time quantum 16 milliseconds! Q2 – FCFS! Scheduling! A new job enters queue Q0 which is served FCFS. When itgains CPU, job receives 8 milliseconds. If it does not finishin 8 milliseconds, job is moved to queue Q1.! At Q1 job is again served FCFS and receives 16 additionalmilliseconds. If it still does not complete, it is preemptedand moved to queue Q2.!Operating System Concepts!6.35!Silberschatz, Galvin and Gagne 2002

Multiple-Processor Scheduling! CPU scheduling more complex when multiple CPUs areavailable.! Homogeneous processors within a multiprocessor.! Load sharing or load balancing !Operating System Concepts!6.36!Silberschatz, Galvin and Gagne 2002

Real-Time Scheduling! Hard real-time systems – required to complete a criticaltask within a guaranteed amount of time.! Soft real-time computing – requires that critical processesreceive priority over less fortunate ones.!Operating System Concepts!6.37!Silberschatz, Galvin and Gagne 2002

Dispatch Latency!Operating System Concepts!6.38!Silberschatz, Galvin and Gagne 2002

Algorithm Evaluation! Deterministic modeling – takes a particular predeterminedworkload and defines the performance of each algorithmfor that workload.! Queueing models! Implementation!Operating System Concepts!6.39!Silberschatz, Galvin and Gagne 2002

Evaluation of CPU Schedulers by Simulation!Operating System Concepts!6.40!Silberschatz, Galvin and Gagne 2002

Process Scheduling Models!Linux Process Scheduling!! 2 separate process-scheduling algorithms! time-sharing: a prioritized credit-based ! Soft-real time: FCFS and RR! only allows processes in a user mode to bepreempted. !!!Operating System Concepts!6.41!Silberschatz, Galvin and Gagne 2002

Solaris 2 Scheduling!Operating System Concepts!6.42!Silberschatz, Galvin and Gagne 2002

Windows 2000 Priorities!Operating System Concepts!6.43!Silberschatz, Galvin and Gagne 2002

Apr 10, 2014 · Operating System Concepts! 6.1! Silberschatz, Galvin and Gagne 2002 Chapter 5: CPU Scheduling! Basic Concepts! Scheduling Criteria ! Scheduling Algorithms! Multiple-Processor Scheduling! Real-Time Scheduling! Algorithm Evaluation!

Related Documents:

Adaptive MPI multirail tuning for non-uniform input/output access. EuroMPI'10. CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU CPU . F. Broquedis et al., HWLOC : A generic framework for managing hardware affinities in HPC applications. PDP '10. (2) D. Callahan, et al., Compiling Programs for Distributed Memory Multiprocessors.The .

CPU 315-2 PN/DP 6ES7315-2EH13-0AB0 V2.6 CPU 317-2 DP 6ES7317-2AJ10-0AB0 V2.6 CPU 317-2 PN/DP 6ES7317-2EK13-0AB0 V2.6 CPU 319-3 PN/DP CPU 31x 6ES7318-3EL00-0AB0 V2.7 . SIMATIC S7-300 CPU 31xC and CPU 31x: Specifications CPU 31xC and CPU 31x: Specifications 4 Manual .

CPU 315-2 DP 6ES7315-2AG10-0AB0 V2.0.0 01 CPU 315-2 PN/DP 6ES7315-2EG10-0AB0 V2.3.0 01 CPU 317-2 DP 6ES7317-2AJ10-0AB0 V2.1.0 01 CPU 317-2 PN/DP CPU 31x 6ES7317-2EJ10-0AB0 V2.3.0 01 Note The special features of the CPU 315F-2 DP (6ES7 315-6FF00-0AB0) and CPU 317F-2 DP (6ES7 317-6FF00-0AB0) are described in their Product Information,

79 85 91 97 3 9 5 GPU r) U r (W) e) ex r A15 r rVR 4 U L2 Cache DRAM Cortex-A15 Quad CPU 0 CPU 1 CPU 2 CPU 3 L2 Cache PowerVR SGX544 GPU Cortex-A7 Quad CPU 0 CPU 1 CPU 2 CPU 3 Multi-layer BUS Figure 1: Exynos 5 Octa SoC simplified block diagram. However, 3D games are highly demanding of computational re-sources as well as memory bandwidth on .

Part One: Heir of Ash Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26 Chapter 27 Chapter 28 Chapter 29 Chapter 30 .

chassis-000 0839QCJ01A ok Sun Microsystems, Inc. Sun Storage 7410 cpu-000 CPU 0 ok AMD Quad-Core AMD Op cpu-001 CPU 1 ok AMD Quad-Core AMD Op cpu-002 CPU 2 ok AMD Quad-Core AMD Op cpu-003 CPU 3 ok AMD Quad-Core AMD Op disk-000 HDD 0 ok STEC MACH8 IOPS disk-001 HDD 1 ok STEC MACH8 IOPS disk-002 HDD 2 absent - - disk-003 HDD 3 absent - -

TO KILL A MOCKINGBIRD. Contents Dedication Epigraph Part One Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 Chapter 10 Chapter 11 Part Two Chapter 12 Chapter 13 Chapter 14 Chapter 15 Chapter 16 Chapter 17 Chapter 18. Chapter 19 Chapter 20 Chapter 21 Chapter 22 Chapter 23 Chapter 24 Chapter 25 Chapter 26

Tulang Humerus Gambar 2.1 Anatomi 1/3 Tulang Humerus (Syaifuddin, 2011) Sulcus Intertubercularis Caput Humeri Collum Anatomicum Tuberculum Minus Tuberculum Majus Collum Chirurgicum Crista Tubeculi Majoris Crista Tuberculi Majoris Collum Anatomicum Collum Chirurgicum Tuberculum Majus . 4. Otot-otot Penggerak Pada Bahu Menurut Syaifuddin (2011), otot- otot bahu terdiri dari : a. Gerakan fleksi .