linux - User mode and kernel mode switching during system calls -


on broad level of following happens during linux system call.

  1. user mode process gets elevated kernel mode , execute kernel code(interrupt service routines) , return normal mode. in other words user process consuming cpu.
  2. there kernel process running in kernel mode. user mode processes dispatch tasks(in form of system calls) kernel process. kernel process finishes job , return results user mode processes. in other words user process idle during time , kernel process 1 consuming cpu.
  3. something else.

it 1 little bit of 2.

from perspective of usermode application, system calls happen synchronously. times however, system call not have needs return, puts process sleep. doesn't happen; simple system calls complete synchronously. however, need wait long-running i/o task complete.

the kernel has interrupt handlers , kernel threads handle things asynchronously. example hard drive interrupted system indicate retrieved file reading. 1 of these asynchronous events can come along , wake process, system call has needs return userspace.

so looks whole process happened synchronously, illusion.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -