subject

Consider a Producer-Consumer problem where M Producer threads run simultaneously to fill up a buffer. Then, exactly N Consumer threads will run simultaneously to take all the data out from the buffer. An example of such scenario is a file is striped into M different site. A downloader program starts M producer threads to get these chunks independently. Once M download threads (from a pool of threads) finish producing the items, the N Consumer threads simultaneously scan the data in their own way. Again, note that N out of many possible consumers succeed. Therefore, you cannot assume that only M producers and N consumers are presents. Look at the given program 1PNC. cpp that works for 1 Producer and N Consumer threads. Be sure to run the program first to see how it behaves. You need to extend the program such that it works for all M producers instead of just 1.Add necessary semaphores to the program. However, you will lose points if you add unnecessary Semaphore. To keep things simple, declare the mutexes as semaphores as well. Then test your program to make sure that it is correct. In your submission directory, include a file called Q5.cpp that contains the correct program.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:30
Apower user needs you to install a second type of operating system on his computer to increase efficiency while running some specialized software programs. which installation technique should you use?
Answers: 3
question
Computers and Technology, 24.06.2019 09:50
Self contained sequences of actions to be performed are? a. expressions b. algorithms c. functions d. formulas
Answers: 1
question
Computers and Technology, 24.06.2019 11:30
Convert 11001110(acdd notation) into decimal
Answers: 2
question
Computers and Technology, 24.06.2019 14:30
Two students are discussing electricity that has a frequency of 60 hz. student a says that this type of electricity is referred to as ac. student b says that in this type of electricity, the electrons flow in only one direction. which of the following statements is correct? a. only student a is correct b. only student b is correct c. both of the two students are correct d. neither of the two students is correct
Answers: 1
You know the right answer?
Consider a Producer-Consumer problem where M Producer threads run simultaneously to fill up a buffer...
Questions
question
English, 20.09.2021 04:50
question
Mathematics, 20.09.2021 04:50
question
English, 20.09.2021 04:50
question
Social Studies, 20.09.2021 04:50
Questions on the website: 13722363