Face questions: What is the process, what is the six state of the thread, the thread

process:

Process is run active program has a certain function on an independent data set. It is performed dynamically based operating system
this means, in conventional operating systems, the process is both a basic allocation unit, is the basic unit of execution.
Two main concepts of the process:
(1) process is an entity that
each process has its own storage space, under normal circumstances, including the text area, data area and stack area. Code is executed by a processor stored text area; dynamically allocated memory area stores data used during execution process variables; during the call stack area for storing instructions and activity of local variables
(2) a program process is executing in
the program is not a living entity, only the processor attached to the program of life, it can become an active entity, called the process
the process is the operating system the most basic, important concepts. After the concept is a multi-channel programming system appears to characterize the dynamics of internal systems arise, the activities described in the internal law system of the Road program introduced, all multiprogramming operating systems are built on top of the process.
Thread:
Thread (Thread) also called lightweight processes. The operating system is capable of calculating the minimum unit of scheduling. It is included in the process, the actual operation of the unit process. Refers to a thread is a single sequential flow of control process, a process may be complicated by a plurality of threads, each thread in parallel to perform different tasks. A thread is the basic unit of independent scheduling and dispatching, the thread can be a kernel thread scheduling of the operating system kernel; the user scheduling user threads; or mixed called by the kernel and user processes. Multiple threads in the same process will share all system resources of the process, but multiple threads in the same process has its own call stack (call stack), own register (register context), own thread local storage (thread- local storage). Heap space shared between threads and threads, independent stack space.
Properties thread: Independent scheduling and execution of the basic unit, lightweight entity, can be executed concurrently, shared process resources.
Part of the thread: CPU time slice logic code, operating data, the thread.
Six state of the thread:
(NEW) ① initial state: a state in which the thread has not been started;

② run state (RUNNABLE): Thread state can run threads may be running, may also be waiting for processor resources;

③ blocking state of lock blocking (BLOCKED): the state is blocked waiting for a monitor lock thread is located (that is, when a thread tries to acquire the lock, but this time the lock is held by another thread, the thread entered the BLOCKED state, when the thread take RUNNABLE goes into the lock state);

④ blocking state of infinite waiting (WAITING): When the state of the thread in which the waiting time is not specified (call Object.join () or Object.wait () method enters this state when a thread is in this state, only by another a thread wake up, wake up and can not on their own initiative, another thread calls notify () or notifyAll () or to wake up the thread abort state);


A timing ⑤ blocked state of waiting (TIMED_WAITING): Specifies the state of a thread in which the waiting time (call Thread.sleep (long) or Object.join (long) or Object.wait (long) method enters this state until the timeout when the wake-up notification or receipt, note wait (0) is their own awakening, such as automatically wake up when the end of the Thread);

⑥ final state: the state of the thread has completed execution.

Guess you like

Origin www.cnblogs.com/caozyblogs/p/12633206.html