读者作者问题的状态转换图 [英] State transition diagram for reader writer problem

查看:105
本文介绍了读者作者问题的状态转换图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当教授说写标志和读标志时,我不理解他的意思. 0表示被触发吗? 他希望我们绘制一个状态转换图,但是如果我知道发生了什么,我想我可以自己做.

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        |
+---------+------------+-----------+----------------+

推荐答案

write标志和read标志均为布尔值,表示它可以容纳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.)

这篇关于读者作者问题的状态转换图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆