Question

5. (26pts) Consider the following scenario: Process 0 is responsible for generating a random integer for...

5. (26pts) Consider the following scenario: Process 0 is responsible for generating a random integer for the other processes to use. Each random number can be used by only one process. The random number can be passed to the other processes through an integer. The integer can be considered to be in one of two states. The integer is “empty” if Process 0 has not yet generated a random number or if the random number had been used by a processes. The integer is considered “full” if Process 0 stored a random number in it, and it has not yet been used by a process. Processes 1 - 10 will each use one random number.

Write psudocode for this scenario that uses:

(a) A monitor (b) Messages

Homework Answers

Answer #1
Procedure CheckStatus  {
   Initialize integer x; //used for passing random value from process 0 to other process
   Initialize Process P0;    //used to generate random numbers and to pass these values to other processes
   Integer check;
   P0_random = rand();
   for each value of Pi:
         Pi = P0_random;
         if P0 did not generate any random value (or) Pi has already accepted the given integer:
               check = 'empty';
         else:
               check = 'full';

   end for
}
Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Two containers hold several balls. Once a second, one of the balls is chosen at random...
Two containers hold several balls. Once a second, one of the balls is chosen at random and switched to the other container. After a long time has passed, you record the number of balls in each container every second. In 10,000 s, you find 80 times when all the balls were in one container (either one) and the other container was empty. Part A How many balls are there? Express your answer as an integer. Part B What is the...
Consider a batch manufacturing process in which a machine processes jobs in batches of three units....
Consider a batch manufacturing process in which a machine processes jobs in batches of three units. The process starts only when there are three or more jobs in the buffer in front of the machine. Otherwise, the machine stays idle until the batch is completed. Assume that job interarrival times are uniformly distributed between 2 and 8 hours, and batch service times are uniformly distributed between 5 and 15 hours. Assuming the system is initially empty, simulate the system manually...
. For each of the following questions, say whether the random process is reasonably a binomial...
. For each of the following questions, say whether the random process is reasonably a binomial process or not, and explain your answer. As part of your explanation, you will want to comment on the potential validity of each of things that must be true for a process to be a binomial process. If it is a binomial process, identify n : the number of Bernoulli trials and π the probability of success. (a) A fair die is rolled until...
please post solutions using R Consider a batch manufacturing process in which a machine processes jobs...
please post solutions using R Consider a batch manufacturing process in which a machine processes jobs in batches of three units. The process starts only when there are three or more jobs in the buffer in front of the machine. Otherwise, the machine stays idle until the batch is completed. Assume that job interarrival times are uniformly distributed between 2 and 8 hours, and batch service times are uniformly distributed between 5 and 15 hours. Assuming the system is initially...
Consider a brute force attempt to crack keys for the following scenario. You have in your...
Consider a brute force attempt to crack keys for the following scenario. You have in your possession a wireless emulator the size of a 6” cube (i.e., 6” x 6” x 6”) with a weight of less than 5 pounds which you can take to a parking lot containing 1,000 new cars. Each car has a four-digit wireless door key (between “0000” and “9999” using wireless symbols) as well as a three-digit engine key (between “000” and “999” including the...
Consider the following scenario: An engineering firm is considering switching from a manual to an automated...
Consider the following scenario: An engineering firm is considering switching from a manual to an automated machine for quality control. Under the current process: Manual inspection: Works earn $35/ hour, inspect 7 items per hour and need 16 inspectors total, working 8 hours per shift and 200 shifts a year There is a false negative of 15%, so the company actually pays workers $25/hr and sets aside $10/hr to cover cost of poor quality (considered a regular business expense) Proposed...
This programming task will be a bit different. It will be more like what you would...
This programming task will be a bit different. It will be more like what you would receive if you were a maintenance engineer working in a corporate information systems or technology department. In other words, you will have some prebuilt source code provided for you that you must alter so it will meet the given programming specification.. Build a program from what you have been given as a starting-point. Rename the “starter code”. Do not add any modules; just, use...
Topic: Process Automation Question 1 Read the following scenario. A small hospital in a rural town...
Topic: Process Automation Question 1 Read the following scenario. A small hospital in a rural town was overwhelmed with paperwork, especially since healthcare reform had significantly increased the number of insured patients. This hospital had been using paper records and filing cabinets since its founding and had recently updated its computer system for other reasons, but realised that its handling of manual documents needed to be automated as well. The hospital determined that its key issues included needing the ability...
One way to represent a very large integer (one that won't fit into a variable of...
One way to represent a very large integer (one that won't fit into a variable of type short, int, or even long) is to use an array. The array is of type int, so each element in the array can hold an integer -- we will store just one digit of our number per array element. So if a user entered 2375, it might be stored as -------------------------- | 2 | 3 | 7 | 5 | ... | --------------------------...
Scenario 2: Differences from Dad Fathers transmit many more new mutations than do mothers to their...
Scenario 2: Differences from Dad Fathers transmit many more new mutations than do mothers to their babies at conception. These mutations occur from copying errors during sperm production. A recent study investigated whether the father’s age affects this process; authors used complete genome sequencing on n = 21 father-child pairs to tally the total number of new mutations inherited from each father. Results of the associated regression analysis are shown below: Question 7 (1 point) Suppose a father had a...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT