1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
TiliK225 [7]
3 years ago
13

5.14 Describe how the compare and swap() instruction can be used to provide mutual exclusion that satisfies the bounded-waiting

requirement. (15 pts)
Computers and Technology
1 answer:
Naddik [55]3 years ago
8 0

Answer:

Explained below

Explanation:

Compare and Swap(C&S) is simply an atomic operation whereby the compare and swap operations are automatically executed.

Now compare and Swap basically needs 3 arguments namely:

- 2 old values which we will label X and Y

- 1 new value which is written in X that we will call Z

Thus, we now have; C & S = {X, Y, Z}

To explain this well, let X be a variable where X has a value of 7.

Now, if a programmer gives a program me that X be multiplied by 2,then what C&S operation will do is;

I) Y = X where Y is a new variable.

II) Result = C&S(X, Y, X*7)

Variable X is global and this means that mere than one process and more than 1 thread can see the variable X.

Now, if a process named P1 wants multiply the variable X by 7 using C&S operation, it will first make a local copy of variable X (which in this case is now the new variable Y). After that it will atomically compare X & Y and if they are equal, it will replace X with 10X.

However, if they are not equal, P1 will re-read value of X into Y and carry of C&S instruction again.

You might be interested in
Two types of are desktop computers and notebook computer
aalyn [17]

Explanation:

A. personal computer

wait others answer for sure

4 0
3 years ago
Read 2 more answers
Which of the following is the most abstract?
marysya [2.9K]

D. The word "food" is the most abstract because it is the least specific and does not specify what food it is exactly.

Hope this helps!! :)

4 0
3 years ago
Read 2 more answers
: how can you reduce file size so that files can be sent more efficiently across the internet
Rina8888 [55]
You can compress them. ZIP is the most well known protocol.
8 0
3 years ago
1.which screen appears after the password is typed (welcome, lock)​
jenyasd209 [6]

Answer:

it should be the welcome screen I will hope so lol

4 0
2 years ago
Read 2 more answers
The windows troubleshooting utility that identifies and eliminates nonessential files is called _____.
Virty [35]
I think it is Defragment
8 0
3 years ago
Read 2 more answers
Other questions:
  • Why do many administrators choose to use a command line interface on a Linux server?
    12·1 answer
  • Which type of financial institution typically has membership requirements?
    14·1 answer
  • 27. If X and Y are int type variables,
    14·1 answer
  • What is the meaning of photography​
    5·2 answers
  • Hi um... i just wanna say hi :P
    6·2 answers
  • A non-profit organization decides to use an accounting software solution designed for non-profits. The solution is hosted on a c
    11·1 answer
  • What is connected to the base unit in Desktop PC?
    14·1 answer
  • CreatePolicies<br> I need help with this in java.
    8·1 answer
  • Which digital cellular standard is used widely throughout the world except the united states?
    6·1 answer
  • There is overlap in the subjects of study in the different information technology disciplines.
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!