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 readingCategory: Development
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 readingThreaded 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 readingMemory 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 readingVirtual environment (Python)
If you want to install project dependencies without cluttering the system, then you should use a virtual environment. 0. Install
Continue readingRandom number generation (C++)
Let’s generate 10 integers with a uniform distribution between 1 and 6. Historic approach Only uniform distribution provided. 👎 Modern
Continue readingParallelize 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 readingHow to pass arguments (C++)
Analysis Code â–¼ Output â–¼ Constructor: bar_0 Not store copy run_copy_no_store Constructor: bar_1 === lvalue === Copy Constructor: bar_1 ===
Continue readingMutable vs. Immutable (Python)
Immutable data types They are not modifiable e.g. Numbers, Strings and Tuples Before line 3 a —> 1 b —–^
Continue reading