Introduction to C++ threads
I’m getting started with concurrency in C++ and threads seem to be a good way to get familiar with the basics.
Processes
When a user starts executing a program, the program becomes a process. A process is a set of instructions (the code) and state (memory, registers) that is managed by the operating system. The operating system tells the processor which process it should be running.
In a system with a single core, only one process can be executed at one point in time. Since there are a lot of processes running in a modern system, the operating system will take care of deciding which processes should be serviced by the CPU.
Processes can create other processes by using Fork. When a process forks, they become independent of each other. They own their own instructions and state.