I'm trying to write an application server in python. I have a master process and multiple worker processes created from the master using fork(). I have two approaches in mind about how the workers should handle request data.
- Using pipes pass data received by the master using accept() to an idle worker. The worker receives the data, processes it and sends data through another pipe back to the master which sends it back to the client.
- Since the workers inherit the listening socket file descriptor from the master, make each worker call accept(). In this case, I'm assuming the kernel will decide which worker the data should be given to.
What are the pros and cons to the above two approaches?