50
Avoiding Register Overflow in the Bakery Algorithm Amirhossein Sayyadabdi University of Isfahan [email protected] Mohsen Sharifi University of Science and Technology [email protected] SRMPDS ‘20, Edmonton, AB, Canada

Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Avoiding Register Overflow in the Bakery Algorithm

Amirhossein SayyadabdiUniversity of [email protected]

Mohsen SharifiUniversity of Science and Technology

[email protected]

SRMPDS ‘20, Edmonton, AB, Canada

Page 2: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Agenda

● Background on mutual exclusion and the Bakery algorithm

● Problem statement

● Bakery++

● Performance, practicality and correctness of Bakery++

● Discussion and future work

● Conclusions

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

1 /15

Page 3: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion

Started the field of concurrency.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

1 /15

Page 4: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion

Started the field of concurrency.

Originally proposed and solved by Dijkstra in 1965.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

1 /15

Page 5: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion

Started the field of concurrency.

Originally proposed and solved by Dijkstra in 1965.

A group of independent sequential processes that have access to shared memory.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

1 /15

Page 6: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion

Started the field of concurrency.

Originally proposed and solved by Dijkstra in 1965.

A group of independent sequential processes that have access to shared memory.

Prevent the processes from executing a specific region of code called the “critical section” simultaneously.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

1 /15

Page 7: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion (cont.)

Correctness conditions as specified by Knuth:

1. No two processes are allowed to execute their critical sections simultaneously.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

2 /15

Page 8: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion (cont.)

Correctness conditions as specified by Knuth:

1. No two processes are allowed to execute their critical sections simultaneously.

2. A reliable process should be allowed to enter its critical section eventually.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

2 /15

Page 9: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion (cont.)

Correctness conditions as specified by Knuth:

1. No two processes are allowed to execute their critical sections simultaneously.

2. A reliable process should be allowed to enter its critical section eventually.

3. Crashing of a process should not block others from accessing the critical section.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

2 /15

Page 10: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion (cont.)

Correctness conditions as specified by Knuth:

1. No two processes are allowed to execute their critical sections simultaneously.

2. A reliable process should be allowed to enter its critical section eventually.

3. Crashing of a process should not block others from accessing the critical section.

4. Processes may fail at any time and then restart outside of the critical section.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

2 /15

Page 11: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Mutual Exclusion (cont.)

Correctness conditions as specified by Knuth:

1. No two processes are allowed to execute their critical sections simultaneously.

2. A reliable process should be allowed to enter its critical section eventually.

3. Crashing of a process should not block others from accessing the critical section.

4. Processes may fail at any time and then restart outside of the critical section.

5. No assumptions are made about the execution speeds of processes.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

2 /15

Page 12: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Resource Management

Resource management concerns the coordination and collaboration of users.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

3 /15

Page 13: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Resource Management

Resource management concerns the coordination and collaboration of users.

It is usually based on making a decision.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

3 /15

Page 14: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Resource Management

Resource management concerns the coordination and collaboration of users.

It is usually based on making a decision.

In the case of mutual exclusion, that decision is about granting access to a resource.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

3 /15

Page 15: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Resource Management

Resource management concerns the coordination and collaboration of users.

It is usually based on making a decision.

In the case of mutual exclusion, that decision is about granting access to a resource.

Mutual exclusion is useful for supporting resource access management.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

3 /15

Page 16: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery Algorithm

1. Processes can enter their critical sections in first-come-first-served order.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

4 /15

Page 17: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery Algorithm

1. Processes can enter their critical sections in first-come-first-served order.

2. The failure of individual system components will not cause the entire system to halt.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

4 /15

Page 18: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery Algorithm

1. Processes can enter their critical sections in first-come-first-served order.

2. The failure of individual system components will not cause the entire system to halt.

3. No process writes into the memory of other processes.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

4 /15

Page 19: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery Algorithm

1. Processes can enter their critical sections in first-come-first-served order.

2. The failure of individual system components will not cause the entire system to halt.

3. No process writes into the memory of other processes.

4. If a read and a write occur simultaneously at a memory location, then the value

obtained by the read operation may have any arbitrary value.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

4 /15

Page 20: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

integer array choosing [1..N], number [1..N];

begin integer j;

L1: choosing[i] := 1;

number[i] := 1 + maximum (number[1], … , number[N]);

choosing[i] := 0;

for j = 1 step 1 until N do

begin

L2: if choosing[j] ≠ 0 then goto L2;

L3: if number[j] ≠ 0 and (number[j], j < number[i], i) then goto L3;

end;

critical section; number[i] := 0; noncritical section; goto L1;

end

The Bakery Algorithm (cont.)

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

5 /15

Page 21: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Trouble with Bakery

The Bakery algorithm assumes unbounded registers.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

6 /15

Page 22: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Trouble with Bakery

The Bakery algorithm assumes unbounded registers.

The value of number[i] for process i may tend to infinity!

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

6 /15

Page 23: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Trouble with Bakery

The Bakery algorithm assumes unbounded registers.

The value of number[i] for process i may tend to infinity!

Two competing processes may keep incrementing this value forever:

number[i] := 1 + maximum (number[1], … , number[N]);

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

6 /15

Page 24: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Trouble with Bakery

The Bakery algorithm assumes unbounded registers.

The value of number[i] for process i may tend to infinity!

Two competing processes may keep incrementing this value forever:

number[i] := 1 + maximum (number[1], … , number[N]);

This causes register overflow in real systems.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

6 /15

Page 25: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Our Purpose

Avoid register overflows in the Bakery algorithm without making compromises.

Previous approaches to achieve the same goal:

● Introduce new shared variables.

● Redefine certain operations or functions in the algorithm.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

7 /15

Page 26: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Notable Solutions

The majority of approaches to avoid overflows in the Bakery algorithm include:

1. Changing the definitions of “<” operator and “maximum” function.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

8 /15

Page 27: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Notable Solutions

The majority of approaches to avoid overflows in the Bakery algorithm include:

1. Changing the definitions of “<” operator and “maximum” function.2. Using modulo arithmetic instead of integer arithmetic.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

8 /15

Page 28: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Notable Solutions

The majority of approaches to avoid overflows in the Bakery algorithm include:

1. Changing the definitions of “<” operator and “maximum” function.2. Using modulo arithmetic instead of integer arithmetic.3. Introducing new shared variables or using extra memory.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

8 /15

Page 29: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Notable Solutions

The majority of approaches to avoid overflows in the Bakery algorithm include:

1. Changing the definitions of “<” operator and “maximum” function.2. Using modulo arithmetic instead of integer arithmetic.3. Introducing new shared variables or using extra memory.4. Resetting the values of registers before an overflow occurs.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

8 /15

Page 30: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery++ Algorithm

There is an important theoretical question in the paper that introduced Bakery:

“Can one find an algorithm for finite processors such that processors enter their critical sections on a first-come-first-served basis, and no processor may write into another processor’s memory?”

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

9 /15

Page 31: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

The Bakery++ Algorithm

There is an important theoretical question in the paper that introduced Bakery:

“Can one find an algorithm for finite processors such that processors enter their critical sections on a first-come-first-served basis, and no processor may write into another processor’s memory?”

To our knowledge, all of the previous works on bounding the Bakery algorithm have failed to answer this question.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

9 /15

Page 32: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Bakery++

Bakery++ is a slightly modified version of the Bakery algorithm.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

10 /15

Page 33: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Bakery++

Bakery++ is a slightly modified version of the Bakery algorithm.

We call it “Bakery++” because it is almost identical to Bakery.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

10 /15

Page 34: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Bakery++

Bakery++ is a slightly modified version of the Bakery algorithm.

We call it “Bakery++” because it is almost identical to Bakery.

It does not use any additional variables.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

10 /15

Page 35: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Bakery++

Bakery++ is a slightly modified version of the Bakery algorithm.

We call it “Bakery++” because it is almost identical to Bakery.

It does not use any additional variables.

It does not redefine the operators or functions used in Bakery.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

10 /15

Page 36: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

constant M;integer array choosing [1..N], number [1..N];begin integer j;L1: if ∃ q ∈ {1, … , N} such that number[q] ≥ M then goto L1;choosing[i] := 1;number[i] := maximum (number[1], … , number[N]);if number[i] ≥ M then begin

number[i] := 0; choosing[i] := 0; goto L1; end

else number[i] := number[i] + 1;choosing[i] := 0;for j = 1 step 1 until N dobegin

L2: if choosing[j] ≠ 0 then goto L2;L3: if number[j] ≠ 0 and (number[j], j < number[i], i) then goto L3;

end;critical section; number[i] := 0; noncritical section; goto L1;end

Bakery++ (cont.)

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

11 /15

Page 37: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Performance and Practicality

Bakery++ does not introduce new variables, so the spatial complexities of both algorithms are identical.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

12 /15

Page 38: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Performance and Practicality

Bakery++ does not introduce new variables, so the spatial complexities of both algorithms are identical.

The temporal complexity of Bakery++ depends on the number of executions of the goto statement exactly after label L1.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

12 /15

Page 39: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Performance and Practicality

Bakery++ does not introduce new variables, so the spatial complexities of both algorithms are identical.

The temporal complexity of Bakery++ depends on the number of executions of the goto statement exactly after label L1.

The reason Bakery ++ is useful in practice is that it is almost as simple as the original Bakery, without new variables and fancy operations or functions.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

12 /15

Page 40: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Performance and Practicality

Bakery++ does not introduce new variables, so the spatial complexities of both algorithms are identical.

The temporal complexity of Bakery++ depends on the number of executions of the goto statement exactly after label L1.

The reason Bakery ++ is useful in practice is that it is almost as simple as the original Bakery, without new variables and fancy operations or functions.

There are no practical limitations for implementing the Bakery++ algorithm.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

12 /15

Page 41: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Correctness Argument

Bakery++ does not introduce new variables and its control flow is almost identical to Bakery. The changes that have been made to Bakery include:

● Introducing a constant that represents the maximum value storable.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

13 /15

Page 42: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Correctness Argument

Bakery++ does not introduce new variables and its control flow is almost identical to Bakery. The changes that have been made to Bakery include:

● Introducing a constant that represents the maximum value storable.● Adding a conditional statement and a goto after label L1 that does not manipulate

the values of Bakery’s data objects.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

13 /15

Page 43: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Correctness Argument

Bakery++ does not introduce new variables and its control flow is almost identical to Bakery. The changes that have been made to Bakery include:

● Introducing a constant that represents the maximum value storable.● Adding a conditional statement and a goto after label L1 that does not manipulate

the values of Bakery’s data objects.● Adding a conditional statement before incrementing the maximum value obtained

from reading all processes’ variable number.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

13 /15

Page 44: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Correctness Argument

Bakery++ does not introduce new variables and its control flow is almost identical to Bakery. The changes that have been made to Bakery include:

● Introducing a constant that represents the maximum value storable.● Adding a conditional statement and a goto after label L1 that does not manipulate

the values of Bakery’s data objects.● Adding a conditional statement before incrementing the maximum value obtained

from reading all processes’ variable number.● If there is a possibility of overflow in process i, then we simply set

number[i] = choosing[i] = 0 and then we jump to label L1. Otherwise, we will continue by incrementing the maximum value and the original Bakery algorithm.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

13 /15

Page 45: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Discussion and Future Work

There are two questions:

1. What happens if there are more customers in the bakery than the maximum number that can be stored in a register?

2. What is the definition of the exact moment when a process is considered to have taken its turn for entering its critical section?

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

14 /15

Page 46: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Conclusions

We revisited the problem of mutual exclusion and the Bakery algorithm, the first true mutual exclusion algorithm, to solve the problem of integer overflow.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

15 /15

Page 47: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Conclusions

We revisited the problem of mutual exclusion and the Bakery algorithm, the first true mutual exclusion algorithm, to solve the problem of integer overflow.

Previous approaches to solving the problem of register overflow concentrated on making use of new variables and redefining the operations or functions used in the original Bakery, and they were complicated solutions.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

15 /15

Page 48: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Conclusions

We revisited the problem of mutual exclusion and the Bakery algorithm, the first true mutual exclusion algorithm, to solve the problem of integer overflow.

Previous approaches to solving the problem of register overflow concentrated on making use of new variables and redefining the operations or functions used in the original Bakery, and they were complicated solutions.

Bakery ++ is quite simple and it differs from Bakery in just a few instructions.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

15 /15

Page 49: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Conclusions

We revisited the problem of mutual exclusion and the Bakery algorithm, the first true mutual exclusion algorithm, to solve the problem of integer overflow.

Previous approaches to solving the problem of register overflow concentrated on making use of new variables and redefining the operations or functions used in the original Bakery, and they were complicated solutions.

Bakery ++ is quite simple and it differs from Bakery in just a few instructions.

We have specified Bakery++ in the PlusCal language and performed model checking.

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm

15 /15

Page 50: Avoiding Register Overflow in the Bakery Algorithm · The majority of approaches to avoid overflows in the Bakery algorithm include: 1. Changing the definitions of “

Thank you!

SRMPDS ‘20, Edmonton, AB, CanadaAvoiding Register Overflow in the Bakery Algorithm