Reputation: 19050
If a thread is waiting for data from the network, it is de-scheduled by the kernel to let other threads use the CPU.
Once data have been provided by the network device, this thread must be scheduled again if its priority is greater than the running thread. Who is responsible for re-running the scheduler, the device driver handling the interrupt, or the kernel (which part)?
Manu
Upvotes: 2
Views: 136
Reputation: 24857
Both. The drivers and kernel are essentially an interrupt-handler that can decide to return-from-interrupt to a different thread than the one that was interrupted. The driver handles the interrupt, signals that the waiting thread has become ready and jumps/calls to the OS entry point so that the scheduler may change the set of ready/running threads. Usually, the OS will boost the priority of threads that have just become ready after an I/O wait, so your network-thread has a good chance of being run 'immediately'.
Upvotes: 3