Home > database >  process
process

Time:10-26

Said process is the basic unit of the resource allocation, as well as the basic unit of the operation of,

Threads are the smallest units of execution in the process of operation, which perform the basic unit of the processor scheduling,

The advantages of thread:

(1) easy to scheduling,
(2) improve the concurrency, through effectively achieve concurrency, thread can be conveniently process can create multiple threads to perform different parts of the same program,
(3) less overhead, create a thread faster than creating process, the required very little overhead,,
(4) to give full play to the function of the multiprocessor, by creating a multithreaded processes (that is, a process can have two or more threads), each thread running on a processor, so as to realize the application of concurrency, make each processor is fully running,

The relationship between the process and thread:

(1), a thread can only belong to a process and a process can have multiple threads, but at least one thread,
(2) the allocation of resources to process all the threads share the same process all of the resources,
(3) the processor to the thread that is real execution on the processing threads,
(4) threads in the process of execution, synchronous, requires collaboration between threads in different processes to take advantage of news communication way synchronization,

CodePudding user response:

Synchronization between the threads, interprocess communication can be used to achieve the same way