Whenever a process issues a system call (for example, blocking read(2)
), the process starts in kernel mode, i.e. kernel code that processes a specific system call is called.
After that, depending on the base device and driver, the process can be paused and placed in a waiting queue. When the key is pressed, the kernel code that processes the interrupts is called, and the key pressed is subtracted from there.
The kernel then resumes the process waiting for this input and transfers the data, copying it from the address space of the kernel to the address space of a specific process.
source share