Describe how to use sanction such that a process can send a
Solution
The kernel maintains two bit-vectors for every process
• Every type of signal has a specific bit in this bit-vector
• pending bit-vector records what signals have yet to be
delivered to the process
• Note: if multiple instances of a given signal occur before a process
receives the signal, it will see only one instance of the signal
• Signals indicate one or more events of given type have occurred
• blocked bit-vector records what signals are currently not
allowed to be delivered to the process
• Can have a signal that is both blocked and pending
• When the signal is unblocked, it will be delivered to the process
• When a signal is delivered to a process, that type of signal
is automatically blocked for the process
• Prevents a given signal handler from interrupting itself
• One kind of signal can interrupt another kind of signa
A process isn’t always running when a signal is sent to it
• e.g. kill() syscall is invoked by another process
• e.g. a child process dies, causing SIGCHLD to be sent to parent,
but a higher priority process currently preempts the parent
• Kernels make a distinction between generating a signal
and delivering the signal
Already mentioned pending / blocked signal bit-vectors
• At a coarse-grain level of detail, records which signals need to be
delivered, and which signals are currently blocked from delivery
• Each process also has a linked list of pending signals
• siginfo_t struct records relevant details of the pending signal
• Each process also has an array of “signal action” structs
• Specifies how to handle each kind of signal
• e.g. “default action,” “ignore,”
or a user-space handler
• (Flags also record other
options for handling signals
When a signal is sent to a process:
• The kernel invokes a specific function to update the process’ signal
structures, perform scheduling tasks, etc.
• e.g. Linux 2.6 has specific_send_sig_info() kernel function
• If the process already has a pending signal of that type,
the new signal is ignored
• For real-time signals, this test is skipped
• Every occurrence of a real-time signal is delivered
• If the process is ignoring
the signal, nothing is done
• No structures are updated
• No scheduling tasks oc
