Understanding process and thread priority

To be able to work with threads, you need to know more than just how to create or terminate a thread. It's required that threads interact effectively, which demands proper time control. Time control has two forms: priority and synchronization. Priority controls how often a thread gets the CPU for execution, while synchronization controls thread competition for shared resources, and gives the sequence where threads must perform tasks in a specific order.

When one thread finishes, the scheduler looks for the next thread that will be executed. While selecting the next thread, the threads with higher priority have an advantage. Some activities such as response to sudden power loss are always executed with higher ...

Get C++ Multithreading Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.