Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating System Concepts and Techniques Lecture 7 Scheduling-3 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First.

Similar presentations


Presentation on theme: "Operating System Concepts and Techniques Lecture 7 Scheduling-3 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First."— Presentation transcript:

1 Operating System Concepts and Techniques Lecture 7 Scheduling-3 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.comwww.iUniverse.comwww.barnesandnoble.comwww.amazon.com

2 2 Computation of Turnaround Time (TT) Turnaround Time: is the time span starting from when a request is submitted and ending whenever the requested execution is completed We take Average TT to be the only performance measure of schedulers Three schedulers FCFS, SPN, and RR will be considered A system with the following three processes is examined ProcessArrival timeCPU burst P1P1 104 P2P2 113 p3p3 122

3 FCFS scheduler The following table shows how FCFS behaves 3 ProcessArrival timeCPU burstCompletion time Turnaround time P1P1 104144 P2P2 113176 P3P3 122197 Single-programming and FIFO scheduling Average turnaround time = 17/3 = 5.66

4 SPN scheduler The following table shows how SPN behaves With SPN, whenever a scheduling decision has to be made, the decision is based on available information, not of future information, therefore at time 10 process 1 is picked but at time 14 process 3 is picked 4 Single-programming and SPN scheduling Average turnaround time = 16/3 = 5.33 ProcessArrival timeCPU burstCompletion time Turnaround time P1P1 104144 P2P2 113198 P3P3 122164

5 RR scheduler The following chart shows how SPN behaves When processes do not have any I/O operation and do not have to wait for any event, RR scheduler may perform worse than FCFS and SPN In cases of I/O, depending on average CPU wait ration, usually RR performs better 5 Multi-programming and RR scheduling Average turnaround time = 23/3 = 7.66 10.0 11.0 12.0 18.0 19.0 Time 1.0 0.5 2.0 0.5 0.5 2.0 0.5 Processes P 3 P 2 P 1 2.0

6 RR for Processes with I/O Here, we consider the same set of tasks but the average I/O ratio w=0.4, i.e., when there is only one process 40% of CPU time is wasted When there are two processes CPU wait fraction is w 2 =0.16 hence 84% of CPU time is useful, every process’s share is 42% When there are three processes CPU wait fraction is w 3 =0.064 hence approximately 94% of CPU time is useful, every process’s share is 31.3% 6 Multi-programming and RR scheduling with w=0.4 Average turnaround time = 8.55 10.00 11.00 12.00 18.41 19.79 20.46 Time 0.6 0.42 2.0 0.58 0.4 0.42 2.0 0.58 Processes P 3 P 2 P 1 2.0

7 Disk I/O Scheduling Disks have their own special schedulers Unit of work is reading/writing a sector Disks constantly receive requests from different processes Request arrivals is not uniform; therefore a pool for outstanding requests is needed Disk scheduler decides which request to pick from the pool when the disk head is finished its previous request 7

8 Disk properties The simplest kind of disk is a one surface with one moving head It is composed of many concentric tracks with every track having the same number of sectors, see below 8 Track Sector Moving head

9 Reading/writing a sector Reading/Writing a sector comprises Seek time: the time length for the read/write head to move from current position to the desired track Rotational delay: is the length of time for the beginning of sector to reach the read/write head, after the head has settled on the desired track  Average rotational delay is considered to be half the time of one complete disk rotation Transfer time: The time to transfer one sector of data depends on the rotation speed, track capacity, and sector size, This is equal to: 9

10 Schedulers Rotational delay and transfer time is fixed The performance of a disk scheduler thus depends on the order in which outstanding requests are answered A track trace is set of requests in the order of arrival We study, FIFO, LIFO, SSTF, Scan, C- Scan schedulers 10

11 FIFO 11 From5034572865190120163 180 To34572865190120163 18046 Seek length 162329371257043017134Total = 494 Track trace 34, 57, 28, 65, 190, 120, 163, 163, 180, 46  Let’s assume head’s current position is on track 50  The shortest seek length for is zero  The longest seek length is n-1  With FIFO there is no risk of starvation  New request may not be served before existing ones

12 LIFO 12 From5034572865190120163 180 To34572865190120163 18046 Seek length 162329371257043017134Total = 494 Track trace 34, 57, 28, 65, 190, 120, 163, 163, 180, 46  Let’s assume head’s current position is on track 50  The shortest seek length for is zero  The longest seek length is n-1  An existing request may never get the chance to be executed because new requests keep coming, dtarvation  With LIFO, arrival of new requests causes the serving of previous ones to delay

13 Shortest Service Time First 13 Track trace 34, 57, 28, 65, 190, 120, 163, 163, 180, 46  Let’s assume head’s current position is on track 50  The shortest seek length for is zero  The longest seek length is n-1  SSTF may cause starvation for some requests  With SSTF, arrival of new requests may cause the serving of previous ones to delay From504657653428120163 180 To4657653428120163 180190 Seek length 4118316924301710Total = 222

14 Scan 14 Track trace 34, 57, 28, 65, 190, 120, 163, 163, 180, 46  Let’s assume head’s current position is on track 50  The shortest seek length for is zero  The longest seek length is n-1.  Scan is considered starvation-free  With SSTF, arrival of new requests may cause the serving of previous ones to delay From505765120163 1801904634 To5765120163 180190463428 Seek length 78554301710144126Total = 302

15 C-Scan 15 Track trace 34, 57, 28, 65, 190, 120, 163, 163, 180, 46  Let’s assume head’s current position is on track 50  The shortest seek length for is zero  The longest seek length is n-1.  Scan is considered starvation-free  With SSTF, arrival of new requests may cause the serving of previous ones to delay From505765120163 1801902834 To5765120163 180190283446 Seek length 78554301710162612Total = 320

16 Summary A scheduling strategy is usually designed to attain a defined objective, although multi-objective strategies are also possible Average turnaround time (ATT) may be used to estimate the expected time length in which a request is completed after being submitted to the system; this could be a good measure of performance Based on ATT different scheduling algorithms were investigated Besides, in this chapter, I/O scheduling was studied and different schedulers such as FIFO, LIFO, SSTF, Scan, and C-Scan were introduced 16

17 17 Find out How ATT is computed for nonpreemptive schedulers such as FIFO and SJN where w  0 How FIFO, SJN, and RR behave with respect to throughput How I/O schedulers work for two-surface disks How I/O schedulers work for disk packs, i.e., disks with multiple plates each having two surfaces How I/O schedulers work for multiples Read/write heads per surface What the role of cylinders are with respect to I/O schedulers

18 18 Any questions?


Download ppt "Operating System Concepts and Techniques Lecture 7 Scheduling-3 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First."

Similar presentations


Ads by Google