Lesson 2 Flashcards
trap instruction
Sets kernel mode,integrated with the system call in C code
Calling kernel level from user level
system call interface
Handles inter-process communication, scheduling and memory management
Process Control System
Handles hardware from kernel level
Hardware Control
System call with TWO return values
parent gets PID of child, child gets 0
The stacks of a Unix process
One for user mode
One for system calls in kernel mode
Memory layout: Text
read-only machine code
4 facts after a fork
- Child gets a copy of parent’s code and data
- except fork returns child’s PID to parent, and zero to child
- Parent and child share the same open files
- Child gets copy of parent’s signal table, but with no pending signals
wait [n]
- pauses until execution of a background process with PID = n has ended
- If n not given, waits for all processes known to it
- returns the exit status of the last job which terminated
- returns 127 in the event that n specifies a non-existent job
- returns zero if no jobs to wait for
exec
Change program in the current process, keeping the old PID
critical resource
to be deterministic: only one process or thread at a time
static - on variables declared outside function (and functions themselves)
not visible outside the declaring file
static - on variables declared inside functions
keeping value from one function execution to the next.