DOC PREVIEW
UB CSE 421 - Process Scheduling

This preview shows page 1-2-14-15-29-30 out of 30 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 30 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Process SchedulingIntroductionTopics for discussionThe CPU-I/O CycleCPU/IO BurstsMotivationMotivationScheduling CriteriaOptimization CriteriaTypes of schedulingClassification of Scheduling ActivityFirst-Come, First-Served (FCFS) SchedulingFCFS Scheduling (Cont.)Shortest-Job-First (SJR) SchedulingExample of Non-Preemptive SJFExample of Preemptive SJFDetermining Length of Next CPU BurstExamples of Exponential AveragingMore on Exponential AveragingExponentially Decreasing CoefficientsExponentially Decreasing CoefficientsShortest Process Next: critiquePriority SchedulingRound Robin (RR)Example of RR with Time Quantum = 20Scheduling in Real-Time SystemsSummaryOne more IPCThe Sleeping Barber ProblemThe Sleeping Barber Problem3/26/2003 1Process SchedulingB.Ramamurthy3/26/2003 2IntroductionAn important aspect of multiprogramming is scheduling. The resources that are scheduled are IO and processors. The goal is to achieve High processor utilization High throughput number of processes completed per unit time Low response time time elapse from the submission of a request to the beginning of the response3/26/2003 3Topics for discussionMotivationTypes of schedulingShort-term schedulingVarious scheduling criteriaVarious algorithms Priority queues First-come, first-served Round-robin Shortest process first Shortest remaining time and othersQueuing Model and Performance Analysis3/26/2003 4The CPU-I/O CycleWe observe that processes require alternate use of processor and I/O in a repetitive fashionEach cycle consist of a CPU burst (typically of 5 ms) followed by a (usually longer) I/O burst A process terminates on a CPU burstCPU-bound processes have longer CPU bursts than I/O-bound processes3/26/2003 5CPU/IO BurstsBursts of CPU usage alternate with periods of I/O wait a CPU-bound process an I/O bound process3/26/2003 6MotivationConsider these programs with processing-component and IO-component indicated by upper-case and lower-case letters respectively.A1 a1 A2 a2 A30 30 50 80 120 130 ===> JOB AB1 b1 B20 20 40 60 ====> JOB BC1 c1 C2 c2 C3 c3 C4 c4 C5 0 10 20 60 80 100 110 130 140 150 =>JOB C3/26/2003 7MotivationThe starting and ending time of each component are indicated beneath the symbolic references (A1, b1 etc.)Now lets consider three different ways for scheduling: no overlap, round-robin, simple overlap.Compare utilization U = Time CPU busy / Total run time3/26/2003 8Scheduling CriteriaCPU utilization – keep the CPU as busy as possibleThroughput – # of processes that complete their execution per time unitTurnaround time – amount of time to execute a particular processWaiting time – amount of time a process has been waiting in the ready queueResponse time – amount of time it takes from when a request was submitted until the first response is produced, notoutput (for time-sharing environment)3/26/2003 9Optimization CriteriaMax CPU utilizationMax throughputMin turnaround time Min waiting time Min response time3/26/2003 10Types of schedulingLong-term : To add to the pool of processes to be executed.Medium-term : To add to the number of processes that are in the main memory.Short-term : Which of the available processes will be executed by a processor?IO scheduling: To decide which process’s pending IO request shall be handled by an available IO device.3/26/2003 11Classification of Scheduling ActivityLong-term: which process to admitMedium-term: which process to swap in or outShort-term: which ready process to execute next3/26/2003 12First-Come, First-Served (FCFS) SchedulingProcess Burst TimeP124P23P33Suppose that the processes arrive in the order: P1, P2, P3 The Gantt Chart for the schedule is:Waiting time for P1= 0; P2= 24; P3 = 27Average waiting time: (0 + 24 + 27)/3 = 17P1P2P324 27 3003/26/2003 13FCFS Scheduling (Cont.)Suppose that the processes arrive in the orderP2, P3, P1.The Gantt chart for the schedule is:Waiting time for P1 =6;P2= 0; P3 = 3Average waiting time: (6 + 0 + 3)/3 = 3Much better than previous case.Convoy effectshort process behind long processP1P3P2633003/26/2003 14Shortest-Job-First (SJR) SchedulingAssociate with each process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time.Two schemes:  nonpreemptive – once CPU given to the process it cannot be preempted until completes its CPU burst. preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF).SJF is optimal – gives minimum average waiting time for a given set of processes.3/26/2003 15Example of Non-Preemptive SJFProcess Arrival Time Burst TimeP10.0 7P22.0 4P34.0 1P45.0 4Average waiting time = (0 + 6 + 3 + 7)/4 - 4P1P3P273160P48 123/26/2003 16Example of Preemptive SJFProcess Arrival Time Burst TimeP10.0 7P22.0 4P34.0 1P45.0 4Average waiting time = (9 + 1 + 0 +2)/4 - 3P1P3P242110P45 7P2P1163/26/2003 17Determining Length of Next CPU BurstCan only estimate the length.Can be done by using the length of previous CPU bursts, using exponential averaging.:Define 4.10 , 3.burst CPU next the for value predicted 2.burst CPU of lenght actual 1.≤≤==+αατ1nthnnt().tnnnταατ−+==113/26/2003 18Examples 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 -α) α t n -1+ …+(1- α) j α t n -j+ …+(1- α)n+1 τ1Since both α and (1 - α) are less than or equal to 1, each successive term has less weight than its predecessor.3/26/2003 19More on Exponential AveragingS[n+1] next burst, s[n] current burst S[n+1] = α T[n] + (1-α) S[n] ; 0 < α < 1 more weight is put on recent instances whenever α> 1/nBy expanding this eqn, we see that weights of past instances are decreasing exponentially S[n+1] = αT[n] + (1-α)αT[n-1] + ... (1-α)iαT[n-i] + ... + (1-α)nS[1] predicted value of 1st instance S[1] is not calculated; usually set to 0 to give priority to to new processes3/26/2003 20Exponentially Decreasing Coefficients3/26/2003 21Exponentially Decreasing CoefficientsHere S[1] = 0 to give high priority to new processesExponential averaging tracks changes in process behavior much faster than simple averaging3/26/2003 22Shortest Process Next: critiquePossibility of starvation for


View Full Document

UB CSE 421 - Process Scheduling

Documents in this Course
Security

Security

28 pages

Threads

Threads

24 pages

Security

Security

20 pages

Security

Security

52 pages

Security

Security

20 pages

Load more
Download Process Scheduling
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Process Scheduling and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Process Scheduling 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?