A thread is an execution unit within a process and a scheduler within a process.
differences from the process:
(1) Memory
Space: An execution unit within a process; The process has at least one thread; they share the address space of the process, and the process has its own independent address space ;
(2) Resource ownership: A process is a resource that is allocated and owned by a thread in a process that shares the resources of the process
(3) The thread is the basic unit of the processor dispatch, but the process is not.
A program has at least one process, and a process has at least one thread. A process is an independent unit of the system's resource allocation and scheduling. A thread is an entity of a process that is the basic unit of CPU dispatch and dispatch, which is a smaller unit that can run independently than a process. The thread itself basically does not own system resources, Has only a few resources (such as program counters, a set of registers, and stacks) that are essential to the operation, but it can share all of the resources owned by the process with other threads that belong to one process.
The difference between threads and processes