Open In App

What is Reentrant Kernel?

Reentrant Kernel: In kernel mode, a reentrant kernel allows processes (or, more precisely, their corresponding kernel threads) to give up the CPU. They have no effect on other processes entering kernel mode. Multiple processor systems may be scheduled together in the case of single-processor systems.

Example:



A disc read is an example of this. When a user program requests a disc read, the scheduler will delegate the CPU to another process (kernel thread) until the disc controller issues an interrupt indicating that the data is accessible and our thread can be resumed. This process can still access I/O, such as user input, which requires kernel functions. The system remains responsive, and the amount of CPU time wasted as a result of IO delays is reduced. The original function (whatever requested data) would be blocked in a non-reentrant kernel until the disc read was completed.

If a computer program or routine can be safely called again before its previous invocation has been completed, it is said to be reentrant (i.e it can be safely executed concurrently). A computer program or routine that is reentrant:



Non-reentrant functions can still be executed by reentrant kernels if locks are used to ensure that only one process can run the non-reentrant function. Even though the current process is operating in kernel mode, hardware interrupts can suspend it (allowing things like Ctrl+c to cease execution).

Kernel Control Path: A set of instructions that the kernel executes in order to handle a system call. Normally, instructions are executed in order, but some activities force the CPU to interleave control routes. In user mode, the following system call is made: The scheduler chooses a new process to run and switches it on. On behalf of two separate processes, two control pathways are executed.

Article Tags :