Open In App

Precedence Graph in Operating System

Prerequisite – Process Synchronization Precedence Graph is a directed acyclic graph which is used to show the execution level of several processes in operating system. It consists of nodes and edges. Nodes represent the processes and the edges represent the flow of execution. Properties of Precedence Graph : Following are the properties of Precedence Graph:

Consider the following code:

S1 : a = x + y;
S2 : b = z + 1;
S3 : c = a - b;
S4 : w = c + 1;

If above code is executed concurrently, the following precedence relations exist:

Example: Consider the following precedence relations of a program:

  1. S2 and S3 can be executed after S1 completes.
  2. S4 can be executed after S2 completes.
  3. S5 and S6 can be executed after S4 completes.
  4. S7 can be executed after S5, S6 and S3 complete.

Solution:

Article Tags :