开发者

Multi-process webserver vs multi threaded web server? [closed]

开发者 https://www.devze.com 2022-12-15 08:58 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing
Closed. This question is opinion-based. It is not currently accepting answers.

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 question

I 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消