Precedence Graph | Operating System - Computer Science Engineering (CSE) PDF Download

Precedence Graph in Operating System

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.

Precedence Graph | Operating System - Computer Science Engineering (CSE)

Example:
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.

Solution:

Precedence Graph | Operating System - Computer Science Engineering (CSE)

The document Precedence Graph | Operating System - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Operating System.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
10 videos|99 docs|33 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Precedence Graph - Operating System - Computer Science Engineering (CSE)

1. What is a precedence graph in operating systems?
Ans. A precedence graph in operating systems is a graphical representation of the dependencies between tasks or processes in a system. It is used to illustrate the order in which tasks need to be executed or the precedence relationships between them.
2. How is a precedence graph helpful in computer science engineering?
Ans. A precedence graph in computer science engineering helps in visualizing the dependencies between tasks or processes. It allows engineers to understand the order in which tasks should be executed and identify any potential bottlenecks or conflicts that may arise in the system.
3. What are the key components of a precedence graph?
Ans. The key components of a precedence graph include nodes and edges. Nodes represent the tasks or processes, while edges represent the dependencies or precedence relationships between them. The edges can be directed, indicating the direction of dependency, or they can be undirected, indicating a mutual relationship.
4. How does a precedence graph contribute to operating system design?
Ans. A precedence graph contributes to operating system design by providing insights into the scheduling and coordination of tasks. It helps in identifying the critical path, which is the longest path of dependencies in the graph, and allows designers to optimize the execution order of tasks to improve system performance.
5. Can a precedence graph have cycles?
Ans. No, a precedence graph cannot have cycles. Cycles in a precedence graph would indicate circular dependencies, which are not allowed as they would create an indefinite loop of task dependencies. A cycle-free precedence graph ensures a well-defined execution order for tasks in a system.
10 videos|99 docs|33 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Precedence Graph | Operating System - Computer Science Engineering (CSE)

,

ppt

,

Semester Notes

,

Free

,

practice quizzes

,

Viva Questions

,

pdf

,

MCQs

,

mock tests for examination

,

past year papers

,

Objective type Questions

,

study material

,

Extra Questions

,

Previous Year Questions with Solutions

,

Exam

,

Precedence Graph | Operating System - Computer Science Engineering (CSE)

,

Important questions

,

Precedence Graph | Operating System - Computer Science Engineering (CSE)

,

shortcuts and tricks

,

Summary

,

Sample Paper

,

video lectures

;