Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Create a producer process and a consumer process sharing data. The producer generates total 100 integer data randomly, and the consumer process reads...

  • Create a producer process and a consumer process sharing data. The producer generates total 100 integer data randomly, and the consumer process reads all the data. The data generated by the producer could be stored in a file by the producer; and the data consumed (i.e., read) by the consumer could be stored in another file by the consumer.
  •        The file of produced data and the file of consumed data could be printed to verity that the two processes have cooperated correctly; that means, each data item is not lost and not consumed more than once.
  •        Inter-process communication between producer and consumer (to share the data) can be implemented using any two of the following four methods:
  • Use a Pipe to transfer 100 data from the producer to the consumer.
  • Use either the direct message passing or indirect message passing (using a

mailbox or a message queue) to transfer 100 data from the producer to the consumer.

  • Use the sockets to transfer 100 data from the producer to the consumer.
  • Note: The producer and consumer processes can be executed on the same machine (or on different machines). A reference for socket programing is posted on the Pilot.
  • Use the shared memory and semaphores for the implementation of the logical

ring-buffer (that can store up to 10 data items) and the synchronization.

  • Programming Languages and Operating Systems:
  •        Any programming languages can be used for each implementation on any machine running any Operating Systems.
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question