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, 04.07.2019 18:10
The mass flow rate of the fluid remains constant in all steady flow process. a)- true b)- false
Answers: 1
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
question
Engineering, 04.07.2019 18:10
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 18:10
Awall of 0.5m thickness is to be constructed from a material which has average thermal conductivity of 1.4 w/mk. the wall is to be insulated with a material having an average thermal conductivity of 0.35 w/mk so that heat loss per square meter shall not exceed 1450 w. assume inner wall surface temperature of 1200°c and outer surface temperature of the insulation to be 15°c. calculate the thickness of insulation required.
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, 25.06.2019 18:30
question
Mathematics, 25.06.2019 18:30
question
English, 25.06.2019 18:30
Questions on the website: 13722361