Week 29: CST 334 - Operating Systems
WK05: Weekly Learning Reflection
This week we covered four main topics: Concurrency, Thread API, Locks, and Lock-based Data Structures. Concurrency introduced the idea that multiple tasks can overlap in time, even if only one runs at a time on a single CPU. I learned how unpredictable a program can become when threads share data without proper control, and how race conditions appear when two threads access the same data at the same time. The Thread API section helped me understand how threads are created, joined, and managed in code. I liked seeing how these functions make it possible for a single process to do many things at once, as long as we handle synchronization carefully.
Locks were one of the most interesting topics. A lock prevents multiple threads from entering the same critical section at the same time, which helps avoid corrupted data. However, it also made me realize that using locks correctly is not always simple. We must think about fairness, performance, and what happens if a thread never releases the lock. Then in Lock-based Data Structures, we explored how queues, lists, and other structures can be made safe for concurrent use. The challenge here is not only protecting data, but also doing it efficiently so threads do not waste time waiting.
The part I still find confusing is balancing correctness and performance. I understand how locks work, but I don't always know which lock design is best or how fine-grained a lock should be. For example, a single lock makes coding easier but slows the whole program, while many small locks improve performance but increase complexity. I want to practice more examples to better understand this trade-off.
My "aha" moment was realizing how all four topics connect - threads create concurrency, locks control it, and data structures must be designed with both in mind. I think future lessons may cover alternatives to locks like lock-free programming or condition variables. I also see how this relates to previous units on memory and processes, because threads share the same space and must coordinate carefully. I plan to review by sketching diagrams of lock behavior, since visual structure helped me last week with paging.
Comments
Post a Comment