Chapter 11. Threading

Today’s modern processors come with multiple cores, each of which runs independently to run programs and significantly increase the throughput compared to a single-core processor. The clock speed is no longer the most important factor, because a quad-core processor will outperform most dual-core processors even if there is a clock speed discrepancy. In this chapter you will learn how to create threads using the POSIX Threads library—a popular cross-platform library that is part of the core Linux operating system (and available for Windows as well).

A thread is a set of instructions, usually in a loop, that runs in parallel with other sets of instructions (or threads) in a program. In a multitasking operating system, every program has at least one thread—itself—because the operating system breaks down every running process into one or more threads that may take advantage of dual-core or multiple processors in a computer system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset