5th Week: CST 334

Hello, hello!





The holidays are coming, and Thanksgiving is finally here! This week’s module was on concurrency and threads. We learned the difference between processes and threads, noting that threads share the same address space but have their own program counters and stacks.

We learned about thread APIs like pthread_create and pthread_join for thread creation and management. We also looked at issues that can occur with multithreaded processes, such as race conditions and solutions like locks and condition variables. Locks ensure mutual exclusion by preventing race conditions when threads access shared data. The book explained that race conditions can lead to indeterminate results, where outputs vary unpredictably, as we observed in Lab 5.

We studied the section concurrent data structures, which explains how to solve race conditions and make data structures safe for multiple threads by using locks. Examples included synchronized counters, concurrent linked lists, and concurrent queues where locks protect critical sections of code. Methods like adding one lock per bucket in a hash table or using separate locks for enqueue and dequeue operations in a queue improve performance and reduce errors.

This Thanksgiving, I give thanks for everything I have learned so far and for having amazing teachers.

Comments

Popular posts from this blog

CST438 Software Engineering: Week 8 (Final week)

CST438 Software Engineering: Week 1

CST370 Week 5