Operating Systems/Process and Thread
threads[edit | edit source]
Threads are, as the name suggests, a thread of execution. For example, if you create a thread, you can assign something like a function to it. The code in the function and all other subsequent function calls run on the thread.
Process Life Cycle[edit | edit source]
Like in real world a process too is created and destroyed. Different operating systems have different life cycles for the processes but a very general life cycle model is given below.
Dormant[edit | edit source]
A dormant stage of the process is actually a program, executable file on hard disk.
Fork[edit | edit source]
A process is said to be forked when loaded in the main memory. The execution of instructions may not start immediately. The keyword fork is basically a Unix UNIX terminology.
Ready[edit | edit source]
A process is said to be ready when it can start executing the very next moment. Many times a process may need some resource which is not available for that time. Processes which can be scheduled to run at any time by a scheduler is said to be in ready state.
Blocked[edit | edit source]
A process is said to be blocked when it is waiting for some interrupt to occur. Without its occurrence it can not continue. Such processes are not considered by the scheduler for scheduling.
Running[edit | edit source]
The process which is currently being executed by the processor is called the running process. In an uniprocessor system there exist only one running process at a time.
Dead[edit | edit source]
A process is said to be dead or killed when its execution is complete. Such processes are then removed from the memory of a computer. A process might end for the following reasons.
- It performed all the functions it was supposed to perform and ended normally
- It created some exception and was killed by operating system
- The parent of the process is killed.