1. Programs, processes, threads
- Program: A set of instructions that complete a particular task when the program is completed.
- Process: A process is a program with a certain independent function on a data set on a running activity, a process is a system for resource allocation and scheduling of an independent unit.
- Thread: 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 the system resources, only has a point in the operation of the necessary resources (such as program counters, a set of registers and stacks), However, it can share all of the resources owned by the process with other threads that belong to one process. One thread can create and revoke another thread, and can execute concurrently between multiple threads in the same process.
2. Differences and Exercises
A process is a specific application in which a thread is a branch of a process that exists to complete a single item or set of functions in a program.
An application can have one or more processes, a process can have one or more threads, one of which is the main thread (the thread is the entity in the process, and a thread must have a parent process).
Programs, processes, threads (supplement required)