Multi-threads are saved in applications and is the basic features and important marks in the modern operating system. The reader of the UNIX operating system knows the process. In the UNIX operating system, each application is registered in the operating system kernel, and the operating system scheduling and system resource allocation of the application based on the assigned flag. What is the difference between processes and threads?
The processes and threads are basic units operating by the program experienced by the operating system, and the system utilizes the basic unit to realize the concurrency of the application. The difference between processes and threads is:
The division scale of the thread is less than the process, so that the combination of the multi-threaded program is made.
In addition, the process has an independent memory unit during the execution process, and multiple threads share memory, which greatly improves the operational efficiency of the program.
Threads are still distinguished from the process during execution. Each stand-alone thread has a program running, sequential execution of sequences and programs. However, the thread cannot be executed independently, and must be performed by the application, and multiple thread execution control is provided by the application.
From a logical point of view, the meaning of multi-thread is in an application, and multiple execution portions can be executed simultaneously. However, the operating system does not see multiple threads to do multiple independent applications to implement process scheduling and management and resource allocation. This is an important difference between the processes and threads. Process is the concept of initially defined in Unix, multi-task operating system environments to represent applications for basic execution units in memory environments. Take the UNIX operating system as an example, the process is the basic component in the UNIX operating system environment, which is the basic unit of system resource allocation. Almost all user management and resource allocation completed in the UNIX operating system are implemented by operating the operating system to control the application process. C, C , Java, etc. Source creations in Java are compiled into executable files with the corresponding compiler, submitted to the computer processor. At this time, the application in the executable state is called the process. From a user point of view, the process is an execution process for the application. From a core perspective of the operating system, the process represents the basic unit of the memory, CPU timefinder, etc., is a running environment provided by the running program. The difference between the process and the application is that the application is stored as a static file in a storage space such as a computer system, and the process is a system resource management entity maintained by operating system under dynamic conditions. The main features of the application process in a multi-task environment include: ● Process has an initial entry point of the memory cell during execution, and the process survival process always has independent memory address space; ● The survival status of the process includes creation, ready, Operating, blocking, and death; ● Different from the application process in the execution process to the CPU, the state of the process can be divided into user state and core state. The process in the user state is executed is the application instruction, and the application process in the core state is executed is the operating system instruction. During the startup process of UNIX operating system, the system automatically creates Swapper, INIT and other system processes, used to manage memory resources and scheduling user processes. In the UNIX environment, both the process created by the operating system is also created by the application, all have unique process ID (PID).
The difference between the process and the Java thread