Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sergey Zhuk:
Managing Concurrency: From Promises to Coroutines
Oct 31, 2018 @ 19:56:57

Sergey Zhuk has a post to his site covering concurrency including some of the basic concepts and how promises and coroutines come in to play.

What does concurrency mean? To put it simply, concurrency means the execution of multiple tasks over a period of time. PHP runs in a single thread, which means that at any given moment there is only one bit of PHP code that can be running. That may seem like a limitation, but it brings us a lot of freedom. We don’t have to deal with all this complexity that comes with parallel programming and threaded environment. But at the same time, we have a different set of problems. We have to deal with concurrency. We have to manage and to coordinate it.

He goes on to talk about parallel requests, cross-request needs and the requirement for coordination. He then covers the subject of promises, briefly defining it and giving an example of creating a basic promise in ReactPHP. Following this he talks about the other main topic of the article: using PHP generators along with parallel requests to only create the responses when yielded.

tagged: reactphp promise coroutine concurrency management

Link: https://sergeyzhuk.me/2018/10/26/from-promise-to-coroutines/


Trending Topics: