0

I've done some research about this topic but I didn't understand it quite well.

From msgsnd man page :

The msgsnd() system call appends a copy of the message pointed to by msgp to the message queue whose identifier is specified by msqid.

Does this mean that when i use a msgget to create a message queue the Enqueue and Dequeue happens automatically with msgsnd and msgrcv?

For example, if I want to use a message queue that can simultaneously hold N messages, when i use msgsnd i put a message to the queue and when i use msg rcv i get it from here and delete that message?

If that's the case i shouldn't implement manually enqueue and dequeue to create a list of N messages because it's enough to set a value to const void *msgp from int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); to add one more message in the queue and it is enough that this is received by msgrcv to be deleted from the queue otherwise it remains in the queue until it is received by some process, am i correct?

But then how much messages this queue can contain if i'm not the one setting how many can be contained?

1 Answer 1

1

According to man2(msgrcv) enqueue/dequeue operations are handled internally by systemV API. so you don't need to re-implement them just use the provided API.

For message queue attributes use msgctl with IPC_INFO command.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.