出産前後の痔にはご注意!

Dining Philosophers ProblemをC言語で実現させたいのですが、
何から手をつけたらいいか、分かりません。知恵を貸してください。

↓Dining Philosophers Problemの概要
http://ja.wikipedia.org/wiki/%E9%A3%9F%E4%BA%8B% …

以下のような出力結果が望ましいです。
I am philosopher 1
philosopher 1: I'm thinking...
I am philosopher 2
philosopher 2: I'm thinking...
I am philosopher 3
philosopher 3: I'm thinking...
I am philosopher 4
philosopher 4: I'm thinking...
I am philosopher 5
philosopher 5: I'm thinking...
philosopher 1: I'm hungry.
philosopher 1: I'm eating...
philosopher 2: I'm hungry.
philosopher 2: I'm eating...
philosopher 4: I'm hungry.
philosopher 5: I'm hungry.
philosopher 5: I'm eating...
philosopher 4: I'm eating...
philosopher 3: I'm hungry.
philosopher 3: I'm eating...
philosopher 2: It taste wonderful!
philosopher 2: I'm thinking...
philosopher 5: It taste wonderful!
philosopher 5: I'm thinking...
philosopher 4: It taste wonderful!
philosopher 4: I'm thinking...
philosopher 1: It taste wonderful!
philosopher 1: I'm thinking...
philosopher 3: It taste wonderful!
philosopher 3: I'm thinking...
philosopher 2: I'm hungry.
philosopher 2: I'm eating...
philosopher 1: I'm hungry.
philosopher 5: I'm hungry.
philosopher 5: I'm eating...
philosopher 4: I'm hungry.
philosopher 3: I'm hungry.
philosopher 3: I'm eating...
philosopher 5: It taste wonderful!
philosopher 5: I'm thinking...
philosopher 2: It taste wonderful!
philosopher 2: I'm thinking...
philosopher 1: I'm eating...
philosopher 3: It taste wonderful!
philosopher 3: I'm thinking...
philosopher 4: I'm eating...

A 回答 (1件)

もしかして、この人ですか。

。。?
返信のURLそのままコピーって感じですが。。。
http://detail.chiebukuro.yahoo.co.jp/qa/question …

さておき、
>何から手をつけたらいいか、分かりません
C言語に対する知識はどれほどありますか?
もともと並列処理はC言語の標準ではなく
実装はOSに(最近ではHWにも?)依存します。

まずは並列処理させたいOSなどの環境を
勉強をすることをお勧めします。
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!


人気Q&Aランキング