OK, here's an example: http://www.cs.cf.ac.uk/Dave/C/node25.html
that might help.
Essentially what you need to do is write a daemon (or a program that allocates message queues and runs in background). Then you write an additional program that is used by individual users (doesn't matter how many users) to post and receive messages from the queues. That's the basic idea -- one "supervisor" program, one or more instances of "user" program interacting with the supervisor.
Think data base management system (DBMS). A DBMS is started, it allocates shared memory, semaphores and, possibly, message queues. Individual users or processes execute queries against the tables in the data base and, to prevent more than one process updating a table at the same time, the DBMS uses semaphores and (potentially) message queues to avoid deadlock (more than one process updating simultaneously).
Use the example above to fiddle with message queues and see how they work then build on that to do what you're trying to accomplish.
Ought to get your started.
Hope this helps some.