Threads: sometimes referred to as lightweight processes (lightweight PROCESS,LWP), is the smallest unit of program execution flow. is a collection of instructions.
A thread is a single sequential control flow in a program. A relatively independent and scheduled execution unit in the process is the basic unit for the system to dispatch and dispatch the CPU independently, which refers to the dispatching unit of the running program.
Running multiple threads at the same time in a single program accomplishes different tasks, called multithreading.
Process: QQ to a whole form of exposure to the operating system management, which contains a variety of resource calls, memory management, network interface calls, etc...
A collection of various resource management can be a process.
Process to operate the CPU, you must first create a thread,
All the threads in a process has the same view of the memory
All threads in the same process share the same block of memory space.
What is the difference between a process and a thread?
threads share the address space of the process that created It; processes have their own address space. Thread shared memory space, process memory is independent Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process. A thread can access its own data segment directly, and the process needs to replicate the data segment of its parent process threads can directly communicate with other threads of its process; processes must use interprocess communication to communicate with sibling Processes. The threads of the same process can communicate directly, and two processes want to communicate and must be implemented through an intermediary agent New threads are easily created; new processes require duplication of the parent process. Creating a new thread is simple, Creating a new process requires one clone of its parent process Threads can exercise considerable&nbsP;control over threads of the same process; processes can only exercise control over child processes. A thread can control and manipulate other threads in the same process, but the process can only manipulate child processes changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the Process; changes to the parent process does not affect child processes.
Changes to the main thread (cancellation, priority change, and so on) may affect the behavior of the other threads of the process, and changes to the parent process do not affect the child process.
What is the difference between a process and a thread?