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 queu...