Question: A program contains a while loop whose each iteration reads one integer from a long file of integers on the disk. The file of 3
A program contains a while loop whose each iteration reads one integer from a long file of integers on the
disk. The file of bit integers is of size Mbytes. The while loop terminates when the end of the file has
been reached. Excluding time waiting on the disk, each iteration of the while loop takes cycles on
average. The file is read using a fileread system call that returns the next integer one at a time. Internally,
for efficiency, the fileread system call reads in one track Kbyte of data at a time into an internal buffer
that is invisible to the caller. When the buffer becomes empty, the next sector is read. The time to read a
track from the disk is cycles.
a How many track reads does the program do using the system call?
b What is the total time for computation only, excluding disk
c Assume that all the other tasks that the program is running take an insignificant portion of the CPU's
time. What percentage of the program's total wallclock execution time is spent waiting for the
disk?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
