读写器问题的状态转换图
我不明白我的教授说写标志和读标志时的意思。 0是否表示已触发? 他希望我们画一个状态转换图,但我想如果我知道发生了什么,我自己就可以画出来。
+---------+------------+-----------+----------------+ | 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 | +---------+------------+-----------+----------------+
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 | +---------+------------+-----------+----------------+
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
写标志和读标志都是布尔值,这意味着它可以保存 0 或 1。状态似乎是由计数器的值和两个标志定义的。我认为你的教授要求你绘制一个状态图,显示不同计数器/标志值组合之间的转换。 (我的猜测是,目的是将所有 counter>0 子状态折叠为标记为 counter=N 的单个子状态。)
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.)