SIGHUP: a process exit when the terminal running the process closes. It’s assumed that if the terminal closes, the user is no longer interested in the results of the command
HANGup
tells the app to exit when shell closes
Process State
Ready: waiting to be assigned to CPU
Running: in CPU
List:
D uninterruptible sleep (usually IO)
I Idle kernel thread
R running or runnable (on run queue)
S interruptible sleep (waiting for an event to complete)
T stopped by job control signal
t stopped by debugger during the tracing
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z defunct (“zombie”) process, terminated but not reaped by its parent
Process Control Block (PCB)
Found in memory
PCB manages information associated with each process:
Process state: running, waiting, etc.
Program counter: location of instruction to next execute
CPU registers: contents of all process-centric registers
CPU scheduling: priorities, scheduling queue pointers
Memory-management information – memory allocated
Accounting information: CPU used, time elapsed since start
I/O information: I/O devices allocated, list of open files
…
Process scheduling:
Ready queue: processes residing in main memory waiting to execute
Wait queue: processes waiting for an event (ie I/O)
A context switch occurs when the CPU switches from one process to another.
Pure overhead
Hardware-dependent
Process creation:
OSs provide a create-process function to create a new process
Parent process is the one called the create-process function (folk())
Child process is created after the create-process function is called
Execution options:
Parent and children execute concurrently
Parent waits until children terminate
Parent process links to many child process below like a tree
If parent process is terminated, all children are also killed
Process termination:
If it executes last statement and call exit() to notify OS to delete it