"Are you the Key Master?" What about this key nonsense? How do we create one? Well, since the type key_t is actually just a long, you can use any number you want. But what if you hard-code the number and some other unrelated program hardcodes the same number but wants another queue? The solution is to use the ftok() function which generates a key from two arguments: key_t ftok(const char *path, int id); Ok, this is getting weird. Basically, path just has to be a file that this process can read. The other argument, id is usually just set to some arbitrary char, like 'A'. The ftok() function uses information about the named file (like inode number, etc.) and the id to generate a probably-unique key for msgget(). Programs that want to use the same queue must generate the same key, so they must pass the same parameters to ftok(). Finally, it's time to make the call: #include key = ftok("/home/beej/somefile", 'b'); msqid = msgget(key, 0666 | IPC_CREAT); In the above example, I set the permissions on the queue to 666 (or rw-rw-rw-, if that makes more sense to you). And now we have msqid which will be used to send and receive messages from the queue.