<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Concurrency on Chen Kai Blog</title><link>https://www.chenk.top/en/tags/concurrency/</link><description>Recent content in Concurrency on Chen Kai Blog</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 21 Apr 2024 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/en/tags/concurrency/index.xml" rel="self" type="application/rss+xml"/><item><title>Databases (3): Transactions and Concurrency — ACID, Isolation Levels, and Locking</title><link>https://www.chenk.top/en/databases/03-transactions-and-concurrency/</link><pubDate>Sun, 21 Apr 2024 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/databases/03-transactions-and-concurrency/</guid><description>&lt;p>Every application that handles money, inventory, or any state that matters eventually hits a concurrency bug. Two users buy the last item in stock. A bank transfer debits one account but crashes before crediting the other. A report reads half-updated data and produces nonsense numbers. Transactions exist to prevent these failures, and understanding how they work is non-negotiable for anyone building production systems.&lt;/p>
&lt;hr>
&lt;h2 id="what-is-a-transaction" class="heading-anchor">What Is a Transaction?&lt;a href="#what-is-a-transaction" class="heading-link" aria-label="Permalink to this section" title="Copy link to this section">#&lt;/a>
&lt;/h2>&lt;p>A transaction is a group of operations that the database treats as a single unit. Either &lt;strong>all&lt;/strong> operations succeed, or &lt;strong>none&lt;/strong> of them do.&lt;/p></description></item><item><title>Python Engineering (6): Concurrency — Threads, Processes, and asyncio</title><link>https://www.chenk.top/en/python-engineering/06-concurrency/</link><pubDate>Thu, 21 Apr 2022 09:00:00 +0000</pubDate><guid>https://www.chenk.top/en/python-engineering/06-concurrency/</guid><description>&lt;p>Your script downloads 100 files one at a time. Each download takes 2 seconds, mostly waiting for the server to respond. Total time: 200 seconds. Your CPU is idle for 99% of that time, wasting compute and money on network latency. Concurrency can fix this.&lt;/p>
&lt;p>Python has three concurrency models, each designed for different problems. Choosing the wrong one can make your code slow or full of race conditions. This article explains when to use each.&lt;/p></description></item></channel></rss>