3.1.3. Multi-threaded Process

The simple model of a process containing only one thread is referred to as a classic process. Modern operating systems also support processes with multiple threads. Each thread of a single process can use the process’ global data with synchronization resources to easily communicate with other threads. Multi-threaded programs run more efficiently and use less resources than a program that creates multiple processes to accomplish the same task.

../_images/thread.png

Threads share global data and other resources, but each thread has it’s own execution engine and stack for data that is local to each function in the program.

Note

The scheduling of threads within a processes presents an interesting challenge, which we will later discuss. Linux and Windows take completely different approaches to solve this problem.