[net.unix] Sys V IPC

dre@ptsfa.UUCP (Doug East) (02/28/85)

Does anyone know of some literature, books, manuals (except
the Programmers Manual), or otherwise concerning how to use
IPC (messages, semaphores, pipes) on System V?

The Programmer's Reference Manual is not too clear on how to
effectively use this facility so any help would be appreciated.

Thanks in advance,

Doug East
..!dual!ptsfa!dre

hbb@hou5a.UUCP (H.B.Braude) (03/04/85)

With the 3B2/300 computer, the IPC option comes with a very good document
on how it is used. The document Select Code is 305-444 and the COMCODE is
403778467 (taken from the first page of the document.)

Ask your sales rep.
-- 
Harlan B. Braude
{most "backbone" sites}!hou5a!hbb

hope@gatech.CSNET (Theodore Hope) (02/08/86)

I have been reading the documentation for the Sys V IPC stuff (msg, shm)
and it is not exactly crystal-clear (no kidding!)  Could anyone please provide
me (and the net community) with one or several examples of message-passing
between cooperating processes?

Thanks in advance.
-- 
Theodore Hope
School of Information & Computer Science, Georgia Tech, Atlanta GA 30332
CSNet:	hope@gatech		ARPA:	Hope%GATech.CSNet @ CSNet-Relay.ARPA
uucp:	...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-sally}!gatech!hope

ijk@hropus.UUCP (Ihor J. Kinal) (02/11/86)

I've found Chapter 7 of Marc J. Rochkind's text to be EXCELLENT
and UNDERSTANDABLE on this subject (and the rest of the book is 
darn good as well). Cost is about $30.

  Once you read that, then try 
AT&T 3B2 Computer UNIX(TM) System V Utilities- Volume 2 (305-506 Issue 1)
{These came with our 3b2-400; I'm not sure on how to obtain this
volume separately, nor its cost.}  This goes into everything at quite
gory detail, which is more or less understandable after reading Rochkind.

Ihor Kinal
ihnp4!houxm!hropus!ijk

P.S.  Just because I'm a contractor at Bell Labs, don't assume I
	speak for anyone, or even understand IPC after reading the above.
	I just believe that I'm now less confusd,er confuseed, er #@$@#%$%$%^..

latham@bsdpkh.UUCP (Ken Latham) (02/11/86)

> I have been reading the documentation for the Sys V IPC stuff (msg, shm)
> and it is not exactly crystal-clear (no kidding!).....

... opaque is the word .....

> .......  Could anyone please provide
> me (and the net community) with one or several examples of message-passing
> between cooperating processes?
> 

	You would be better off to obtain a copy of the IPC manual that comes
with SYSVR2.  It contains several examples utilizing EVERY call, and gives very
lucid descriptions of how they are used.   A posting to the net ( usually from
 unqualified sources :-> ) would only tend to make IPC more unclear.

> Thanks in advance.

	Your welcome!



  Concerning those who have a great deal of experience:

		" There are those who have many experiences...
		  and those who have a few experiences many times."
_______________________________________________________________________________
|                             |                                               |
|     Ken Latham              |     uucp: ihnp4!bsdpkh!latham                 |
|     AT&T-IS (via AGS Inc.)  |     uucp: {ihnp4!decvax,peora}!ucf-cs!latham  |
|     Orlando , FL            |     arpa: latham.ucf-cs@csnet-relay           |
|     USA                     |     csnet:latham@ucf                          |
|_____________________________|_______________________________________________|
-- 

  Concerning those who have a great deal of experience:

		" There are those who have many experiences...
		  and those who have one experience many times."
_______________________________________________________________________________
|                             |                                               |
|        Ken Latham           |     uucp: ihnp4!bsdpkh!latham                 |
|        AT&T-IS              |     uucp: {ihnp4!decvax,peora}!ucf-cs!latham  |
|        Orlando , FL         |     arpa: latham.ucf-cs@csnet-relay           |
|        USA                  |     csnet:latham@ucf                          |
|_____________________________|_______________________________________________|

andy@coma.UUCP (02/13/86)

> I have been reading the documentation for the Sys V IPC stuff (msg, shm)
> and it is not exactly crystal-clear (no kidding!)  Could anyone please provide
> me (and the net community) with one or several examples of message-passing
> between cooperating processes?

Indeed, the documentation of the Sys V IPC-package is not very
instructive.

It took me quite a time of reading and reading and reading the 
documentation and examining the Source-Code to understand how
it works. 

After a while I had my first success in managing semaphores --
it really works.

	- First you have to get an ipc-key with	"ftok".
	  "Ftok" takes as arguments a filename of an existing
	  file and a single letter and returns always the
	  same key if it gets the same arguments.

	- For creating a set of semaphores or a message queue
	  you have to use [sem|msg|shm]get with the flag 
	  IPC_CREATE.

	- Next, very important, you have to set the access-permissions
	  with [sem|msg|shm]ctl. See UPM (2), which structs
	  the ctl-calls expect as arguments.

	- If you have done this, you can use the [sem|msg|shm]op
	  calls and they will work.

	Note, that the steps 2 and 3 have to be done just once
	for each set of semaphores, message queue or segment of 
	shared memory. 
	For subsequent accesses you need a ...get call (to get
	the ipcID) instaed.

Up to now I made tests only with semaphores and message queues.
Semaphores work nearly correct. "Nearly" means, that they are
first in - last out !!!!!
I few days ago I made my first experiences with message queues
and I had some difficulties with long messages (loss of data).
Perhaps that was my mistake, messages that contain just a single
character arrive correctly.

					Good luck,
						   Andy

   Andreas Lampen 	 	\\	UUCP:	mcvax!unido!tub!coma!andy
   Techn. Univ. Berlin		 \\	 BITNET(EARN):	  lampen@db0tui11
   				  \\      Tel:		  +49-30-31473496
				   \\
			 	    Berlin, the city that never sleeps !!
			
		

gwyn@brl-smoke.ARPA (Doug Gwyn ) (02/20/86)

In article <900002@coma.UUCP> andy@coma.UUCP writes:
>I few days ago I made my first experiences with message queues
>and I had some difficulties with long messages (loss of data).
>Perhaps that was my mistake, messages that contain just a single
>character arrive correctly.

Be warned that someone discovered a horrible bug,
such that messages were stacked (LIFO) rather than
queued (FIFO).  I don't know what releases have
this problem, but watch out.