Any Program that is under execution is called a Process e.g. scanning an image is a process.
For the completion of a process resources are required. These resources are allocated to process either when process is created or is under execution. For Example you have typed a page in Microsoft Word and you want to print it, as you give print command the print process is created and it requires Printer as resource. If any other process is using the printer then your page will be queued and will be printed when first process of printing is complete. A process may have sub processes which are called child processes.A Process can demand only those resources which are available e.g. if 8 resources are available than process can demand all 8 resources but 9th resource can't be demanded.
Process States: -The current activity of a process at a particular time is called its state. A process may have following states:
1)New State : Recently Created process
2)Running : Process executing Instructions
3)Wait State: Waiting for allocation of Resources
4)Ready State: Ready for the assignment of processor in ready queue.
5)Terminated State: The Process execution is complete.
Figure given below illustrates all the states that a process may have.
For the completion of a process resources are required. These resources are allocated to process either when process is created or is under execution. For Example you have typed a page in Microsoft Word and you want to print it, as you give print command the print process is created and it requires Printer as resource. If any other process is using the printer then your page will be queued and will be printed when first process of printing is complete. A process may have sub processes which are called child processes.A Process can demand only those resources which are available e.g. if 8 resources are available than process can demand all 8 resources but 9th resource can't be demanded.
Process States: -The current activity of a process at a particular time is called its state. A process may have following states:
1)New State : Recently Created process
2)Running : Process executing Instructions
3)Wait State: Waiting for allocation of Resources
4)Ready State: Ready for the assignment of processor in ready queue.
5)Terminated State: The Process execution is complete.
Figure given below illustrates all the states that a process may have.
Given below is a program which when executed spawns two concurrent processes :
ReplyDeletesemaphore X : = 0 ;
/* Process now forks into concurrent processes P1 & P2 */
P1
repeat forever
V (X) ;
Compute ;
P(X) ;
P2
repeat forever
P (X) ;
Compute ;
V(X)
Consider the following statements about processes P1 and P2:
1. It is possible for process P1 to starve.
2. It is possible for process P2 to starve.
Which statement is/ are TRUE?
Please explain