Lecture 05 Flashcards
What is a ‘signal’?
A mechanism to notify a process that a particular event has occurred.
A signal is:
A - Synchronous
B - Asynchronous
B - Asynchronous
What does a software interrupt cause?
An immediate jump to handler code.
What happens after an interrupt handler finishes?
Execution resumes at the original point.
Are functions async-signal-safe?
No
A signal is identified using what?
A unique integer value.
What are four default actions that a program may take when it encounters a signal?
- Terminate
- Terminate and dump memory contents into a ‘core’ file
- Stop
- Ignore
What function is used to send a signal to the current process?
raise
What is the function prototype for the ‘raise’ function?
int raise(int sig);
What function is used to send a signal to another process?
kill
What is the function prototype for the ‘kill’ function?
int kill(pid_t pid, int sig);
What signal is sent when you press Ctrl-C on a process?
SIGINT (interrupt)
What signal is sent when you press Ctrl-Z on a process?
SIGTSTP (Stop that can be handled)
What signal stops a process without giving it a chance to handle it?
SIGSTOP
What function is used to register a signal handler?
signal