This preview shows page 1. Sign up to view the full content.
Unformatted text preview: uction. The most important use of traps is to provide a procedurelike interface between user programs and the kernel known as a system call. User programs often need to request services from the kernel such as reading a ﬁle ( read), creating a new process (fork), loading a new program (execve), or terminating the current process (exit). To allow controlled access to such kernel services, processors provide a special “syscall Ò” instruction that user programs can execute when they want to request service Ò. Executing the syscall instruction causes a trap to an exception handler that decodes the argument and calls the appropriate kernel routine. Figure 8.6 summarizes the processing for a system call. From a programmer’s perspective, a system call is identical
(1) Application syscall makes a Inext system call (2) control passes to handler (3) trap handler runs (4) handler returns to instruction following the syscall Figure 8.6: Trap handling. The trap handler returns control to the next instruction in the application program’s control ﬂow. to a regular function call. However, their implementations are quite different. Regular functions run in 396 CHAPTE...
View Full Document
- Spring '10
- The American