ITPEC FE Morning April 2020 Question 20

Topic: Software

The four jobs A through D are executed based on the conditions below and printed. How many seconds is it until all printing is completed after a job is started?

[Conditions](1)All jobs are launched at once, and executed by the CPU with a multiplicity of one.(2)Job A has the highest priority, followed by B, C, and D.(3)After each job is executed, a spooling function prints each job in turn on a single printer.(4)The execution time and printing time when each job is executed separately are as shown in the table.(5)Other overheads are not considered.

Unit: seconds

JobCPU Execution timePrinting time
A5050
B3040
C2030
D4020

Explanation

190 seconds — the CPU runs the jobs in priority order while the single printer prints them one after another, and printing is the bottleneck.

Each print starts when both the job's CPU run has ended and the printer is free:

JobCPU runPrint startsPrint ends
A0 to 5050100
B50 to 80100140
C80 to 100140170
D100 to 140170190

Once A starts printing the printer never idles, so the total is A's CPU time plus all printing: 50 + 50 + 40 + 30 + 20 = 190.

Answer (c)

Why not others:

  • •(a) 100 — only job A's run and print, 50 + 50
  • •(b) 160 — D's CPU end at 140 plus its 20 s print, as if the printer were free when D finishes; B and C still hold it until 170
  • •(d) 280 — adds all CPU and printing times as if nothing overlapped; spooling lets the printer work while the CPU runs the next job

Key rule: With spooling, the CPU and the printer work in parallel; each job uses a device when both are ready, and the total ends when the busier device finishes its last job.

Software · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.