As Chris Dodd summarized "you use whatever technique is appropriate for the problem you are trying to solve". But to give little context I would like to quote few general considerations to pick a multi threaded / process approach.
When you are not intending to do either of the things, still you are having a single thread in execution where you are performing polling operations. That sever might with stand low to moderate traffic but lets suppose you are receiving more and more requests, entire load is fell on single thread while there is possibility to offload work to idle threads (threads in cpu context). So this opens up a path to multi threaded/process approach.
By creating a new thread (in the process) you are creating a new execution flow which runs in parallel to all the earlier (created) threads. The advantages of picking new threads over process is all the threads share same heap and global memory making inter thread communication easy. Loosely speaking you want to pick thread approach when you just want to run the same code snippet to serve all the clients.
But lets suppose each request you are serving requires running all together a different program and there is no complex communication between parent and child process you are better off creating a new process.
To conclude you might come across a scenario where the main process does pooling and it spawns few child process and child process creates multiple threads thus using all the three things at once. So pick the thing that best suits for the purpose.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…