- 締切済み
Dining Philosophers ProblemをC言語で
Dining Philosophers ProblemをC言語で実現させたいのですが、 何から手をつけたらいいか、分かりません。知恵を貸してください。 ↓Dining Philosophers Problemの概要 http://ja.wikipedia.org/wiki/%E9%A3%9F%E4%BA%8B%E3%81%99%E3%... 以下のような出力結果が望ましいです。 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...
- みんなの回答 (1)
- 専門家の回答
みんなの回答
- aris-wiz
- ベストアンサー率38% (96/252)
もしかして、この人ですか。。。? 返信のURLそのままコピーって感じですが。。。 http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1413339629 さておき、 >何から手をつけたらいいか、分かりません C言語に対する知識はどれほどありますか? もともと並列処理はC言語の標準ではなく 実装はOSに(最近ではHWにも?)依存します。 まずは並列処理させたいOSなどの環境を 勉強をすることをお勧めします。