Copied Value
Let's learn the simple copied value concurrency pattern.
We'll cover the following
In parallel programming, we can come across situations where different threads need the same resource. This can result in a race condition as the two threads compete for the same resource. To avoid consistency issues, we need to synchronize it. This problem can be solved using OS concepts like mutex locks, but those are not covered in the scope of this course. In this lesson, we’ll learn how the copied value pattern can solve our synchronization problem.
According to the copy value pattern, the thread should receive its data by copy and not by reference.
Let’s take a look at its code.
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy