Operating Systems Week 6
This week we continued discussing concurrency, including topics such as semaphores as well as some common bugs found in concurrency and how to counter them. Semaphores are objects with a counter that can be used for synchronization in applications implementing concurrency. Two important functions that can be used to manipulate the semaphore counter are "sem_wait" which decreases the counter, and "sem_post" which increases the counter. Semaphores can also be initialized with a value of one to act like a mutex. Later in our lectures we learned about some common bugs that I've unfortunately had to encounter and debug on a few occasions. Some of these bugs in include deadlock bugs, atomicity-violation bugs, and order-violation bugs. Deadlocks can occur when a thread is waiting forever on a thread that has acquired a lock, compared to atomicity violations where a thread may access and corrupt the resources needed by another thread, or order violations where threads are ran out of order resulting in unexpected results. Most of these bugs can be resolved by properly implementing mutual exclusion, and using condition variables..
Comments
Post a Comment