TLDR Web Dev · MISCELLANEOUS
MACOS TIPS FOR PROGRAMMERS: THREADING
Summary from the TLDR Web Dev newsletter
Apple's system aggressively prioritizes tasks based on Quality of Service (QoS) classes (User Interactive, User Initiated, Legacy, Utility, and Background). This influences CPU scheduling and I/O. To avoid priority inversion bugs, use specific synchronization primitives like `os_unfair_lock` or `pthread_mutex`, which enable QoS inheritance, boosting lower-priority threads when accessed by higher-priority ones.