CST334 Module 6
This week I learned about another five different topics about operating systems. The first topic was about Anderson/Dahlin method, which introduced a locking algorithm meant to ensure fairness and scalability in multiprocessor systems. Basically, the main point of this method is to have threads spin on a locally accessible flag rather than a shared variable, thus making it so that each thread gets a slot within the circular array, while avoiding cache invalidation within test and set locks. The second topic was about condition variables, which allow threads to wait for a condition to become true before proceeding with the operation or execution. Basically, condition variables are used in conjecture with mutexes to avoid race conditions, thus through operations like pthread_cond_wait(), pthread_cond_signal(), and pthread_cond_broadcast() that control the threads sleeping and waking up before receiving a signal.
The third topic was about bounded buffer coding, which was
about how condition variables and mutexes can be combined to manage a
fixed-size queue shared between producer and consumer threads. Basically,
producer threads generate items and place them within a buffer, while consumer
threads remove items from the buffer. Therefore, these threads prevent race
conditions by waiting for the buffer to be full, while also waiting until it’s
empty based on condition variables to signal availability. The fourth topic was
about semaphores, which are integer-based synchronization primitives.
Basically, semaphores have two operations that are wait() to decrement and
signal() to increment based on shared resources. Therefore, semaphores
encapsulate both exclusion and signaling in a single primitive, thus making
them very versatile in resolving resource pools or concurrent access. The final
topic was about synchronization barriers, which are barriers that synchronize
constructs to ensure all threads reach a certain point within their execution.
Basically, the barriers track how many threads arrive at a certain point mid-execution,
which requires all threads to be present before allowing them to fully execute,
thus enforcing strict alignment and preventing premature execution.
Comments
Post a Comment