What’s a process?
Also called Task or Job sometimes
How does the Process address space looks like?
מכתובות נמוכות לגבוהות:
text segment אחריו data segment אחר כך אולי עוד כל מיני סגמנטים ואז הערימה ובסוף בכתובות הגבוהות המחסנית.
המחסנית גדלה כלפי מטה והערימה כלפי מעלה.
Can a process access its own PCB?
No. because the pcb is in kernel space.
What happens to a process after it dies?
It becomes a zombie
What syscall a parent uses to clear zombie children from the system?
wait
What flag is needed for wait to not block the parent?
WNOHANG
What are the steps of fork?
What are the steps of exec invokation?
– Stops the execution of the invoking process
– Loads the executable ‘programPath’
– Starts ‘programPath’, with ‘argv’ as its argv
– Never returns (unless fails)
– Replaces the new process; doesn’t create a new process
• In particular, PID and PPID are the same before/after exec*()
Who wait()-s upon an “orphan” process?
In linux, Init.
If a parent process terminates, then its zombie children (if any) are
adopted by init
What are signals & signal handlers?
Signal = notification “sent” to a process
– To asynchronously notify it that some event occurred
• Upon receiving a signal
– The process stops whatever it is doing & handles it
• Default signal handling action
– Either die or ignore (depends on the type of the signal)
What does the kill -s n pid utility does?
sends signal number n to process pid.
What 2 signals the process can’t ignore?
– SIGKILL = terminate the receiving process
– SIGSTOP = suspend the receiving process
Explain the difference between signal and interrupt by following criteria:
How is blocking signals implemented?
– The PCB maintains a set of currently blocked signals
– Which can be manipulated by users via the following syscall
• int sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
– ‘how’ = SIG_BLOCK (+=), SIG_UNBLOCK (-=), SIG_SETMASK (=)
– ‘set’ can be maipulated with sigset ops sigetmptyset(sigset_t *set),
sigfillset(sigset_t *), sigaddset(sigset_t *set, int signum),
sigismember(sigset_t *set, int signum)