top | item 36405233

(no title)

lvkv | 2 years ago

> This means it’s not possible to race data, dead lock, live lock, etc. While this statement is true when you look at fibers as a N:1 proposition

Deadlocks are still possible when using fibers backed by a single thread if you serialize your fiber execution. Here’s an example I’ve seen in the wild:

Imagine a serialized job server implemented with fibers that, when closed, waits for all jobs to finish by posting a final bookend job and waiting for it to finish. This works, unless you decide to close the server inside one of your serialized jobs—you’ve now created a deadlock where your job server is waiting for itself to finish closing.

I’m sure an N:1 deadlock is also possible without serialization, but I can only think of contrived examples.

discuss

order

No comments yet.