Skip to content

Max's Blog

  • Home
  • About
Max's Blog

Category: Concurrency

August 22, 2025 max-sperling

Usecase for compare_exchange (std::atomic)

Let’s assume you want to implement a function to update the maximum value or a variable. Issue: To prevent a

Continue reading
August 14, 2025 max-sperling

Singleton file logger with concurrent queue (C++)

Advantages … of a singleton is that you don’t have to pass it into every class you want to log

Continue reading
August 12, 2025 max-sperling

Assembler instructions for atomics (C++)

std::atomic Intel / AMD ARM (with LSE) fetch_add() LOCK XADD1,2,3,4,5 LDADD1, LDADDA2, LDADDL3, LDADDAL4,5 fetch_sub() fetch_and() LOCK AND1,2,3,4,5 LDCLR1, LDCLRA2,

Continue reading
August 12, 2025 max-sperling

std::jthread (C++)

With C++20 you can use std::jthread (“Cooperatively Interruptible Joining Thread”), which does the stop request and the joining in its

Continue reading
August 12, 2025 max-sperling

Threaded pi calculation with concurrent queue (C++)

Code $ g++ main.cpp -ltbb -lpthread Future Switch to a thread pool to execute the different calculations in parallel.

Continue reading
July 28, 2025 max-sperling

Memory order for atomics (C++)

Overview Memory order Description memory_order_relaxed Unsafest, No ordering is guaranteed. memory_order_acquire A load operation, No reads or writes in the

Continue reading
March 19, 2025 max-sperling

Parallelize without own threading (oneTBB)

oneTBB The library abstracts all the thread handling from you, like the task scheduler and its thread pool. Features (selection)

Continue reading
August 20, 2021 max-sperling

Types of mutexes and locks (C++)

Mutexes (Selection) … synchronizes the access on critical sections std::mutex Provides exclusive access (can only be pulled by one thread

Continue reading
April 19, 2021 max-sperling

Active vs. passive waiting (C++)

Active waiting Don’t use this approach, because it will unnecessarily consume CPU time. The sleep reduces the CPU consumption, but

Continue reading
July 24, 2020 max-sperling

std::recursive_mutex (C++)

The std::mutex is a non-recursive mutex and therefore can’t be locked again from the same thread before getting unlocked. This

Continue reading

Posts navigation

1 2 Next Posts»

Categories

  • Other (19)
    • Games (13)
    • Nutrition (4)
    • Traveling (2)
  • Science (17)
    • Chemistry (3)
    • Linguistics (2)
    • Math (10)
    • Physics (2)
  • Sport (73)
    • Climbing (5)
    • Diving (20)
    • Fitness (8)
    • Martial arts (34)
      • Ground fighting (9)
      • Mixed martial arts (4)
      • Stand-up fighting (12)
    • Running (1)
    • Surfing (2)
    • Swimming (1)
    • Volleyball (2)
  • Technology (289)
    • Computer (259)
      • Architecture & Design (15)
      • Artificial intelligence (3)
      • Audio & Video (11)
      • Building & Reversing (15)
        • CMake (2)
      • Computational complexity (3)
      • Computer architecture (4)
      • Debugging & Memory (29)
      • Development (72)
        • CI/CD (1)
        • Programming (61)
          • Concurrency (12)
          • Data structures (13)
          • Pointers & References (7)
        • Scripting (4)
        • Testing (6)
      • Development process (5)
      • Hacking & Security (17)
      • Hardware & Protocols (8)
      • Networking (11)
      • Operating system (22)
        • Linux (13)
        • Windows (8)
      • Regular expression (2)
      • Tool configuration (5)
      • Version control (22)
      • Virtualization (7)
      • Web (29)
    • Electrics (9)
    • Mechanics (15)
    • Medicine (2)
    • Photography (4)
WordPress Theme: Wellington by ThemeZee.