デッドロック

プロセスが互いを無期限にブロックする循環待機。

デッドロックは、各プロセスがリソースを保持しながら他のプロセスが保持するリソースを待機しているため、プロセスのセットが永久にブロックされる状態です。

コフマンの4条件:相互排他、保持と待機、非プリエンプション、循環待機が必要です。

        graph LR
  Center["デッドロック"]:::main
  Pre_process["process"]:::pre --> Center
  click Pre_process "/terms/process"
  Pre_mutex["mutex"]:::pre --> Center
  click Pre_mutex "/terms/mutex"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧒 5歳でもわかるように説明

交差点で4台の車がお互いをブロックしている状況を想像してください。誰も動けず、永遠に立ち往生します。

🤓 Expert Deep Dive

銀行家のアルゴリズムはデッドロックを回避します。検出には待機グラフ(wait-for graphs)を使用します。ダチョウアルゴリズム(無視)も一般的です。

🔗 関連用語

前提知識:

📚 出典