100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Operating System Notes $7.99   Add to cart

Class notes

Operating System Notes

 0 view  0 purchase
  • Course
  • Institution

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

Preview 2 out of 13  pages

  • September 21, 2022
  • 13
  • 2022/2023
  • Class notes
  • Prof.neena
  • All classes
avatar-seller
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?

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller arjunreddy. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $7.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81113 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.99
  • (0)
  Add to cart