ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > ZSTU-(2020-2021)-1 > student homework > 2018329621232_沈宇帆 >
homework5_沈宇帆_2018329621232 Version 0
👤 Author: by 512858048qqcom 2020-11-09 03:04:58
For example, If two students want to use a printer, there will be data inconsistencies. A very good solution is to use Peterson's algorithm.Peterson's algorithm (or Peterson's solution) is a concurrent programming algorithm for mutual exclusion that allows two or more processes to share a single-use resource without conflict, using only shared memory for communication. While Peterson's original formulation worked with only two processes, the algorithm can be generalized for more than two.
And the code of the example is as fllow:

Please login to reply. Login

Reversion History

Loading...
No reversions found.