![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58 | fishsponge | Red Hat | 5 | 07-14-2006 03:53 PM |
| check the status and send an email with status | isingh786 | Shell Programming and Scripting | 3 | 12-29-2005 07:22 PM |
| Pipe, interprocess communication | scmay | UNIX for Advanced & Expert Users | 2 | 10-23-2004 09:41 AM |
| Interprocess communication using pipes and fork | scmay | UNIX for Advanced & Expert Users | 2 | 10-14-2004 10:44 PM |
| Couldn't open status file /var/samba/STATUS.LCK | macdonto | UNIX for Dummies Questions & Answers | 2 | 08-08-2001 09:42 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Interprocess communication status
hello gurus,
I was wondering if someone would help me shed more light on this command. What I know so far is ipcs - stands for inter-process communication status and it reports on the following types of system resources. 1) Message queues 2) Shared memory and 3) Semaphores Please explain in some detail what these types of resources mean. Thanks |
|
|||||
|
Let us start at the beginning. In unix, if you want more than one process to access some information what do you do? You could open a file and read/write to and from it everytime, but this would be most inefficient, considering the disk IO that is involved - and imagine the file getting deleted while in use! So you would require some sort of repository in the memory, that can be accessed by any process that has need of it.
Now memory access means that you could just do a malloc and get a pointer that gives you access to memory that is as big as you have requested for (or have been given by the OS). But how does a process tell another process that is not its child what location the pointer is pointing at? So the Creators hit upon a solution. Three different ways of interprocess communication were implemented - message queues, shared memory and semaphores. Each can be used by unrelated processes (they use something called keys to return another value called the id - and one key can map only to one id - so multiple programs working together can use the same key to access the same queue/memory/semaphore). Message queues are like FIFOs; messages sent to a message queue are all appended to the end, but retrieving a message from the queue can be done in different ways - the first message, the first message of a certain type or the first message different from the message of certain type. Check out this page for more details on how to use message queues. Shared memory is obvious, different processes access the shared memory by again mapping the key to an id, and directly read from or write to the memory - this is the fastest you can have processes talking to each other. Check this page for more details on shared memory. Semaphores are the gate keepers, they are used to determine if shared resoures (such as attached shared memory segments) can be read from or written to safely. Programs that are going to be using shared memory segments will also create or obtain existing semaphores. These mark whether a process is currently reading from or writing to a shared memory segment and consequently whether it is safe to carry out any operations on the shared memory now. Check this page for info on semaphores. Hope this helps! Last edited by blowtorch; 07-13-2005 at 10:49 PM.. |
|
||||
|
Thanks for the tips on the types of resources that ipcs. Is there a way in UNIX to determine which process utilize the various IPC resource? the ipcs command only indicates the number of message queues, shared memory segments and semphores that are currently available when the snapshot of the command executed. Please advise. Thanks.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|