Interprocess Communication Mechanisms - PowerPoint PPT Presentation

About This Presentation
Title:

Interprocess Communication Mechanisms

Description:

Interprocess Communication Mechanisms. IPC. Signals. Pipes. System V IPC. Signals ... 1)SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL. 5) SIGTRAP 6) SIGIOT 7) SIGBUS 8) ... – PowerPoint PPT presentation

Number of Views:1021
Avg rating:3.0/5.0
Slides: 18
Provided by: rcch
Category:

less

Transcript and Presenter's Notes

Title: Interprocess Communication Mechanisms


1
Interprocess Communication Mechanisms
2
IPC
  • Signals
  • Pipes
  • System V IPC

3
Signals
  • Signal asynchronous events to one or more
    processes
  • Oldest IPC method used by UNIX
  • Intel Box
  • 1)SIGHUP 2) SIGINT 3) SIGQUIT 4)
    SIGILL
  • 5) SIGTRAP 6) SIGIOT 7) SIGBUS
    8) SIGFPE 9) SIGKILL 10) SIGUSR1 11)
    SIGSEGV 12) SIGUSR2 13) SIGPIPE 14)
    SIGALR 15)SIGTERM 17) SIGCHLD 18) SIGCONT
    19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22)
    SIGTTOU 23) SIGURG 24) SIGXCPU 25)
    SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28)
    SIGWINCH 29) SIGIO 30) SIGPWR

4
Signal
  • Processes can ignore most of the signals except
    SIGSTOP, SIGKILL
  • A process can choose to block, handle or allow
    kernel to handle it
  • For example, SIGFPE(floating point exception)
    core dump and the exit

5
Linux Signals
  • task_struct
  • Pending signals signal (32 bits)
  • A mask of blocked signal blocked
  • sigaction array address of handling routine or a
    flag to ignore the signal (modified by system
    calls)
  • Normal process can only send signals to processes
    with the same uid and gid or to the processes in
    the same process group

6
Signal Handling
  • Signals are not presented to the process
    immediately they are generated., they must wait
    until the process is running again.
  • Every time a process exits from a system call its
    signal and blocked fields are checked and, if
    there are any unblocked signals, they can now be
    delivered

7
Signal Handling
  • Processes can elect to wait for signals if they
    wish, they are suspended in state Interruptible
    until a signal is presented
  • The Linux signal processing code looks at the
    sigaction structure for each of the current
    unblocked signal

8
Pipe
  • ls pr lpr
  • Linux using two file data structure which point
    at the same temporary VFS inode (points to a
    physical page within memory)
  • use standard read/write library function

9
Pipe
10
Named Pipe
  • FIFO
  • created by mkfifo command

11
System V IPC Mechanism
  • Message queues, semaphores and shared memory
  • UNIX System V in 1983

12
Message Queues
  • Allow one or more processes to write messages,
    which will be read by one or more reading
    processes
  • msgque --gt msqid_ds
  • Linux kernel wait queue

13
Message Queues
14
Semaphores
  • A semaphore is a location in memory whose value
    can be tested and set (atomic) by more than one
    processes
  • Can be used to implement critical regions
  • To prevent deadlock sem_undo data structure

15
Semaphores
16
Shared Memory
  • Allow one or more processes to communicate via
    memory that appears in all of their virtual
    address space
  • shmid_ds data structure

17
Shared Memory
Write a Comment
User Comments (0)
About PowerShow.com