Implementation of Processes :
Process Model is implemented by Process Table and Process Control Block which keep track all information of process.
At the time of creation of a new process, operating system allocates a memory for it loads a process code in the allocated memory and setup data space for it .
The state of process is stored as ' new ' in its PCB and when this process move to ready state its state is also changes in PCB.
When a running process needs to wait for an input output devices, its state is changed to 'blocked'. The various queues used for this which is implemented as linked list.
There are many following queues:
•Read Queue: This queue is used for storing the processes with state ready .
•Blocked Queue: it is used for storing the processes but need to wait for an input output device or resource.
•Suspended Queue: It is used for storing the blocked process that have been suspended.
•Free process Queue: it is used for the information of empty space in the memory where a new PCB can be created.
Each PCB has a pointer that point to Next PCB. There is a header for each type of queue. The header stores the information about the first and last PCBs in that queues.
There is one more header giving the information about the running process information, however there is no queue of running processes because there is only one process in the system.
One more queues-> information about process area-> Which free after the termination of a process which is free or release the memory after process termination. And this memory area can be used for a new process.
Besides changing the state of a process, PCB saves its position for further resumption where is left off. Initially, the process program counter, program status word, registers and other information after on the stack. After this, the stack information is stored in the corresponding PCB of the process.
This saving of the status of the running process in its PCB is called context saving.
After saving the context of a process, the appropriate event handling function is executed.
For Example: for wait state for an input output device, then it is send to the queue of the blocked processes.
After this there is a requirement that another process be dispatched to the CPU as current process has been interrupted. Therefore, scheduler is called to schedule a process from the ready queue. After selecting the process from ready queue , its pcb is loaded and dispatched to the cpu for execution.
In this way, the processes are implemented by saving their context in PCBs and making state change possible.