All books

Professional

Apps About Coach Log in Start reading

Quantitative Finance · Glossary

What is Priority inversion?

Definition 11.7 Low-Latency Software · Chapter 11 — Lock-Free Programming

Priority inversion occurs when a high-priority thread waits for a resource held by a low-priority thread that cannot run because medium-priority threads take its processor; the high-priority thread is effectively demoted below the medium ones.

One to four threads counting a million events each into a shared counter protected by a mutex, updated by a CAS loop or by fetch_add, or into padded per-thread counters summed at the end. Only the design that shares nothing scales. Measured on a laptop (Intel Core Ultra 7 155H) under WSL2, no isolated cores, threads unpinned. Data: bench_lockfree.py.
Figure 11.3. One to four threads counting a million events each into a shared counter protected by a mutex, updated by a CAS loop or by fetch_add, or into padded per-thread counters summed at the end. Only the design that shares nothing scales. Measured on a laptop (Intel Core Ultra 7 155H) under WSL2, no isolated cores, threads unpinned. Data: bench_lockfree.py.
Read in context →