Assume the following: a. Disk spooling is NOT being used. b. The printer does NO
ID: 3543210 • Letter: A
Question
Assume the following:
a. Disk spooling is NOT being used.
b. The printer does NOT have a hardware buffer to hold the output while the printer is printing
(The theme music from Mission Impossible is playing faintly in the background).
SIMULATE the following scenario
A hypothetical program computes for three seconds then outputs a variable length record to be printed. The printer takes from 0.75 to 4.75 seconds (average time is 2.75 seconds) to print each output record. (Use a random number generator)
The hypothetical program loops 500 times for each case of software buffers (0, 1, 2, 3, 4, 5, 10, 25, and 100 software output buffers). Calculate the AVERAGE time for the program to
Explanation / Answer
#Lab 1 using python.
Import random #Importing random number generator.
def main():
buffers= [0,1,2,3,4,5,10,25,100]; #Defining the buffers using list.
for buffer in buffers:
sum=0;
for i in range (1, 500): # Create a loop which will create random number and increment 500 times.
time= (random.uniform (0.75,4.75))+3
sum = sum + time
average= sum/500; #Finding the average of each buffers random numbers.
print("For Buffer",buffer,",the average time is",average,"."); #Print the output.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.