Re: [RFC] Fibers
| From: | tyson andre | Date: | Mon, 21 Dec 2020 23:59:23 +0000 |
| Subject: | Re: [RFC] Fibers | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112582@lists.php.net to get a copy of this message | ||
Hi Mike Schinkel,
> This is interesting, and potentially very useful.
>
> I am curious about how you propose access to shared memory across fibers? What will happen if
> two fibers try to update a $GLOBALS variable at the same time? Or a property of the same object?
> How will developers manage that?
(I started writing this before Aaron sent a different response)
[Concurrency is not parallelism](text of https://blog.golang.org/waza-talk , not the video),
and this RFC isn't adding parallelism to php.
Instead, the RFC is a proposal to make concurrency easier.
The rfc announcement email says that "fibers exist within a single thread".
A fiber would have to explicitly release control to the scheduler after modifying a $GLOBALS
variable, etc.
As I understand it, this proposal is similar to how concurrency works in node for code written in JS
- https://stackoverflow.com/questions/29977049/how-does-concurrency-work-in-nodejs
(in that there's only one thread, but it's different in that scheduling is done manually)
Thanks,
- Tyson