ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU class(2019-2020-1) > student directories > 2017329621012-曹秋斌 >
homework 4 Version 0
👤 Author: by 283385508qqcom 2019-10-09 15:12:27
When more than one processes are executing the same code or accessing the same memory or any shared variable in that condition there is a possibility that the output or the value of the shared variable is wrong so for that all the processes doing race to say that my output is correct this condition known as
race condition.
Several processes access and process the manipulations over the same data concurrently, then the outcome depends on the particular order in which the access takes place.

Peterson’s Solution is a classical software based solution to the critical section problem.

In Peterson’s solution, we have two shared variables:

  • boolean flag[i] :Initialized to FALSE, initially no one is interested in entering the critical section

  • int turn : The process whose turn is to enter the critical section.


peterson

Peterson’s Solution preserves all three conditions :



    • Mutual Exclusion is assured as only one process can access the critical section at any time.

    • Progress is also assured, as a process outside the critical section does not block other processes from entering the critical section.

    • Bounded Waiting is preserved as every process gets a fair chance.




Disadvantages of Peterson’s Solution



    • It involves Busy waiting

    • It is limited to 2 processes.



Please login to reply. Login

Reversion History

Loading...
No reversions found.