Posts

Showing posts from December, 2024
This week in CST334, I got a hands-on understanding of semaphores and how they help manage synchronization in multithreaded programs. In Lab 6 I worked on the producer-consumer problem which showed how semaphores like sem_wait and sem_post can control access to shared resources. It was a great way to see how these simple tools prevent issues like race conditions or buffer overflow by ensuring only one thread accesses the critical section at a time. Running the threadSync.c program really showed how unpredictable thread behavior can be without proper synchronization. This lab was helpful in explaining the concept of semaphores for me and it was satisfying to see my code work exactly as originally intended.