Operating Systems Week 5
This week we delved into the topic of threading, touching on concepts such as locks, parallelism versus concurrency, criteria that makes a good lock, as well as different types of spin locks. With the introduction of threading, we are able implement greater efficiency into our programs by using multiple threads across different CPU cores in parallel. However, we are still able to run threads concurrently by switching between them. Though I have already experienced the need for locks in multithreaded programming, I would learn more about locks and how to rate their effectiveness later in our lectures. Implementing parallelism into our programs leads to multiple threads wanting to access a shared variable. To prevent threads from competing for this critical section we must implement locks, which should ensure mutual exclusion. In our class discussion and in the lecture, I explored the different types of spin locks and identified their criteria. Where a simple spin lock may waste time by repeatedly doing nothing but spinning to check a lock state, a ticket lock seeks to implement fairness by allowing equal access to the lock for each thread that requests it, in the order they request it. Compared to a simple spin lock, a ticket lock fulfills more of the lock criteria by implementing mutex and fairness.
Comments
Post a Comment