Docsity

CS 472 Programming Project 4: Disk Scheduling Simulation - Prof. M. Temte, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
CS 472 Programming Project 4 Due
date:
Fall 2009 70 Points Thursday,
April 30
Start by implementing an ADT for a disk drive, with an operation that simulates disk access time
according to the formula
A = S + L + T,
where S is seek time, L is latency time, and T is transfer time. Seek time S is given by N*R+V,
where N is the number of tracks traversed, R=0.5 msec/track is rate of arm movement, and V=4.2
msec is the overhead time incurred whenever the arm must move to a new track. Assume the disk
spins at 3600 rpm and has track numbers 0..79. Also assume each track has 16 sectors numbered
0..15. Thus, the time needed for any sector to completely pass under the head is 1.0/(3600.0/60.0)/
16.0 = 1.0416666 msec. The head initially is on track 0 and passes over the beginning of sector 0 at
simulated time 0.0 sec. Your ADT should remember the current track number of the head and
know which sector is under the head at any time.
This disk drive ADT should then be used to simulate the performance of a variety of disk
scheduling policies. Data for the simulation is in the file Project4.dat, located at the class web site.
This file contains a sequence of single sector disk requests, one request per line, according to the
format:
<request number> <track number> <sector number>
Write a main program that separately simulates the performance of the disk scheduling policies
known as FIFO, SSTF, and C-SCAN. For each policy tested, your program should forward a disk
request every 8.0 msec to a queue of waiting requests. For the SSTF policy, when there is a choice
of moving the head to equidistant outward or inward tracks, choose inward first, then outward the
next time there is a choice, and continue alternating. For both SSTF and C-SCAN, if there is more
than one request on the next track, choose requests in the order that they will come under the head.
This queue should be fed from file Project4.dat and be initialized at simulated time 0.0 with the first
request. Recall that the disk head should initially be on track 0 at the beginning of sector 0. The
8.0 msec request arrivals can be simulated as follows: whenever the current request has been
completed, update the current time, admit as many new requests to the queue as would have arrived
by the current time, and schedule the next request from the queue.
Your program should generate a report file named Project4.out with a section for each scheduling
policy. Each section should contain a line for each of the first 40 disk requests in the order of
service (including all requests would generate too much output). Each line should contain: (1)
request number, (2) track number and (3) sector number of the request, (4) simulated time of at
beginning of request processing, (5) number of tracks of head travel to fulfill the request, (6) seek
time, (7) latency time, (8) access time, and (9) the request queue size before processing the request.
At the end of each section, results for all requests in the section (not just the 40 printed) should be
pf3

Partial preview of the text

Download CS 472 Programming Project 4: Disk Scheduling Simulation - Prof. M. Temte and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

CS 472 Programming Project 4 Due

date:

Fall 2009 70 Points Thursday,

April 30 Start by implementing an ADT for a disk drive, with an operation that simulates disk access time according to the formula A = S + L + T, where S is seek time, L is latency time, and T is transfer time. Seek time S is given by N*R+V, where N is the number of tracks traversed, R=0.5 msec/track is rate of arm movement, and V=4. msec is the overhead time incurred whenever the arm must move to a new track. Assume the disk spins at 3600 rpm and has track numbers 0..79. Also assume each track has 16 sectors numbered 0..15. Thus, the time needed for any sector to completely pass under the head is 1.0/(3600.0/60.0)/ 16.0 = 1.0416666 msec. The head initially is on track 0 and passes over the beginning of sector 0 at simulated time 0.0 sec. Your ADT should remember the current track number of the head and know which sector is under the head at any time. This disk drive ADT should then be used to simulate the performance of a variety of disk scheduling policies. Data for the simulation is in the file Project4.dat, located at the class web site. This file contains a sequence of single sector disk requests, one request per line, according to the format: Write a main program that separately simulates the performance of the disk scheduling policies known as FIFO, SSTF, and C-SCAN. For each policy tested, your program should forward a disk request every 8.0 msec to a queue of waiting requests. For the SSTF policy, when there is a choice of moving the head to equidistant outward or inward tracks, choose inward first, then outward the next time there is a choice, and continue alternating. For both SSTF and C-SCAN, if there is more than one request on the next track, choose requests in the order that they will come under the head. This queue should be fed from file Project4.dat and be initialized at simulated time 0.0 with the first request. Recall that the disk head should initially be on track 0 at the beginning of sector 0. The 8.0 msec request arrivals can be simulated as follows: whenever the current request has been completed, update the current time, admit as many new requests to the queue as would have arrived by the current time, and schedule the next request from the queue. Your program should generate a report file named Project4.out with a section for each scheduling policy. Each section should contain a line for each of the first 40 disk requests in the order of service (including all requests would generate too much output). Each line should contain: (1) request number, (2) track number and (3) sector number of the request, (4) simulated time of at beginning of request processing, (5) number of tracks of head travel to fulfill the request, (6) seek time, (7) latency time, (8) access time, and (9) the request queue size before processing the request. At the end of each section, results for all requests in the section (not just the 40 printed) should be

summarized by stating the total number of requests processed by the policy, the total time to process all requests, the average seek time , and the maximum queue size during processing. There are sample calculations below that you may use to check the accuracy of your disk ADT implementation. The section also indicates the required output format. Submit

  1. Hard copy of a compiler listing (with line numbers) of your program.
  2. Hard copy of output file Project4.out.
  3. Disk with the following at the root: a. Project4 folder with .exe or .class files b. file Project4.dat c. file Project4.out. The path names your program uses should be such that I can run it simply by putting your disk in my drive and executing it in DOS.

Calculation of access time for first three requests of the FIFO simulation

All times in msec. Head initially at start of sector 0 of track 0. **First three requests: 1 42 1 2 51 12 3 23 0 req. track sect. simul. # seek latency access queue number number number time tracks time time time size


1 42 1 0.00 42 25.2 9.175 35.417 1 2 51 12 35.417 9 8.7 1.717 11.458 4 3 23 0 46.875 28 18.2 1.592 20.833 4 4 67.708 6** Calculations of latency time and access time:

  1. 24.192 sectors traversed at end of 25.2 seek time, leaving 0.808 of sector 8 to traverse together with sectors 9, 10, …, 15, and 0. This gives latency time of (8.808)*(1.04166…) = 9.175 msec. Transfer time of sector 1 is 1.04166… msec. Total access time is 25.2 + 9.175 + 1.0466… = 35.41666… msec.
  2. At end of seek, head is 0.352 of the way across sector 10, leaving just 0.648 of sector 10 together with sector 11 to traverse. This takes latency time (1.648)*(1.04166…) = 1.71666…