Classical Problems of Synchronization

Introduction (परिचय)

हमने पढ़ा कि multiple processes shared resources use करते हैं और synchronization जरूरी होता है।

लेकिन real systems में कुछ standard problems बार-बार आती हैं, जिनसे synchronization techniques को समझाया जाता है।

इन्हीं को कहते हैं:
Classical Problems of Synchronization

Classical Problems क्या होते हैं

ये predefined problems हैं जो process synchronization और coordination को समझाने के लिए use की जाती हैं।

Main Classical Problems

इस topic में मुख्यतः 3 problems पढ़ी जाती हैं:

  1. Producer-Consumer Problem
  2. Dining Philosophers Problem
  3. Readers-Writers Problem

अब हम एक-एक करके detail में समझते हैं।

1. Producer-Consumer Problem

Concept

  • Producer data बनाता है
  • Consumer data use करता है
  • दोनों के बीच buffer होता है

Problem

  • अगर buffer full है → producer wait करेगा
  • अगर buffer empty है → consumer wait करेगा

Example

  • Producer → data create करता है
  • Consumer → data consume करता है

Main Issue

  • Synchronization जरूरी है
  • Buffer का overflow या underflow avoid करना होता है

Solution Idea

Semaphores का use:

  • empty → buffer empty slots
  • full → buffer filled slots
  • mutex → mutual exclusion

2. Dining Philosophers Problem

Concept

  • 5 philosophers table पर बैठे हैं
  • हर philosopher को खाने के लिए 2 forks चाहिए

Problem

  • हर philosopher एक fork उठा लेता है
  • लेकिन दूसरा fork नहीं मिलता

Result: सभी wait करते रह जाते हैं

Issue

  • Deadlock
  • Starvation

आगे हमें इन्हें पढेंगे |

Solution Idea

  • Resource allocation control करना
  • एक समय में सभी को fork न लेने देना

3. Readers-Writers Problem

Concept

  • Readers → data read करते हैं
  • Writers → data modify करते हैं

Problem

  • Multiple readers allowed
  • लेकिन writer के समय कोई reader नहीं होना चाहिए

Issue

  • Data inconsistency
  • Synchronization problem

Solution Idea

  • Readers को parallel allow करना
  • Writer को exclusive access देना

Comparison (Quick Revision)

ProblemMain IssueConcept
Producer-ConsumerBuffer controlData sharing
Dining PhilosophersDeadlockResource sharing
Readers-WritersData consistencyRead/Write control

Important Concepts Covered

इन problems से हम सीखते हैं:

  • Mutual Exclusion
  • Deadlock
  • Starvation
  • Synchronization

Real Life Understanding

  • Producer-Consumer → factory system
  • Dining Philosophers → limited resources sharing
  • Readers-Writers → library system

Exam Focus Points

  • तीनों problems के concept
  • Problem क्या है
  • Solution idea (Semaphore based)
  • Deadlock और starvation

Conclusion

Classical Problems of Synchronization Operating System के important case studies हैं, जो synchronization techniques को practically समझने में मदद करते हैं।

इनसे हमें real-life system problems को solve करने का तरीका मिलता है।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top