Skip to content

Commit db4c0c5

Browse files
authored
Discuss concurrency vs parallelism, taking inspiration from javascript (#176)
1 parent a9dc137 commit db4c0c5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# ignore
22

3-
You can read about concurrency in Wren [in the manual][concurrency].
3+
## Concurency vs. Parallelism
4+
5+
Wren provides _concurrency_ via a construct called _fibers_.
6+
From the Wren manual:
7+
8+
> Fibers are a bit like threads except they are cooperatively scheduled.
9+
> That means Wren doesn’t pause one fiber and switch to another until you tell it to.
10+
11+
Wren's execution is single-threaded so we don't actually get _parallelism_.
12+
13+
Here's a quick definition for each that illustrates the diferences between the two:
14+
15+
- Concurrency is when two or more tasks can start, run and complete in overlapping time periods, being executed by the same processing unit.
16+
- Parallelism is when two or more tasks can start and run at the same time, being executed independently of eachother by separate processing units.
17+
18+
Read more about [concurrency in Wren][concurrency].
419

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

0 commit comments

Comments
 (0)