A process in an Operating System is considered to occupy several states and a process transitions between these states. A scheduler is responsible for assigning CPU time to a process. However, a process that is performing an Input Output Operation and has gone into the blocked state must transition to the ready state or the ready queue to be more precise to be considered for scheduling by the scheduler. Which component of the operating system handles this transition? And does this transition require any CPU time for operation?
1 Answer
When an I/O is started, it will typically have an I/O request structure associated with it that includes items like the process ID that the I/O belonged to. When the I/O completes the device driver will typically fork into an OS level I/O subsystem in the OS which will queue the IO request packet notification to the process and move the process to a computable queue. (this may vary a little from one OS to another). The process then waits for it's turn to become computable.
And yes, anything that executes code requires CPU time... though this is considered "interrupt time" rather than user time.
-
$\begingroup$ So that means that while another process is executing, a process cannot make the transition from the blocked state to the ready state since it would require CPU time? $\endgroup$– kaurayCommented Feb 7, 2016 at 16:49
-
1$\begingroup$ @KaustabhaRay No. An interrupt can happen at any time when a process is executing. When the interrupt happens, the process stops executing while the CPU is executing the interrupt handler. The interrupt handler can make the process state transition. $\endgroup$ Commented Feb 7, 2016 at 18:56