Skip to content

Commit

Permalink
Discuss concurrency vs parallelism, taking inspiration from javascript (
Browse files Browse the repository at this point in the history
  • Loading branch information
glennj authored Feb 28, 2024
1 parent a9dc137 commit db4c0c5
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# ignore

You can read about concurrency in Wren [in the manual][concurrency].
## Concurency vs. Parallelism

Wren provides _concurrency_ via a construct called _fibers_.
From the Wren manual:

> 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.
Wren's execution is single-threaded so we don't actually get _parallelism_.

Here's a quick definition for each that illustrates the diferences between the two:

- Concurrency is when two or more tasks can start, run and complete in overlapping time periods, being executed by the same processing unit.
- Parallelism is when two or more tasks can start and run at the same time, being executed independently of eachother by separate processing units.

Read more about [concurrency in Wren][concurrency].

[concurrency]: https://wren.io/concurrency.html

0 comments on commit db4c0c5

Please sign in to comment.