Chapter 23

Waiting for CPU

This chapter is a short case study of a multi-threaded program whose intermittent performance problem is waiting to have a CPU assigned to some threads. We look at a parent thread that launches five child threads and waits for them to complete. Two problems occur: (i) using the default Linux Completely Fair Scheduler (CFS), we find that the child threads do not get a fair share of the CPU time, and (ii) when starting up, there are idle delays when runnable threads do not in fact execute.

From our framework, this chapter is about not running while waiting for a CPU. A runnable process can wait for a CPU because (1) all the cores are busy, (2) an assigned core is delayed waking up from idle, or (3) the OS scheduler decides ...

Get Understanding Software Dynamics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.