开发者

Blocking syscalls with no other load in system (linux kernel)

开发者 https://www.devze.com 2022-12-28 15:58 出处:网络
If there is only 1 running application in the system (and default 100 sleeping process), and it do a blocking syscall (I\'m interested in blocking recv or blocking read). Will linux kernel delete this

If there is only 1 running application in the system (and default 100 sleeping process), and it do a blocking syscall (I'm interested in blocking recv or blocking read). Will linux kernel delete this application from task_t *current开发者_JS百科 pointer?


You're asking will the running application sleep?

If there is data to satisfy the read, then it will not sleep -- the kernel will copy the queued data into your buffer and return from the syscall. If there is no waiting data, then the process will sleep. This does not depend on the state of other processes on the system. If all the processes are sleeping, the kernel will do useful things like putting the CPU into a lower-power state, until an interrupt occurs, which might possibly mean that the data your process was waiting for may now be available.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号