CST334: Week 6 Learning Journal
The topics that were extensively covered this week were rendezvous synchronization, semaphores as signaling mechanisms, and as locks, counting threads in a shared state, barrier synchronization problem, differences between semaphores and condition locks, and practical debugging using the topics mentioned earlier.
Rendezvous synchronization is when two threads do not continue any further until both of the threads are at the meeting point. Semaphores as signaling mechanisms work by using a numerical signal, waiting until the other threads see the signal before continuing. Using a semaphore as a lock, or mutexes, set to a numerical 1, only lets a single thread inside at a time. Counting threads in a shared state means sharing a count variable, counting how many threads are at the barrier. This will be using a mutex in order to protect the hookup. The synchronization barrier problem is a generalization of rendezvous synchronization, where it works for N amount of threads instead of just the two. No thread will proceed until every thread has arrived. Turnstiles in concurrency are where, once the last thread has arrived, the barrier begins to let in threads one at a time. A reusable barrier resets itself so that it can later be used. This is done through balancing semaphore wait and signaling operations. Thread safety and race conditions, locking processes, so shared data cannot be accessed, therefore reducing the risk of data being corrupted. Tracking semaphore values is important; being able to know which value the barrier will land on is important to knowing if your barrier will reset correctly and that you have set up proper semaphore values. Semaphores and conditional variables are used to provide synchronized access to shared data.
The most difficult understood topic for me was reusable barriers and balancing wait/signal operations. The more difficult part was understanding why the barrier needs to be initialized to 0, and once the barrier ends, its value is 1 unless it resets. The most understood topic for me was the rendezvous pattern. It's very simple: two threads that wait for each other to arrive at a certain point before continuing on.
One question I have is, could reusable barriers lead to cyclic barriers?
Connections I see are operating systems, where thread scheduling and process synchronization are vital for a functional operating system. Another connection I see is networking, working with thread pools, connection handlers, etc.
Comments
Post a Comment