Kodeco Forums

Video Tutorial: Introducing Concurrency: Series Introduction

Find out what's covered in our Introducing Concurrency video tutorial series.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4034-introducing-concurrency/lessons/1

Great introduction to concurrency, probably the best I’ve seen to date.

1 Like

Hi Sam! In the race condition part, When Thread 1 reads after Thread 2 writes(w2), the thread 1 adds one and writes one but the memory value is still 2. Should it be 3 ?

Hi memetcircus,

I’m not sure I understand your question. The example demonstrating the race condition starts at 04:10 - two threads are attempting to increment a single value. Incrementing involves reading from the memory location, adding 1 and then writing back to memory. In the race condition example, two threads read from the memory, but then one of them gets paused whilst the other one completes the incrementing.

The problem is that thread 1 has already read from the memory, so when it gets a chance to increment and write back to memory, it’s performing the operation on an outdated value. This is a concise (if slightly contrived) example of a race condition.

Hope that helps clear up the explanation a little

sam

Thank you Sam, outdated value is the key.

1 Like

Hi Sam,

Do you have plans to update the Concurrency tutorials in Swift 3 ? It will be great help.

Thanks,
Darshan

1 Like

Hi @darshan,

They are being updated by @audrey right now. I’m not too sure on the release schedule, but they’ll be all updated for Swift 3, and have much better explanations of the challenging bits. Hopefully won’t be too long before you can get hold of them.

sam

the update is scheduled to go live in the first week of December - not long now!