8. Debugging Multi-threaded Code

CPU manufacturers package the constantly increasing number of transistors they can fit onto a chip into multiple cores, and then ask us developers to put the cores to good use. Threads of execution running on the multiple cores avoid coordinating with each other so that each one can run as fast as possible. Consequently, the programs execute in a nondeterministic manner: every time we run them, they may execute in a slightly different order. This throws out the window many of the techniques you saw in other chapters of this book. For example, you can’t reliably zoom in to a moving target (see Item 4: “Drill Up from the Problem to the Bug or Down from the Program’s Start to the Bug”). Thankfully, there are tools ...

Get Effective Debugging: 66 Specific Ways to Debug Software and Systems 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.