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
Ahouse has the following electrical appliance usage (1) single 40w lamp used for 4 hours per day (2) single 60w fan used for 12 hours per day (3) single 200w refrigerator that runs 24 hours per day with compressor run 12 hours and off 12 hours find the solar power inverter size in watt with correction factor of 1.25.
Answers: 1
question
Engineering, 04.07.2019 18:10
Assuming compressible flow of air and that the measurements are done at flagstaff a pitot static tube that gives the difference of total and static pressure measures 0.35 m of mercury. what is the velocity of air? assume the temperature to be 300k. (submit your excel or matlab calculation sheet)
Answers: 1
question
Engineering, 04.07.2019 18:10
Which of the following controllers anticipates the future from the slope of errors over time? a)-proportional b)-on/off c)-integral d)-derivative.
Answers: 2
question
Engineering, 04.07.2019 18:20
Inadequate stores control is not an obstacle to effective work order system. (clo4) a)-true b)-false
Answers: 3
You know the right answer?
In this assignment, you will write producer and consumer programs that communicate through a bounded...
Questions
question
Mathematics, 05.05.2020 06:05
question
Health, 05.05.2020 06:05
question
Mathematics, 05.05.2020 06:05
Questions on the website: 13722363