Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this program is in C Communicate Using Basic Buffer (No IPC Mechanisms) Write an application that simulates a simple production and consumption of data

\

image text in transcribed

this program is in C

Communicate Using Basic Buffer (No IPC Mechanisms) Write an application that simulates a simple production and consumption of data items presented as random numbers (refer to the slides 12, 13 and 14 in "Ch 03_b Communication Between Processes.pdf" file) 4. The program should - Create a buffer of a fixed size (MAX_BUFF_SIZE) Maintain 2 records: In: where to write the next item to Out: where to read the next item from -The program should read a user input: " P: program should produce an item only if the buffer is not full. Buffer is full when (In+1) % MAX BUF SIZE -Out "C: program should not read from the buffer if it is empty (i.e. In - Out) Any other inputs force the program to quit. Run your program with a buffer size of 8. Your program should print the buffer showing the items in the buffer and the location of the In (bottom ) and Out (top ) markers as shown in the figure below uffer is empty: our input: p was added at location our input: p was added at location 1 our input: p was added at location 2 our input: p was added at location 3 our input: c at location was consumed 18 19 15 19191910 I our input: c at location 1 was consumed 18 19 15 our input: c at location 2 was consumed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions