要求解决不同的经典同步问题.... [英] asking for the solution of different classical synchronization problems....

查看:56
本文介绍了要求解决不同的经典同步问题....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我这个不同的经典同步问题的解决方法
1.生产者-消费者问题
2.读者-作家问题
3.dining哲学家的问题

plss tell me the solution for the this diffrent classical synchronization problems
1.producer-consumer problem
2.readers-writers problems
3.dining philosopher problems

推荐答案

这些都是众所周知的,并且都属于每个软件开发人员都应该理解得很清楚的一些最小集合,所有这些,所以我不知道"不明白这可能是个问题.您没有报告任何问题.如果您认为告诉"的意思是给我代码",这不是我们在这里所做的. 这不是您真正感兴趣的.请参阅我最近的回答:
plz为我提供Java代码 [ ^ ].

首先,您需要了解原理,并且在就餐哲学家的问题的情况下,还需要了解这种情况的设置和重要性,尤其是在运行时很难自动检测到. br/>
请参阅:
http://en.wikipedia.org/wiki/Producer-consumer_problem [ http://en.wikipedia.org/wiki/Readers-writers_problem [ http://en.wikipedia.org/wiki/Dining_philosophers_problem [ http://en.wikipedia.org/wiki/Socket_API [
Those are well known and all belongs to some minimal set each software developer is supposed to understand pretty well, all of them, so I don''t understand what could be a problem. You did not report any problems. If you think that "tell" means "give me code", this is not what we do here. And this is not what you are really interested in. Please see my recent answer:
plz provide me the code in java[^].

First of all, you need to understand the principles, and, in case of dining philosophers problem, you also need to understand the settings and importance of this case, which is, in particular, is pretty hard to detect automatically during run time.

Please see:
http://en.wikipedia.org/wiki/Producer-consumer_problem[^],
http://en.wikipedia.org/wiki/Readers-writers_problem[^],
http://en.wikipedia.org/wiki/Dining_philosophers_problem[^].

You might say that this answer is trivial and you already know these articles, but this is really all you need. Well, some other sources referenced in these articles could be useful, but this is quite enough to get started. The familiarity with the language, your platform and some relevant APIs is a must.

I can add you some very useful challenge based on my own idea. I tried to implement the code demonstrating the dining philosopher problem based purely on the socket API:
http://en.wikipedia.org/wiki/Socket_API[^].

Many developers, when asked about IPC or thread synchronization primitives, often fail to mention sockets, but historically, sockets was originally created as the IPC facility, not networking, and later were implemented for networking communication. This would be extremely useful exercise and could make your solution to stand out. The first two problem also can be implemented for sockets. How about that?

—SA


这篇关于要求解决不同的经典同步问题....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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