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:
- It is a directed graph.
- It is an acyclic graph.
- Nodes of graph correspond to individual statements of program code.
- Edge between two nodes represents the execution order.
- A directed edge from node A to node B shows that statement A executes first and then Statement B executes.
Consider he 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:
- c = a – b cannot be executed before both a and b have been assigned values.
- w = c + 1 cannot be executed before the new values of c has been computed.
- The statements a = x + y and b = z + 1 could be executed concurrently.
Consider the following precedence relations of a program:
- S2 and S3 can be executed after S1 completes.
- S4 can be executed after S2 completes.
- S5 and S6 can be executed after S4 completes.
- S7 can be executed after S5, S6 and S3 complete.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Precedence Graph For Testing Conflict Serializability in DBMS
- Resource Allocation Graph (RAG) in Operating System
- Operator grammar and precedence parser in TOC
- System Protection in Operating System
- User View Vs Hardware View Vs System View of Operating System
- System Programs in Operating System
- File System Implementation in Operating System
- Xv6 Operating System -adding a new system call
- Traps and System Calls in Operating System (OS)
- Regular Graph in Graph Theory
- Process Schedulers in Operating System
- Introduction of Deadlock in Operating System
- Thread in Operating System
- Paging in Operating System
- Banker's Algorithm in Operating System
- Segmentation in Operating System
- File Systems in Operating System
- Virtual Memory in Operating System
- Real Time Operating System (RTOS)
- Remote Procedure Call (RPC) in Operating System
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.