State transition diagram for reader writer problem

老子叫甜甜 提交于 2019-12-19 11:27:35

问题


I'm not understanding my professor means when he says the write flag and read flag. Does 0 mean it is triggered? He wants us to draw a state transition diagram but I think I can do that myself if I knew what was going on.

+---------+------------+-----------+----------------+
| Counter | Write flag | Read flag | Interpretation |
+---------+------------+-----------+----------------+
| 0       | 0          | 0         | Write locked   |
| 0       | 0          | 1         | Invalid        |
| 0       | 1          | 0         | Invalid        |
| 0       | 1          | 1         | Available      |
| N       | 0          | 0         | Write request  |
| N       | 0          | 1         | Read locked    |
| N       | 1          | 0         | Invalid        |
| N       | 1          | 1         | Invalid        |
+---------+------------+-----------+----------------+

回答1:


The write flag and the read flag are each a boolean value, meaning it can hold a 0 or a 1. The state appears to be defined by the value of the counter and the two flags. I think your professor is asking that you draw a state diagram that shows transitions between different counter/flag value combinations. (My guess is that the intent is that you collapse all the counter>0 sub-states into a single sub-state labeled counter=N.)



来源:https://stackoverflow.com/questions/6524262/state-transition-diagram-for-reader-writer-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!