Question

In: Computer Science

There are three ways to provide mutual exclusion in a system. Explain how mutual exclusion can...

There are three ways to provide mutual exclusion in a system.

Explain how mutual exclusion can be guaranteed using hardware approach and software approach.

Solutions

Expert Solution

Hi, I would love to answer you with this question, hope you like an asnswer and get a clear idea related to the same. So not wasting much time lets get started.

Three ways to provide mutual exclusion in a system are as follows:

  • pthread mutex locks
  • test and set
  • atomic addition and substraction

Now the approches to achieve mutual exclusion hardware and the sofware are discussed below:

Hardware Approach Software approach
  • This can be achievd through Lock and Unlock technique
  • Locking is done at the entry section
  • Only one process is allowed to enter in the critical section
  • The process is moved to the Exit section after this
  • After this the unlock operation is done to perform the locking for another process
  • Process is designed in a way that the all conditions of the critical sections are satisfied
  • Inside this approach algorithms are used to maintain the sychronisation
  • Deckkers algorithm and the peterson algorithm are one of them
  • Conditionwise processes are executed
  • On true condition this is in busy waiting state
  • Two variables are used in the critical section which are flag and the turn variable
  • Process is designed in a way that the three critical sections are been satidfied

Hope you got an answer

Please like an answer and do comment for any type of queries

Thanks and Happy to help :)

HAPPY LEARNING


Related Solutions

software approach to mutual exclusion
Consider the following program which provides a software approach to mutual exclusion:Integer array control [1: N]; integer kWhere 1 ≤ k ≤ N, and each element of “control” is either 0, 1, Or 2. All elements of “control” are initially zero; the initial valueof k is immaterial.The program of the ith process (1 ≤ i ≤ N) isbegin integer j;L0: control [i] := l;LI: for j:=k step l until N, l step l until k dobeginif j = i then...
mutual exclusion is Lamport’s bakery
A software approach to mutual exclusion is Lamport’s bakery algorithm [LAMP74], so called because it is based on the practice in bakeries and other shops in which every customer receives a numbered ticket on arrival, allowing each to be served in turn. The algorithm is as follows:boolean choosing[n];int number[n];while (true) {choosing[i] = true;number[i] = 1 + getmax(number[], n);choosing[i] = false;for (int j = 0; j < n; j++){while (choosing[j]) { };while ((number[j] != 0) && (number[j],j) < (number[i],i)) { };}/*...
When a special machine instruction is used to provide mutual exclusion in the fashion of Figure 5.2, there is no control over how
When a special machine instruction is used to provide mutual exclusion in the fashion of Figure 5.2, there is no control over how long a process must wait before being granted access to its critical section. Devise an algorithm that uses the compare & swap instruction but that guarantees that any process waiting to enter its critical section will do so within n −1 turns, where n is the number of processes that may require access to the critical section...
Consider the four distributed mutual exclusion algorithms Permission Based ---#1: Centralized Mutual Exclusion ---#2: Decentralized Mutex...
Consider the four distributed mutual exclusion algorithms Permission Based ---#1: Centralized Mutual Exclusion ---#2: Decentralized Mutex Algorithm ---#3: Distributed Mutual Exclusion #4: A Token Ring Algorithm Discuss their relative fault tolerance – basically the effect of processor crashes on the performance of the algorithm. You don’t have to come up with a 1-2-3-4 ordering.
Write a program to simulate the Distributed Mutual Exclusion in ‘C’.
Write a program to simulate the Distributed Mutual Exclusion in ‘C’.
Predict three ways that the normal defense system in the body can fail.
Predict three ways that the normal defense system in the body can fail.
Explain the three most common financial statements and provide an example of how they can be...
Explain the three most common financial statements and provide an example of how they can be used in the hospitality industry
Question Four Explain Peterson’s solution for critical-section problem and show that mutual exclusion is preserved with...
Question Four Explain Peterson’s solution for critical-section problem and show that mutual exclusion is preserved with Peterson’s solution. (Assume there are only two processes P0 and P1)
Explain any THREE (3) ways how a proposal can be revoked as provided in Contracts Act...
Explain any THREE (3) ways how a proposal can be revoked as provided in Contracts Act 1950. (10 mark)
What are the disadvantages of disabling interrupts as a strategy for achieving mutual exclusion?
What are the disadvantages of disabling interrupts as a strategy for achieving mutual exclusion?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT