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
How to create a delete button in Python?
deff fn [24]

Answer:

class Db_test(models.Model):

   name = models.CharField(max_length=50)

   comment = models.CharField(max_length=200)

   created = models.DateField(auto_now_add=True)

   modified = models.DateField(auto_now=True)

   class Meta:

       db_table = "db_test"

Explanation:

5 0
3 years ago
__________ locks can be changed after they are put in service, allowing for combination or key changes without a locksmith and e
Vladimir79 [104]

Answer:

Programmable.

Explanation:

Programmable locks can be changed after they are put in service, allowing for combination or key changes without a locksmith and even allowing the owner to change to another access method (key or combination) to upgrade security. This type of lock are operated using a programmable plastic card and are typically smart.

5 0
3 years ago
When you assign a value of one data type to a variable of another data type, Visual Basic attempts to perform ________ type conv
sweet [91]

Answer: implicit

Explanation:

When a value of one data type is assigned to a variable of another data type, then Visual Basic attempts to perform an implicit type conversion.

Implicit type conversion, simply refers to when one data type is converted automatically by Python to another data type. It should be noted that no user involvement is needed.

6 0
3 years ago
Which option best describes top-down design?
MrRissso [65]
A.Breaking fine à large tas kongo anallergique partis
5 0
1 year ago
What controls a computer's basic operations?
S_A_V [24]
 Basic Computer Operations. Input: Information and programs are entered into the computer through Input devices such as the keyboard, disks, or through other computers via network connections or modems connected to the Internet. The input device also retrieves information off disks.
3 0
4 years ago
Other questions:
  • SP 800-14, Generally Accepted Principles and Practices for Securing Information Technology Systems, provides best practices and
    9·2 answers
  • What is profession explain with example​
    13·2 answers
  • Video Fundamentals
    6·1 answer
  • What food does swiss eat on christmas?
    10·1 answer
  • Please help me I don’t know what to do
    13·2 answers
  • A coffee shop is considering accepting orders and payments through their phone app and have decided to use public key encryption
    10·1 answer
  • If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
    14·2 answers
  • Universal Container wants to understand all of the configuration changes that have been made over the last 6 months. Which tool
    15·1 answer
  • What is the answer for this
    9·1 answer
  • Give five example of a dedicated device ​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!