Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can kernel handle two syscalls at the same time by doing multithreading?

When user applications do a system call, the program enters to kernel mode and OS handles user requests. If at the same time two processes do a syscall, can OS do a multithreading? For example there could be two layer of a kernel, second layer will handle user requests by doing multithreading, and the first layer would control the second layer. Is this impossible? Or it's just not good at practical use?

Thanks.

like image 262
user1289 Avatar asked Apr 25 '26 14:04

user1289


1 Answers

It's done routinely. When a process (thread of a process) traps into the kernel, the kernel "borrows" the user thread to run the kernel code. It's been a long time (decades?) since we still had a "unique kernel lock" that forced sequential executions of threads inside the kernel. Beside the kernel itself is typically running multiple threads for its own work (paging, write-back, ....).

like image 77
Laurent Michel Avatar answered Apr 28 '26 13:04

Laurent Michel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!