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 เคชเคขเคผเฅ เคเคพเคคเฅ เคนเฅเค:
- Producer-Consumer Problem
- Dining Philosophers Problem
- 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)
| Problem | Main Issue | Concept |
|---|---|---|
| Producer-Consumer | Buffer control | Data sharing |
| Dining Philosophers | Deadlock | Resource sharing |
| Readers-Writers | Data consistency | Read/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 เคเคฐเคจเฅ เคเคพ เคคเคฐเฅเคเคพ เคฎเคฟเคฒเคคเคพ เคนเฅเฅค