Search code examples
jobsprocessorinterrupt-handlinginterrupt

Processor Manager and Job Interrupts


This is a question from my homework in CIS-21: Operating Systems class, and I already have an answer, because the instructor gave it to us, but he did not want to explain why THIS was the answer. So here's the question:

A job running in a system, with variable time quantum per queue, needs 30 milliseconds to run to completion. If the first queue has a time quantum of 5 milliseconds and each queue thereafter has a time quantum that is twice as large as the previous one, how many times will the job be interrupted and on which queue will it finish its execution?

The second part is easy, the job will finish its execution on the 3rd level queue (first level queue is 5 milliseconds, second level queue is 10 milliseconds, and third level queue is 20 milliseconds). Since the job requires 30 milliseconds, it'll execute for 5 milliseconds in the first level queue, then for 10 milliseconds in the second level queue, and for 15 milliseconds in the third level queue.

The first part of the question is what everyone, and I mean everyone, in the class did not get. The instructor said that there will be total of 3 interrupts. But when we were all saying that it would be 2 interrupts, he became angry and moved on.... weird, huh? So much for paying my money for a proper education.

Anyways, what we were thinking is that the job runs for 5 milliseconds in the first queue, then an interrupt is issued, its PCB (Personal Control Block) is updated, and it's moved into the next lower queue, which is the 10 millisecond queue. Once its turn is reached, the job will be executed in the second level queue for 10 milliseconds and an interrupt will be issued. The information will be updated in the PCB and the job will be moved to the next lower queue, which is the 20 millisecond queue. So far it's been two interrupts. Once the job reaches the top of the queue in the third level queue, it's executed for 15 seconds and finishes its execution before time quantum for the queue expires.

So, where did he get the 3rd interrupt? Would the 3rd interrupt be issued when the program finishes its execution? I thought job interrupts only occur when there's an internal interrupt, such as for the I/O request, when time quantum expires and job's cycles are not complete, or when there's an illegal operation/instruction within the job.

So, are there 2 or 3 job interrupts, and why?

EDIT: I emailed the instructor after getting conflicting answers on the internet, and he admitted that he made a mistake and it's only 2 interrupts, since the job gets finished by the 20ms queue. Just in case anyone is wondering.


Solution

  • 2 Interrupts, the instructor made an error. The job is finished by 20ms queue.