A preliminary solution to the concepts of threads, processes and synchronized in Java multithreading
1、 Concept of process and thread
(1) In the traditional operating system, the program can not run independently. As the basic unit of resource allocation and independent operation, it is a process.
In the system without OS configuration, the execution mode of programs is sequential execution, that is, one program must be executed before another program is allowed to execute; In a multiprogramming environment, multiple programs are allowed to execute concurrently. There are significant differences between the two execution methods of the program. It is this feature of concurrent program execution that leads to the introduction of the concept of process into the operating system.
Since the concept of process was put forward in the 1960s, process has always been regarded as the basic unit that can have resources and run independently in OS. Until the mid-1980s, people put forward threads, a smaller basic unit that can run independently than processes, trying to use it to improve the degree of concurrent execution of programs in the system, so as to further improve the throughput of the system. Especially after entering the 1990s, multiprocessor systems have developed rapidly. Threads can better improve the parallel execution of programs than processes and give full play to the advantages of multiprocessors. Therefore, threads are also introduced into multiprocessor OS introduced in recent years to improve the performance of OS.
- above C is extracted from computer operating system - edited by Tang Xiaodan, etc. - version 3 (download address)