Web appOpen in Telegram

ThreadThread 1 Thread 2

2 messages · –
N
Thread 1 Thread 2 ---------------------------------- ---------------------------------- 1. Reads x (reads 0) [Context Switch! ⏸️] 1. Reads x (still reads 0!) 2. Adds 1 (0 + 1 = 1) 3. Writes x = 1 💾 [Context Switch! ⏸️] 2. Adds 1 (0 + 1 = 1) 3. Writes x = 1 💾 (Overwrites Thread 2!) This is the problem in multi threading 😬😬😬
  1. R
    No, that is a general concurrency problem and it is a well known problem It is called race condition. And there are multiple ways to deal with those (like mutex locks, or not using global variables for all of the threads) Keep on learning
    🤯1
OOfftopicOfftopic@pythonofftopic · group · Tech
10 946members117writing in 30 days
Venue feed Open in Telegram

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog · Search · How we count