Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . Read the section that addresses message queues in the lab manual. 2 . Read the manual pages of the following systems calls: #include
Read the section that addresses message queues in the lab manual.
Read the manual pages of the following systems calls:
#include
#include
#include
int msggetkeyt key, int msgflg;
int msgsndint msqid, const void msgp sizet msgsz int msgflg;
ssizet msgrcvint msqid, void msgp sizet msgsz long msgtyp int msgflg;
Experiment
Write two programs and name them send.c and receive.c to send and receive messages from a message queue
respectively. The send program is executed as follows:
send key type data
it writes the text message data into the message queue whose key is key where type is the type of the
written message. The receive function, on the other hand, is executed as follows:
receive key type
it reads a message of type type from the message queue whose key is key if such message exists, and blocks
otherwise. Test your code and show your work to your lab instructor.
Use the following message format:
struct Message
long type;
char data;
Assume you have two processes, a parent and a child. The parent prints the numbers from to while the
child prints the characters from A to E Use a single message queue to synchronize the two processes such that
they produce the following output:
A
B
E
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started