DOC PREVIEW
UB CSE 421 - Process Scheduling

This preview shows page 1-2-15-16-31-32 out of 32 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 32 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 32 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 32 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 32 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 32 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 32 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 32 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Process SchedulingIntroductionTopics for discussionThe CPU-I/O CycleCPU/IO BurstsMotivationSlide 7Scheduling 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 CoefficientsShortest job first: critiquePriority SchedulingRound Robin (RR)Example of RR with Time Quantum = 20Various MetricsScheduling in Real-Time SystemsMultimedia Process SchedulingRate Monotonic SchedulingEarliest Deadline First Scheduling (1)Earliest Deadline First Scheduling (2)SummaryExercises01/14/19 1Process SchedulingB.Ramamurthy01/14/19 2Introduction•An 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 response01/14/19 3Topics for discussion•Motivation•Types of scheduling•Short-term scheduling•Various scheduling criteria•Various algorithms–Priority queues–First-come, first-served–Round-robin–Shortest process first–Shortest remaining time and others•Realtime scheduling01/14/19 4The CPU-I/O Cycle•We observe that processes require alternate use of processor and I/O in a repetitive fashion•Each cycle consist of a CPU burst (typically of 5 ms) followed by a (usually longer) I/O burst •A process terminates on a CPU burst•CPU-bound processes have longer CPU bursts than I/O-bound processes01/14/19 5CPU/IO Bursts•Bursts of CPU usage alternate with periods of I/O wait–a CPU-bound process–an I/O bound process01/14/19 6Motivation•Consider 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 A B1 b1 B20 20 40 60 ====> JOB B C1 c1 C2 c2 C3 c3 C4 c4 C5 0 10 20 60 80 100 110 130 140 150 =>JOB C01/14/19 7Motivation•The 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 time01/14/19 8Scheduling Criteria•CPU utilization – keep the CPU as busy as possible•Throughput – # of processes that complete their execution per time unit•Turnaround time – amount of time to execute a particular process•Waiting time – amount of time a process has been waiting in the ready queue•Response time – amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)01/14/19 9Optimization Criteria•Max CPU utilization•Max throughput•Min turnaround time •Min waiting time •Min response time01/14/19 10Types of scheduling•Long-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.01/14/19 11Classification of Scheduling Activity•Long-term: which process to admit•Medium-term: which process to swap in or out•Short-term: which ready process to execute next01/14/19 12First-Come, First-Served (FCFS) SchedulingProcess Burst TimeP124 P2 3 P3 3 •Suppose 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 = 27•Average waiting time: (0 + 24 + 27)/3 = 17P1P2P324 27 30001/14/19 13FCFS Scheduling (Cont.)Suppose that the processes arrive in the order P2 , P3 , P1 .•The Gantt chart for the schedule is:•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 processP1P3P263 30001/14/19 14Shortest-Job-First (SJR) Scheduling•Associate 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.01/14/19 15Process Arrival Time Burst TimeP10.0 7 P22.0 4 P34.0 1 P45.0 4•Average waiting time = (0 + 6 + 3 + 7)/4 = 4Example of Non-Preemptive SJFP1P3P273 160P48 1201/14/19 16Example of Preemptive SJFProcess Arrival Time Burst TimeP10.0 7 P22.0 4 P34.0 1 P45.0 4•Average waiting time = (9 + 1 + 0 +2)/4 = 3P1P3P242110P45 7P2P11601/14/19 17Determining Length of Next CPU Burst•Can 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1101/14/19 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 1•Since both  and (1 - ) are less than or equal to 1, each successive term has less weight than its predecessor.01/14/19 19More on Exponential Averaging•S[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/n•By 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 processes01/14/19


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?