Journal Entry Week 5- CST334

This week in CST 334, I spent time getting comfortable with concurrency and threading, specifically using pthreads in C. One major realization was seeing how concurrent programming dramatically boosts application performance and usability. A simple, relatable example is how web browsers manage tasks simultaneously. You can smoothly scroll, click, and navigate websites, while downloading files or loading content continues in the background without causing delays or freezing the interface. Practicing with pthreads helped me understand core functions such as pthread_create, pthread_join, pthread_mutex_lock, and pthread_mutex_unlock. Learning the purpose of each function parameter and seeing how they impact thread management made the concepts clearer and more intuitive. Also, I noticed that while locks are essential for maintaining data consistency, improper usage can introduce overhead and reduce performance if not handled thoughtfully.

The part I found particularly valuable this week was gaining a deeper understanding of why locks are essential in concurrent programming. Race conditions occur when multiple threads access shared resources at the same time, leading to unpredictable outcomes. To prevent these issues, I learned about mutual exclusion and critical sections, which control thread access to ensure safety. By implementing locks in my code, I got hands-on experience with managing these scenarios effectively. I also came to appreciate why hardware-specific instructions, such as test-and-set operations, are often employed to guarantee lock reliability. Additionally, working with condition variables to coordinate thread communication provided practical insights, especially when building a bounded buffer. This exercise reinforced the importance of synchronization for creating efficient, reliable concurrent applications.

Comments

Popular posts from this blog

My Educational and Career Goals

Week 5 Learning Journal

Learning Journal – Week of May 11, 2025