Multi-process webserver vs multi threaded web server? [closed]
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed last year.
开发者_C百科 Improve this questionI would like to know why we prefer to make web servers multi-threaded
instead of make it multi-process web servers ....
Is it because of legacy issues.....
I would like to hear practical reasons as well as theoretical reasons
On *nix, to start up a process you need duplicate all the resources of the parent process. All the parents file descriptors are dup'ed, for example, and a new memory space is created to contain the new process. When the process terminates everything has to be torn down.
A thread, on the other hand, is essentially just a stack. Very quick to start and stop.
Early web servers didn't use threads for a simple reason: they weren't implemented yet.
Threads are usually cheaper than processes.
精彩评论