In today’s modern applications, inter-process communication is widely spread. This report sheds light on shared memory between the producer and the consumer. It is difficult to use shared memory transportation, but this method provides more control and speed. However, there will be behaviour difference in different operating systems, which can be dealt easily. Here, the system refers to message queue, which contains two-way communication channels for the producer and the consumer to exchange messages. The shared memory will be developed here with the help of C language, in the Linux operating system.
The objective of this report is to accomplish six tasks such as, creating and destroying the segment of shared memory, sending one message from the producer to the consumer, sending series of messages from the producer to the consumer, delaying the message sent by the producer, implementing semaphores and Character-based circular buffer. All these objectives will be met in the following sections of the report.
Creating and Destroying the Segment of Shared Memory
Here, the task refers to developing a segment of shared memory for the producer and consumer. We create producer for sending the message and sharing the memory. There is memory space for the producer so that it is possible for the producer to share the memory with the consumer. This segment contains, owner name, bytes, shared memory and status. The program is used to check the remaining memory space of the producer. The producer can easily send the message to the consumer. Once the memory of the producer is checked, the memory will be decreased and it will be shared with the consumer (Ahmad, 2010).
In this report, all the tasks are accomplished. The producer and consumer are able to share memory, then send and receive the messages. For the producer’s message delay key is also created with the help of Nano sleep. Further, for the producer and consumer the semaphore is implemented. At last, the task of creating a circular buffer depending on the character is completed.
Ahmad, A. (2010). Operating system. New Delhi: Knowledge Book Distributors.
Hogan, C. and Epping, D. (2014). Essential Virtual SAN. Upper Saddle River, N.J., VM Ware Press.
Kothari, D., Vasudevan Shriram, K., R M D, S. and V, S. (2016). Linux. London: New Academic Science.
Leva, A., Maggio, M., Papadopoulos, A. and Terraneo, F. (2013). Control-Based Operating System Design. Stevenage: IET.
Rule, D. (2011). How to Cheat at Configuring VmWare ESX Server. Burlington: Elsevier Science.
Singh. (2011). Operating system. [Place of publication not identified]: Global Vision Publishing.