subject
Engineering, 21.02.2020 19:34 ctdavis

In this assignment, you will write producer and consumer programs that communicate through a bounded buffer in shared memory. The code that you will need to write will be based on the code given in class for forking a child process, creating a shared memory block and implementing a bounded buffer accessed by a producer and a consumer. Write your code in the given producer template. c and consumer template. c source files, and then rename them to producer. c and consumer c. Follow the instructions provided in these files Note that the low-level functions for reading from and writing to the shared memory block are already provided to you. Please use the provided functions, do not write your own implementation of an already provided function As you can see in the given producer template. c source file, the producer process is the parent process that creates (forks) a Child process and loads the Consumer executable into it. The consumer executable will be generated by compiling consumer c (after you write the required code in it). After writing all the required code in both consumer. c and producer. c use the following commands to compile the two programs and build the two executables gcc producer c -Int -o producer gcc consumer c -Int -o consumer The producer program (parent) takes the following three command-line arguments (all integers) The size of the bounded buffer (bufSize). This is the number of items that can fit in the bounded buffer. This cannot exceed 2000 2. The number of items to produce/consume (itemCnt). In most test cases, itemCnt will be much larger than bufSize. However, your program must correctly handle test cases in which itemCnt is less than bufSize 3. A seed for the random number generator (randSeed). This will allow us to test the program using different data The producer program creates a shared memory block with a fixed size of 8K (its name is OS HW1 your Name). Make sure you replace string "yourName" with your actual full name so that your work does not interfere with other students' work when you run on a shared server like Athena. The producer then uses this block to communicate with the consumer The block consists of a header followed by the bounded buffer with the given bufsize. The header contains the following four integers in order: 1. buf Size 2. itemCnt 3. in: the index of the next item to be produced 4. out: the index of the next item to be consumed

ansver
Answers: 1

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Apiston-cylinder with a volume of 0.25 m3 holds 1 kg of air (r 0.287 k/kgk) at a temperature of 100 c. heat transfer to the cylinder causes an isothermal expansion of the piston until the volume triples. how much heat is added to the piston-cylinder?
Answers: 3
question
Engineering, 04.07.2019 18:10
Determine whether or not it is possible to compress air adiabatically from k to 140 kpa and 400 k. what is the entropy change during this process?
Answers: 3
question
Engineering, 04.07.2019 18:10
Apipe with an outside diameter of 15 cm is exposed to an ambient air and surrounding temperature of -20°c. the pipe has an outer surface temperature of 65°c and an emissivity of 0.85. if the rate of heat loss from the pipe surface is 0.95 kw per meter of length, the external convective heat transfer coefficient (h) is: (a) 12.5 w/m"k (b) 18.6 w/mk (c) 23.7 w/mk (d) 27.9 w/mk (e) 33.5 w/mk
Answers: 1
question
Engineering, 04.07.2019 18:10
Which of the following refers to refers to how well the control system responds to sudden changes in the system. a)-transient regulation b)- distributed regulation c)-constant regulation d)-steady-state regulation
Answers: 1
You know the right answer?
In this assignment, you will write producer and consumer programs that communicate through a bounded...
Questions
question
Mathematics, 23.10.2019 18:30
Questions on the website: 13722361