A data structure call the gold pile and d gold-diggers

Assignment Help Operating System
Reference no: EM13166784

Consider a computer game that is played as follows. You have G gold-makers each of which at random times produce one unit of gold and adds it to a data structure call the goldpile and D gold-diggers each of which can grab one unit of gold from the goldpile. The amount of gold that can be produced and available for digging can be arbitrarily large. Consider the following functions to be used in goldworld. Does it work correctly if run with multiple diggers and makers? Explain why or why not? If not, identify as many issues as you can. Focus on issues of how mutual exclusion is handled.

semaphore Y=1;
semaphore X=0;

void goldmaker()
{
while (true)
{
Wait a random amount of time.
Make one unit of gold.
semWait(Y);
Add the unit of gold to the goldpile;
semSignal(X);
semSignal(Y);
}
}

void golddigger()
{

While (true)
{
semWait(Y);
semWait(X);
take one unit of gold off the goldpile;
semSignal(X);
}
}

 

 

Reference no: EM13166784

Questions Cloud

Three-process 4 resource system : Give an example of a three-process 4 resource system that is in an unsafe state. Explain why it is in an unsafe state. How many more resources would need to be added to make it a safe state?
Define equation for your preparation of acetyl chloride : Write an equation for your preparation of acetyl chloride
State a silver strip was dipped into the test solution : A test solution contained 2 mL of 0.10 M Ag+. A silver strip was dipped into the test solution, and a cell potential of 0.0592 V was measured against an Ag/Ag+(1.0M) reference half-cell.
Which buffer component must be added and what quantity : A buffer solution is prepared by dissolving 1.50g each of benzioc acid C6H5CO2H and sodium benzoate NaC6H5CO2 in 150.0mL of solution.
A data structure call the gold pile and d gold-diggers : Consider a computer game that is played as follows. You have G gold-makers each of which at random times produce one unit of gold and adds it to a data structure call the goldpile and D gold-diggers each of which can grab one unit of gold from the go..
Evaluate the comment by the accountant of har : Evaluate the comment by the accountant of HAR in respect of the deductibility of expenses and outgoings under Hong Kong salaries tax and profits tax.
Explain what is the enthalpy of combustion of fuel : What is the enthalpy of combustion of this fuel in kJ/mol? The specific heat capacity of water is 4.184 J/g-°C.
If the sum or product of two positive integers : In C++, the largest int value is 2147483647. So, an integer larger than this cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than 2147483647, the result will be incorrect.
Propose a mechanism for the acid-catalyzed synthesis : Propose a mechanism for the acid-catalyzed synthesis of 4,5-dimethyldioxolane + water from formaldehyde

Reviews

Write a Review

Operating System Questions & Answers

  Explain an ip address

Explain an IP address. Explain Class A, B, and C networks. Are a MAC address and an IP address the similar thing?

  Multiple choice - system analysis and design

The primary benefits of the Waterfall Development methodology is needs are completely specified and held relatively constant prior to programming.

  Steps add to the check list

According to your personal experience, what steps would you add to the check list and determine what steps would you leave out?

  Assume a gpu architecture that contains 10 simd

Assume a GPU architecture that contains 10 SIMD processors. Each SIMD instruction has a width of 32 and each SIMD processor contains 8 lanes for single-precision arithmetic and load/store instructions, meaning that each non- diverged SIMD instruct..

  Friendly computer program

Consider of any computer related item that you felt was not user friendly to you? Did you feel reluctant to continue using it.

  Organization institutionalizes policies

The answer gives the learner with an understanding of management's role in the development and enforcement of data security policies, standards, practices, precess and guidelines.

  Potential security threats to managing information

Suppose that you have been asked to consult for a corporation that has branch offices in four continents. You have implemented a management data system that will enable its managers to exchange information.

  Solving a shell script issue

Determine when a script having these invisible characters are interpreted by linux or *nix shells, they are flagged as errors, since *nix uses 'n' as new lines.

  You have poisson arrivals into your system

You have Poisson arrivals into your system with ?= 5 packets/second. The slot length is 1 second. Your current estimate for n^ is 20 (for the k-th time slot iteration).

  Find the sizes of the tag, block and word fields

Assume that a computer using direct mapped cache has 2^24 words of main memory and a cache of sixty-four blocks, where each cache block contains sixteen words.

  Procedure to manually remove the existing power supply

Explain the procedure necessary to properly install or replace the computer power supply in a computer.

  Mobile ip is emerging

Mobile IP is emerging as the next industry standard for the way in which wireless devices move from one network to another.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd