Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Operating System Notes

Rating
-
Sold
-
Pages
13
Uploaded on
21-09-2022
Written in
2022/2023

This file consist of notes about process scheduling algorithms used in a operating system and deadlock clearly explained with diagrams

Institution
Course

Content preview

PROCESS SYNCHRONIZATION
1) What is process synchronisation?
A cooperating process is one that can affect or be affected by other processes
executing in the system. Cooperating processes can either directly share a
logical address space (that is, both code and data) or be allowed to share data
only through files or messages Concurrent access to shared data may result in
data inconsistency, hence various mechanisms has to be employed to ensure the
orderly execution of cooperating processes that share a logical address space, so
that data consistency is maintained.
2) Explain bounded buffer problem or producer-consumer problem.
Example: Producer – Consumer Problem / Bounded Buffer Problem
Producer : produces data item to buffer
Consumer : consumes data item from buffer
Let consider a shared buffer of size 5
Buffer :




 Initially Buffer is empty (consumer is not suppose to execute as buffer is
empty).
 When producer produces a data , it will be added to buffer till buffer is
full. If Buffer is full producer is not supposed to execute as empty space
is not available.
 To keep track of all these we use a variable called Counter
 Shared variable is : Counter
 Counter is initialized to 0
 If Producer access counter, it increments counter value - counter++
 If Consumer access counter, it decrements counter value - counter—

,  Let consider in buffer we have 3 items (i.e., 10,20,30)
30 20 10
 Counter size = 5
 Counter value = 3 (3 data items are added)


 Case 1: if producer produce one more item i.e., 40 then counter
value will be incremented, i.e., counter value= 4
Buffer :
40 30 20 10


Then consumes one data item from buffer, then counter value
will get decremented i.e., counter value = 3
Buffer :
40 30 20
Synchronization will be there as they are executing one after
the other.
 Case 2: vice versa (i.e., fist consumer executes and then
producer- here also sunchronization will be there.)
 Case 3 : If both Producer and consumer access counter
concurrently then it leads to inconsistent data i.e., produer
increments counter value by 1 and consumer decrements
counter value by 1 concurrently which leads to inconsistent
data.
 This problem lead to a definition called as race condition.




3) What is race condition?

Written for

Institution
Course

Document information

Uploaded on
September 21, 2022
Number of pages
13
Written in
2022/2023
Type
Class notes
Professor(s)
Prof.neena
Contains
All classes

Subjects

$8.49
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
arjunreddy

Also available in package deal

Get to know the seller

Seller avatar
arjunreddy Jain University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions