Operating System/System Programming(Arif Butt)

Lec24) Overview Of UNIX IPC And Signals On The Shell

Tony Lim 2021. 7. 16. 12:58

Inter Process Communciation (IPC)

Process Persistence

  • Exists as long as it is held open by a process
  • Pipes and FIFOs
  • TCP, UDP sockets
  • Mutex , condition variables , read write locks
  • POSIX memroy based semaphores

Kernel Persistence

  • Exists until kernel reboots or IPC objects is explicitly deleted
  • Message Queues , semaphores & shared memory are at least kernel persistent

File system Persistence

  • Exists until IPC objects is explicitly deleted , or file system crashes
  • Message queues, semaphores & shared memory can be file system persistent if implemented using mapped files

 

 

Signals

signals are usually used by OS to notify process that some event has occurred , without these processes needing to poll for the event.

whenever a process receives a signal , it is interrupted from whatever it is doing and forced to execute a piece of code called signal hander. when signal handler function returns, the process continues execution as if this interruption has never occurred.

signal handler is a function that gets called when a process receives a singal. it is called in asynchronous mode. 

 

Synchronous signals

pertains to a specific action in the program and is delivered (unless blocked) during that action.

  • most errors generate singals synchronously 
  • Explicit request by a process to generate a signal for the same process

Asynchronous signals

gnerated by the event outside the control of the process that receives them. Theses signals arrive at unpredictable times during execution. 

  • External events generate requests asynchronously
  • Explict request by a process to generate a signal for some other process

 

 

we can make signal handler with trap built in command.