<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>活跃性 on 极客老墨</title>
    <link>https://blog.hankmo.com/tags/%E6%B4%BB%E8%B7%83%E6%80%A7/</link>
    <description>Recent content in 活跃性 on 极客老墨</description>
    <generator>Hugo -- 0.138.0</generator>
    <language>zh-cn</language>
    <lastBuildDate>Thu, 20 Jan 2022 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.hankmo.com/tags/%E6%B4%BB%E8%B7%83%E6%80%A7/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>多线程活跃性——哲学家就餐问题及死锁</title>
      <link>https://blog.hankmo.com/posts/tech/deadlock/</link>
      <pubDate>Thu, 20 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/deadlock/</guid>
      <description>死锁是多线程编程中最常见的一种&amp;#34;活跃性问题&amp;#34;，除了死锁还包括&amp;#34;饥饿&amp;#34;和&amp;#34;活锁&amp;#34;，这些活跃性问题给并发编程带来极大的挑战。比如出现死锁时，定位和分析问题相对困难，一旦出现死锁，通常只能重启应用程序。本文通过死锁最经典的&amp;#34;哲学家就餐问题&amp;#34;来介绍死锁的产生原因和解决办法。死锁指的是多个线程相互等待彼此而进入永久暂停状态。比如，线程 T1 持有锁 L1 去申请锁 L2，但是线程 T2 持有锁 L2 申请锁 L1，此时它们都在等待对象释放锁，从而进入永久阻塞状态。这就好比两个小朋友，他们各有一个玩具，但都不愿意分享给对方，却希望获得对方的玩具，最终互不相让，只能彼此干瞪眼了。</description>
    </item>
  </channel>
</rss>
