Thursday, November 28, 2024

CST334 - Week 5

Write what you learned this fifth week in CST 334

Topic: Concurrency

This week in class, we began to learn about concurrency and managing multiple threads running concurrently within a program. The challenge with running multiple threads simultaneously is that they can potentially interfere with each other. We observed this in our lab on multi-threading, for example, when multiple threads accessed a shared variable. This interference leads to race conditions, causing the program to produce unpredictable results and making the program indeterminate.

A few strategies we explored in our reading to address this issue include using locks to protect resources, ensuring that only one thread can access the data at a time, and keeping resources separate from one another. While this approach prevents multiple threads from modifying resources while they are in use by others, there are still potential issues. For example, with spin locks, a thread may spin indefinitely if it cannot acquire the lock because it is continuously denied access to the resource, which can lead to starvation.

No comments:

Post a Comment

CST462S - Service Learning Experience

With the first half of my Summer semester now coming to a close, I am submitting my final assignments and preparing for the upcoming class i...