What is a process and what is a thread
System to do one thing, run a task, all running tasks are usually a program;
Each running program is a process, which can be seen visually on the task manager.
When a program runs, the interior may contain multiple sequential execution flows, and each sequential execution flow is a thread.
About the characteristics of a process
Independence: A process is an entity that exists independently in the system and can have its own independent resources, each of which has its own private address space. The content cannot be accessed without running through the process itself.
Dynamic: The difference between a process and a program is that the program is static and the process is dynamic. A program is just a static set of instructions, and a process is a collection of instructions that are running in the system. With the concept of time, such as the life cycle;
Concurrency: Between processes, alternately executed.
threads, a sequential execution flow;
It is part of the process and a process can have multiple threads.
About the characteristics of a thread, or its advantages
1, the process can not share memory between the single-threaded shared memory is very easy
2. The system creation process needs to reallocate system resources for the process, but the cost of creating threads is minimal. Therefore multi-tasking is more efficient than multi-process implementation concurrency.
3, the Java language built-in multi-threaded function support, rather than simply as the underlying operating system scheduling mode
Summarize:
A program runs at least one process, and a process contains at least one thread, and the thread is part of the process.
Line threads for the process, is very strong, to achieve the sharing of resources, the loss of resources, artificial manual control procedures for the operation.
Definition and differences of processes and threads