Chapter 8. Multicasting in RxPHP and PHP7 pthreads Extension
To make use of multiple CPUs and multiple cores, we've been using subprocesses. This is, of course, a very easy and safe method to run code in parallel. In combination with Unix sockets, we can make inter-process communication happen with ease. In the previous chapter, we combined all of this with RxPHP to make applications that were completely separated and run in parallel.
In this chapter, we'll have a look at a very interesting PHP7 extension called pthreads
, which allows multithreading in PHP using POSIX threads.
In particular, this chapter will cover the following topics:
A deeper look into the
Subject
class and its variants.Multicasting operators in RxPHP and all its derivatives
Examples of
ConnectableObservable
andMulticastObservable
Using a single instance of the Subject with multiple source Observables
Basics of multithreading in PHP
Notes on today's state of the
pthreads
extension, its two major versions, and its current practical...