CST 334 - Learning Journal Week 5
This week we covered a bunch of topics: threads, pthreads functions, locks, race conditions, critical sections, condition variables and how hardware plays a role in making this all work. Concurrency - a way to let multiple parts of a program make progress at the same time, improving speed and responsiveness. Understanding the main pthreads was not to bad but the parameters were a bit confusing. It's easy to pass the wrong thing or forget that threads don't automatically share the context you expect them too. It is very important to remember that when a thread is run, you have to pass the arguments carefully or share data. Locks were a concept that is easier to grasp than threads. For locks we discuss race conditions, mutual exclusion and critical sections. This made it easier to understand that when two threads are run at the same time the output is generally different each time unless you add a mutex near the critical section which will fix it. Condition variables are still confusing. I understand that they let threads wait for something to change instead of constantly check a condition in a loop but I am unsure how the exact sequence of locking, waiting, unlocking, and signaling is. I still need to re-read this section and watch the lecture again to grasp a better understanding. Another concept that is still difficult for me to understand is the hardware concepts. Such as how CPUS provide special atomic instructions for building locks like I get the why but its hard to understand what is happening inside the processor. The concepts of race condition and mutual exclusions were topics that made the most sense this week.
Comments
Post a Comment