This week in CST334 we learned about concurrency and the challenges that can come with using threads. In this weeks lab, I saw firsthand how threads can run independently but on the other hand how things can go wrong when they share data. In the first program the threads didn't always get the correct values because they were sharing the same variables which would lead to inconsistent results. After fixing the program by giving each thread its own isolated copy of the data everything would work as expected. This showed how important it is to manage shared resources properly and plan ahead when working with multithreaded programs. It was a great way to understand how to handle concurrency better.

Comments

Popular posts from this blog