Git Product home page Git Product logo

the-dining-philosophers-problem's Introduction

📜 The Dining Philosophers Problem / 食事する哲学者の問題

❓ Problem / 問題

  • 哲学者の間には 1 本ずつフォークが置かれている。
  • 各哲学者は以下の行動をとる。
    • thinking 状態:思考にふけっている
    • hungry 状態:空腹になると、まず右のフォークをとってから、左のフォークをとる。この順番で両方のフォークをとると eating 状態になる。
    • eating 状態:食事中。食事が終わると thinking 状態に戻る。
  • 哲学者は 5 人いるとする。

😵 Deadlock / デッドロック

  • デッドロックとは、2つ以上のプロセスが互いの処理終了を待ち、結果としてどの処理も先に進めなくなること。
  • デッドロックの回避策
    • 哲学者が右のフォークを取る。
    • 左側のフォークが既に取られていた場合、右のフォークを置き、1. へ。
      取られていない場合、左のフォークを取る。
    • 哲学者は食事する。
  • 上記の回避策では、ライブロックの回避はできない。
  • ライブロックとは、全てのプロセスがお互いにリソースを譲り合い、処理が止まってしまうこと。
    • 全ての哲学者が右のフォークを取ると、左のフォークが取れないため、右のフォークを置く。
    • この動作が永遠と続く可能性がある。

😱 Progressive / 進行性

  • 進行性とは、特定の状態に無限に訪れること。
  • 進行性を成立させる手法 (Arbitrator Solutionというらしい)
    • 哲学者の食事の管理を行う管理者を用意する。
    • 管理者は哲学者の食事要請をキューに格納し、順番に一人ずつ哲学者に食事をさせる。

🦄 Source code / ソースコード

🐪 Report / レポート

🎁 References / 参考文献

🍋 License / ライセンス

Copyright (c) 2020-2022 k5-mot All Rights Reserved.

"k5-mot/The-Dining-Philosophers-Problem" is under MIT license.

the-dining-philosophers-problem's People

Contributors

k5-mot avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.