- SIGTERM: A Unix signal providing a mechanism for notifying of system events.
- Two different types of SIGTERMs
- Asynchronous: Generated by events outside the control of the process that receives them, and arrive at unpredictable times such as user input Ctrl+C
- Synchronous: Generated by exceptions, or errors, which are caused by invalid operations in a program such as dividing by zero.
- Two different types of SIGTERMs
- POSIX standard specifies 20 signals 2 of which are user definable
Reciveing Sigterms
- When receiving a asynchronous SIGTERM the processor can 1. ignore or 2. executed specified procedure
- If unspecified there are 5 default procedures which may happen
- Terminate process
- Write execution context and contents of the address space to a file (called core dump) and terminate
- Ignore
- Suspend process
- Resume the process’s execution if it was previously stopped
- If unspecified there are 5 default procedures which may happen
IPC Resources: Semaphores, message queues, and shared memory
- Kernel implements these as IPC resources and a process can declare these data structures with function calls which
- Return System V data structure identifiers specific to the function eg. semget() returns a semaphore set identifier
shmget(), semget(), msgget()
- Return System V data structure identifiers specific to the function eg. semget() returns a semaphore set identifier
- These data structures stick around like file descriptors and must be deallocated. For example semaphores will be deallocated with
sem_destroy()
which returns 0 on success and -1 otherwise.
- Message Queue: Allow processes to exchange messages with the following functions
msgsnd() and msgrcv()
- Note POSIX has its own standard which is simpler file based interface vs Sys V
- Shared Memory: Allocated memory from
shmget()
which returns a memory segment identifier if suceess.
- For any process to access shared memory it must invoke
shmat()
which attaches the System V shared memory segment identified by shmid to the address space of the calling process. And once finished detaches by using
shmdt()
- For any process to access shared memory it must invoke