Module 6 - CST334

 This week, we dug deeper into the power and flexibility of semaphores in managing concurrent access and preventing synchronization issues like deadlock. One of the key lessons was how even a seemingly simple bug, like the placement of a mutex in a bounded buffer, can lead to deadlock if critical sections aren't well defined. We learned that scoping locks precisely is crucial.

We also explored reader-writer locks, which allow multiple readers to access shared data at the same time while still giving writers exclusive access. This kind of fine-grained control is powerful, though we saw that it can lead to potential writer starvation if not carefully managed.

The dining philosophers problem gave us a view of how deadlock can occur in real systems. The solution, which was changing the order in which one philosopher picks up forks, was surprisingly simple and very effective, showing how breaking circular wait can prevent deadlock entirely.

We also looked at thread throttling, where a semaphore can be used to limit the number of threads that enter a resource-intensive region. This was a practical technique for managing system load and avoiding thrashing.

Also, we looked at what it takes to implement a synchronization primitive built from locks and condition variables. It can work well, but can come with limitations, like not supporting negative values.

We also looked into other types of concurrency bugs other than deadlock. One example was atomicity violation, where atomicity is not enforced during execution. Another is order-violation bugs, where the desired order between two groups of memory accesses is flipped.


Comments

Popular posts from this blog

Journal Week 4

Week 5: CST438 Journal

This week