Computer Science, asked by akashsingh0789, 5 months ago

The C code has been constructed such that producer.c will fork() a child process and execute your consumer code via exec(). This code has been provided for you.

The producer.c code also starts multiple producer threads. This is lighter weight than forking multiple producer processes. It also allows you to use the pthreads libraries.

The producer pthreads and the consumer process implement a bounded buffer on top of the POSIX shared memory.

Each producer pthread needs to be modified to “send” a message by first reading it from the file input.txt, placing it in the shared memory buffer, and updating the buffer input pointer.

The consumer needs to be modified to “receive” a message by reading it from shared memory and updating the buffer output pointer. The message is then written to the output file raw_output.txt via fprintf() so there’s a record of the consumed order of messages.

How to send and receive messages in shared memory as described above?

Answers

Answered by bhau1098
0

Answer:

uayahc. kdm dk . I e2eebqsuvwq

Similar questions