Blocking under Linux

  
 The concept of blocking. When a process calls a blocked system function, the process is placed in the Sleep state, when the kernel schedules other processes to run until the event waiting for the process occurs (such as receiving a packet on the network, or calling sleep to specify It's time to sleep) it is possible to continue running. In contrast to the sleep state, the running state is in the Linux kernel. The running process is divided into two cases:
¨ is being scheduled to execute. The CPU is in the context of the process. The program counter (eip) stores the instruction address of the process. The general-purpose register stores the intermediate result of the process of the process, the instruction that is executing the process, and the address of the process is being read and written. space.
¨ Ready state. The process does not need to wait for what happens and can be executed at any time, but the CPU is still executing another process, so the process waits in the ready queue to be scheduled by the kernel. There may be multiple ready processes in the system at the same time, so who is scheduled to execute? The kernel's scheduling algorithm is based on priority and time slice, and dynamically adjusts its priority and time slice according to the running status of each process, so that each process can get the opportunity to perform fairly fairly, and at the same time take into account the user experience. The process that interacts with the user cannot be made too slow.
Copyright © Windows knowledge All Rights Reserved