PHPNW12

Fork It! Parallel Processing in PHP

Most computers these days have more than one processor or core. Why then do we normally only use one of them at a time to run our PHP processes? Furthermore, how can we use PHP to write long running background processes. PHP has process control support in unix environments through the PCNTL extension. Running multiple PHP processes can lead to some unexpected behaviour so there are a few patterns to follow to avoid the pitfalls. Once you have multiple PHP processes running you will probably want to make them talk to each other. We will look at the various techniques for inter process communication. Finally we will look at what turns out to be the hardest part of parallel scripts namely thinking about your problems in a parallel way. I will try and offer some tips on how to start doing this and go about getting more work done at the same time.