Saturday 14 July 2018

IPCS

The ipcs command can be used to obtain the status of all System V IPC objects. The Linux version of this tool was also authored by Krishna Balasubramanian.



ipcs     -q:    Show only message queues
ipcs     -s:    Show only semaphores
ipcs     -m:    Show only shared memory
ipcs --help:    Additional arguments


  • Shared Memory – Processes can exchange values in the shared memory. One process will create a portion of memory which other process can access.
  • Message Queue – It is a structured and ordered list of memory segments where processes store or retrieve data.
  • Semaphores – Provides a synchronizing mechanism for processes that are accessing the same resource. No data is passed with a semaphore; it simply coordinates access to shared resources.

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0xc616cc44 1056800768 oracle    660        4096       0
0x0103f577 323158020  root      664        966        1
0x0000270f 325713925  root      666        1          2

------ Semaphore Arrays --------
key        semid      owner      perms      nsems
0x0103eefd 0          root      664        1
0x0103eefe 32769      root      664        1
0x4b0d4514 1094844418 oracle    660        204

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages
0x000005a4 32768      root       644        0            0
PIPE: Only two related (eg: parent & child) processess can be communicated. Data reading would be first in first out manner.
Named PIPE or FIFO : Only two processes (can be related or unrelated) can communicate. Data read from FIFO is first in first out manner.
Message Queues: Any number of processes can read/write from/to the queue.  Data can be read selectively. (need not be in FIFO manner)
Shared Memory:  Part of process's memory is shared to other processes. other processes can read or write into this shared memory area based on the permissions. Accessing Shared memory is faster than any other IPC mechanism as this does not involve any kernel level switching(Shared memory resides on user memory area).
Semaphore: Semaphores are used for process synchronisation. This can't be used for bulk data transfer between processes.












No comments:

Post a Comment