Week 29

     Week 29 has been a crazy week trying to keep up on my readings/lectures and doing midterm review. I think I'm doing okay but I would like to brush up on a few topics before the weekend.

    In chapters 26-29 of OSTEP, I learned how operating systems manage concurrency through threads, locks, and synchronization primitives. The reading started by introducing threads as independent execution units within a process that share the same address space, enabling parallelism but requiring careful coordination to avoid race conditions which are a big no no. The key challenge was ensuring mutual exclusion in critical sections, where shared resources are accessed. Simple solutions like disabling interrupts work only on single-processor systems,w hile atomic hardware instructions enable efficient spinlocks for multicore systems. However, we learned that spinning wastes CPU cycles, so OS- supported sleep/wake mechanisms like yield() are used to block threads until a lock is available.

    I further learned about condition variables. Condition variables further optimize waiting by allowing threads to sleep until a state change occurs, thus avoiding busy-waiting. Condition variables must always be paired with mutexes to prevent lost wake-ups between condition checks and blockings. I also learned about scalable data structures like approximate counters and concurrent hash tables. Performance trade-offs were emphasized, fine-grained locking improves parallelism but adds complexity, while coarse-grained locking simplifies correctness but limits scalability.

    Key takeaways for me include; always protect shared state with locks, prefer simple/ correct designs before optimizing, and use condition variables for event-based writing.

Comments

Popular posts from this blog

Week 1

Week 4

Week 2