Difference between parallel and concurrent processes and threads
Parallel: Multiple commands are executed simultaneously on multiple processors at the same time.
Concurrency: At the same time, only one command can be executed, but multiple process commands can be quickly rotated to achieve simultaneous execution of multiple processes at a macro level.
Processes generally have the following four elements:
1. There is a program for execution (the program can be shared by multiple processes ).
2. Dedicated system stack space is available.
3. There is a corresponding process control block in the kernel.
4. Independent storage space means dedicated user space.
Compared with the process, the thread only has the first three items, but lacks the fourth.
Special:
If there is no user space, it is called the kernel thread.
If the user space is shared, it is called a user thread.