Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ code, Pthreads, Semaphore: I currently can get numbers to generate randomaly and to get the server threads to sleep. Now I need to get
C++ code, Pthreads, Semaphore:
I currently can get numbers to generate randomaly and to get the server threads to sleep.
Now I need to get the data generators to take turns with the server threads using semaphores. After each number is put into an array it need to switch over to the server threads and let them sleep a random time befor control returns to the data generators.
Data-Center Simulation use POSIX threads and semaphores create a system to simulate a data center. The following rules apply: 1) 5 data-generator threads are created in the main thread at the start of simulation. Each data-generator thread has a unique index ranging from 1 to 5. Each data-generator thread generates 10 random numbers (no duplicate numbers) with the following requirement: a) b) c) d) e) The random numbers generated by data-generator thread 1 are ranging from 100 to 199. The random numbers generated by data-generator thread 2 are ranging from 200 to 299 The random numbers generated by data-generator thread 3 are ranging from 300 to 399. The random numbers generated by data-generator thread 4 are ranging from 400 to 499 The random numbers generated by data-generator thread 5 are ranging from 500 to 599 Data-Center Simulation use POSIX threads and semaphores create a system to simulate a data center. The following rules apply: 1) 5 data-generator threads are created in the main thread at the start of simulation. Each data-generator thread has a unique index ranging from 1 to 5. Each data-generator thread generates 10 random numbers (no duplicate numbers) with the following requirement: a) b) c) d) e) The random numbers generated by data-generator thread 1 are ranging from 100 to 199. The random numbers generated by data-generator thread 2 are ranging from 200 to 299 The random numbers generated by data-generator thread 3 are ranging from 300 to 399. The random numbers generated by data-generator thread 4 are ranging from 400 to 499 The random numbers generated by data-generator thread 5 are ranging from 500 to 599
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started