FA22 BSE 064 Assignment 04

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

COMSATS UNIVERSITY ISLAMABAD, LAHORE CAMPUS

Assignment 04: Formal Methods

Name: Hamza Khan (FA22-BSE-064)

CLASS: BSE-4A

COURSE: CSE356

SUBMITTED TO: Dr. Farooq Ahmad

Q: Construct a Petri net Model for the following case study.


In a multitasking operating system multiple processes often need to get access to a
shared resource such as commonly used files, variable, printers, scanner, etc. If this is the
case, a task manager decides whose turn it is to be in the critical section (a fragment of the
program in which a process request shared resource). Letting one process to be critical section
and forbidding that for another process is called mutual exclusion. Mutual exclusion arises
when while one process is using a shared variable, or file, other processes are executed from
doing the same action. If we could arrange matters such that no two processes were ever in
their critical sections at the same time, we could avoid the race conditions. Make sure if one
process is in its critical section another should wait outside its critical section until former
executes task related its critical section to completion.

You might also like