A Case Study: Fischer’s Protocol
暂无分享,去创建一个
As another example for the NTASM approach, let us describe and analyze Fischer’s real-time based synchronization protocol [Lam87]. It is meant to ensure mutual exclusion of access to commonly used resources via real-time properties of a shared variable. The idea is to use just one shared variable (which we call v) for coordinating the access to the critical section. The variable can contain a process id or some neutral value (which we call noProc). When a process wants to enter its critical section, it first has to wait until v=noProc; then it sets v to its process id, waits some time, and then reads v again. If v has kept the old value, i.e., the id of the process considered, the process may enter its critical section; on leaving the critical section, v is set to noProc again. If v has not kept its old value, the attempt has failed and the process must go back and wait again till v=noProc.