State transition diagram for reader writer problem

2019-02-20 08:00发布

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条回答
We Are One
2楼-- · 2019-02-20 08:42

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.)

查看更多
登录 后发表回答