Concept:
Process: One ProgramDynamic execution of a dataset is the basic unit for resource allocation.
Thread: the basic scheduling unit in a process.
The division scale of threads is smaller than that of processes. A process contains one or more threads.
From the execution process:
Process: it has independent memory units, and multiple threads share the memory, thus improving the running efficiency of the application.
Thread: each independent thread has a program running entry, sequence of execution, and program exit. But the thread cannot be executed independently. It must exist in the application and the application provides multiple thread execution control.
From a logic perspective: (important differences)
Multithreading means that multiple execution parts in an application can be executed simultaneously. However, the operating system does not view multiple threads as multiple independent applications to implement process scheduling, management, and resource allocation.
Another type:
A process is a program execution, and what is a thread? A thread can be understood as a program fragment executed in a process. The concept below a multitasking environment helps us understand the difference between the two.
Processes are independent, which is manifested in the memory space and Context Environment. threads run in the process space.
Generally, a process cannot break through the process boundary to access the storage space in other processes. Because the thread is in the storage space of the process, the threads produced by the same process share the same memory space.
Two segments in the same processCodeIt cannot be executed simultaneously unless a thread is introduced. A thread is a process. When a process exits, all threads generated by the process are forcibly exited and cleared. Threads consume less resources than processes. Both processes and threads can have priority.