-1
$\begingroup$

I wonder how does particular process gets CPU time or resources whenever it's required to execute some instructions? When a process is in the idle state or waiting for input, it's not occupying the CPU but, if it is suddenly found that there is an instruction that requires CPU time, who tells that to the CPU?

$\endgroup$
1
$\begingroup$

Typically it will be an operating system process to take responsibility for "waking up" other processes. Most commonly, the so-called process scheduler, which is a key component of every operating system.

For example, if a user process requires some data to be read from disk before continuing its computation, it may be put into a waiting state by the scheduler until the data are available. The scheduler gives the CPU to other processes that are runnable (not waiting), then when the data are available the user process becomes runnable again.

$\endgroup$
0
$\begingroup$

This is done by the operating system's scheduler. This software module is responsible for allocating CPU time to runnable processes and also updating which processes are runnable, e.g., when a process has to wait for I/O or when I/O completes, allowing a process to run again.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.