You are viewing a single comment's thread from:

RE: Wren in action. A quick guide through a non-trivial Wren example.

in #eos8 years ago (edited)

Thanks! I did a quick post on Wren but didn't quite get into fibers. So what makes a fiber different than an instance? Is it more like an execution of the ask method on it until a terminating condition in this case? (Not sure I asked that very well...)

Sort:  

Fibers resemble threads in Java, with one important exception: they do not race against each other so their behavior is deterministic.

This is how Wren's creator explains it:

Fibers are a bit like threads except they are cooperatively scheduled. That means Wren doesn’t pause one fiber and switch to another until you tell it to.

More details can be found here.

My understanding is that at a given time only one fiber is active and all other fibers are waiting until the current one yields control. But I might be wrong about it, as the chapter describing fibers is titled Concurrency, which actually means the opposite:

Concurrence: the fact of two or more events or circumstances happening or existing at the same time.