Process, thread, concurrency, parallelism



Processes have independent virtual address space, so they can’t share memory. If they want to communicate with other processes, they must use some explicit inter process communication (IPC) mechanism. Process control and IPC cost a lot.

  • Multi process execution process

The transition from one process to another is managed by the operating system kernel. When an application needs some operation of the operating system, such as reading and writing files, it executes a special system call instruction to pass control to the kernel. The kernel then performs the requested operation and returns to the application.
Process, thread, concurrency, parallelism


A process allows multiple threads, which are automatically scheduled by the kernel. Multiple threads share the virtual address space of the process. Each thread has its own thread context, including a unique thread ID, stack, stack pointer, program counter, general purpose register and condition code. Threads are more efficient than processes, and multithreading can greatly improve efficiency when there are multiple processors working.

  • Thread execution model

Each process starts with a single thread, called the main thread. At some point, the main thread creates a peer thread, and then the two threads run concurrently. Because the main thread executes a slow system call, such as read file or sleep, or because the interval timer of the system is interrupted, control is passed to the peer thread through context switching. After the peer thread executes for a period of time, the control returns to the main thread for the same reason, and so on.
Process, thread, concurrency, parallelism


The term concurrency is a general concept that refers to a system with multiple activities at the same time.


The term parallelism refers to the use of concurrency to make a system run faster. Parallelism can be applied at multiple levels of abstraction in computer systems

  • Thread level concurrency

In the traditional sense, this concurrency is only simulated, which is achieved by fast switching between the processes that it is executing.

  • Instruction level parallelism
  • Single instruction, multi data parallel