-
1 - 4: user calls c library read routine
- 5: read library routine doesn't read; it executes in
user mode, puts the system call number for read in a register and
executes a trap.
The system trap handler takes over executing in kernel mode.
- 6 - 8: The kernel routine uses the value in the register to switch to the appropriate routine to execute the read system call (do_read) on behalf of the user (still in kernel mode) copying the data into the user's buffer variable.
-
9: kernel routine returns from the trap call (a special return) that restores the processor to user mode as well as returning to the user routine.
- 11: The user level read library routine returns to the user.