1,751 views
2 votes
2 votes

Consider a process P1 that is executing on a Linux-like OS on a single core system. When P1 is executing, a disk interrupt occurs, causing P1 to go to kernel mode to service that interrupt. The interrupt delivers all the disk blocks that unblock a process P2 (which blocked earlier on the disk read). The interrupt service routine has completed execution fully, and the OS is just about to return back to the user mode of Pl. At this point in time, what are the states (ready/running/blocked) of processes P1 and P2 ? 

  1. P1 is ready and P2 is ready
  2. P1 is ready and P2 is running
  3. P1 is running and P2 is ready
  4. P1 is blocked and P2 is ready

 

1 Answer

0 votes
0 votes

Apologies for the mistake in this question.

The question mentions that  while P1 is executing, the data from the disk arrives and the interrupt gets serviced by process P1.

I think question is wrongly formulated as it should be:
1. P1 is executing
2. Disk interrupt occurs. 
3. Interrupt is serviced by the ISR after the completion of currently running instruction cycle by the CPU. 

After every instruction cycle the processor will check for interrupts to be processed if there is no interrupt is present in the system it will go for the next instruction cycle which is given by the instruction register.

If there is an interrupt present then it will trigger the interrupt handler(ISR), the handler will stop the present instruction which is processing and save its configuration in a register and load the program counter of the interrupt from a location which is given by the interrupt vector table. After processing the interrupt by the processor interrupt handler will load the instruction and its configuration from the saved register, process will start its processing where it’s left. This saving the old instruction processing configuration and loading the new interrupt configuration is also called as context switching.

Thus process P1 doesn't service the interrupt as mentioned by the question.

Related questions

1 votes
1 votes
0 answers
2
0 votes
0 votes
0 answers
3
dd asked Sep 13, 2018
406 views
Give an example each for a hardware interrupt, an explicit software interrupt, and an implicit software interrupt, and discuss the possible operations as part of the inte...
0 votes
0 votes
0 answers
4
srestha asked Jul 26, 2018
702 views
1)What is difference between internal interrupt and software interrupt?2) What is difference between external interrupt and hardware interrupt?