CSE 451
Operating Systems
L4 - Interrupt Handling
Slides by: Tom Anderson
Baris Kasikci
User/Kernel Virtual Addresses
System Calls
UNIX systems calls (1972)
Kernel System Call Handler
User<->Kernel Transitions
| | | |
| | | |
| | | |
Why dup?
A shell is a user application that runs other programs
% grep “To be or not” Shakespeare.txt
shell creates process “grep”, with arguments; outputs to stdout
% grep “To be or not” Shakespeare.txt > logfile
shell creates process “grep”, with arguments; outputs to logfile
fd = open(“logfile”)
close(stdout)
dup(fd) -> grep uses logfile as its stdout
% grep “To be or not” Shakespeare.txt | wc
Shell creates two processes, “grep” and “wc”
A pipe provides one-way communication between two processes
Shell sets stdout of grep to be one end of pipe; stdin of wc to be the other
Kernel->User Mode Switch
Restoring User State
How do we take interrupts/exceptions safely?
Interrupt Vector on x86
Kernel (Interrupt) Stack
interrupted user process?
Interrupt Stack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Interrupt Masking
Interrupt Handlers
Case Study: x86 Interrupt (Hardware Support)
Before Interrupt
|
|
|
During Interrupt
|
|
|
|
|
|
|
|
|
|
After Interrupt
|
|
|
xk
At end of handler
Question