Nginx Worker进程如何共享“监听套接字" [英] How does nginx worker process share the 'listen socket'

查看:225
本文介绍了Nginx Worker进程如何共享“监听套接字"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://aosabook.org/en/nginx.html 表示工人进程接受来自共享侦听"套接字的新请求,并在每个

This http://aosabook.org/en/nginx.html says that "worker processes accept new requests from a shared ""listen" socket and execute a highly efficient run-loop inside each

我查看了代码,但不了解套接字是如何共享的.主进程是否会创建一个侦听队列,进行绑定然后进行分叉?在那种情况下,操作系统如何确定将传入连接切换到哪个工作进程?是轮循还是随机?我假设不同的操作系统可能有不同的政策

I looked at hte code but did not understand how the socket is shared. Is it the case that the master process creates a listen queue, binds and then forks. In that case, how does the OS decide which worker process to hand over the incoming connection to? Is it round robin or random? I am assuming that different OS may have different policies

推荐答案

在这种情况下,操作系统如何确定将传入连接切换到哪个工作进程?

In that case, how does the OS decide which worker process to hand over the incoming connection to?

这个问题听起来很像操作系统如何决定运行哪个进程".

The question sounds exactly like "how does the OS decide which process will get to run".

http://en.wikipedia.org/wiki/Scheduling_%28computing% 29#Operating_system_process_scheduler_implementations

这篇关于Nginx Worker进程如何共享“监听套接字"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆