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
Acompressor receives the shaft work to decrease the pressure of the fluid. a)- true b)- false
Answers: 3
question
Engineering, 04.07.2019 18:10
Different types of steels contain different elements that alter the characteristics of the steel. for each of the following elements, explain what the element does when alloyed with steel.
Answers: 2
question
Engineering, 04.07.2019 18:10
Draw the engineering stress-strain curve for (a) bcc; (b) fcc metals and mark important points.
Answers: 1
question
Engineering, 04.07.2019 18:10
Manometers are good examples of measuring instruments, nowadays they are not as common as before. a)-capacitive probe gauges b)-gravitational gauges deformation ) gauges d)-digital gauges
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, 26.01.2021 02:30
question
Social Studies, 26.01.2021 02:30
question
Mathematics, 26.01.2021 02:30
question
English, 26.01.2021 02:30
question
Mathematics, 26.01.2021 02:30
question
Mathematics, 26.01.2021 02:30
question
Mathematics, 26.01.2021 02:30
question
English, 26.01.2021 02:30
question
English, 26.01.2021 02:30
Questions on the website: 13722361