Question: Please read thoroughly. I will review and vote instantly! Language: C required WITH comments Using POSIX message queues (mq_overview), play hot potato between six processes
Please read thoroughly. I will review and vote instantly!
Language: C required WITH comments
Using POSIX message queues (mq_overview), play "hot potato" between six processes (you can use fork()). The original process sends out a message once it has generated five child processes. Each process, excluding the original, attempts to grab the message before again posts it on the message queue. Count the number of messages received by each process and declare the first process to receive one thousand (1,000) messages as the loser. That process is no longer allowed to send and receive messages. Continue with the remaining processes until only one process remains in the game. That final process is the winner. Report the number of messages received by each process during each round. Provide a discussion about why each process received the number of messages received.
Use getpid() to ensure that each process has a unique identifier for its output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
