Three classical IPC problems
来源:互联网 发布:access数据库实训报告 编辑:程序博客网 时间:2024/06/03 19:33
1. The Dining Philosophers Problem
The key point is to make sure that a philosopher should get two forks at one time, not separately. That means, one philosopher should check to see if he can get into the state of eating first, then get two forks or just wait. If he checks to see if he can get the left fork first, get it, then the right one, a deadlock may occur, even the chance is very small.
This problem is useful for modeling processes that are competing for exclusive access to a limited number of resources, such as I/O devices.
2. The Readers and Writers Problem
In this problem, one thing that should be concerned most is how to make writer, who has the exclusive access, not be blocked by the readers who come along after his arrival.
This problem models access to a data base.
3. The Sleeping Barber Problem
The solution uses three semaphores, one counts waiting customers (excluding the customer in the barber chair, who is not waiting), one presents the number of barbers who are idle waiting for customers, and one used for mutual exclusion. Besides, a variable is needed, which also counts the waiting customers. It is essentially a copy of the first semaphore. The reason for having such a variable is that there is no way to read the current value of a semaphore. In this solution, a customer has to count the number of waiting customers.
Like problem No.2, although they do not involve data transfer, they still belong to the area of IPC because they involve synchronization between multiple processes.
- Three classical IPC problems
- HMM introduction and the three problems
- Problems
- Problems
- Problems
- Classical Music
- Classical algorithms
- Memory space manipulating in Java(Section four:Problems Resolving - part three)
- Three Common Problems during Domino Setup and Start on Linux/Unix
- Three
- three
- three
- three
- Classical C++ books
- Classical Java Books
- Apocalyptica, classical or metal?
- Classical Inheritance in JavaScript
- Classical Inheritance in JavaScript
- 配置WebLogic Server集群
- U-boot相关
- 被病毒感染后隐藏文件夹的隐藏属性变灰(不可修改)的解决办法!
- 我晕,无语...
- Java开发者十项准则
- Three classical IPC problems
- JDBC详解
- .net页面生存周期
- 页面嵌入播放器代码
- VS2005(c#)项目调试问题解决方案集锦
- .NET会话(Session)保存模式
- 一段自己录制的Excel宏代码(画柏拉图)
- 地图输出成jpg或bmp
- 基于UDP的socket编程