-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
事件循环处理的自身代码在哪个线程上执行? #8
Comments
主线程。JS代码和事件循环都是在主线程之行。 |
谢谢! 在 2016/6/21 15:06, Jackson Tian 写道:
|
嗯。 关于费时的定义,可以参见: https://gist.github.com/jboner/2841832 |
好的。 在 2016/6/21 15:17, Rila 写道:
|
数据库异步操作本质是网络异步操作,在TCP上根据协议封装操作而已。对调用方来说 没有什么特别的地方。 客户端实现上倒是有些细节比较有意思。 我会在第二版中加入这方面的内容。 |
ok。 在 2016/6/21 17:01, Jackson Tian 写道:
|
TCP。不用IO线程池。 |
感谢您耐心的回复,打扰到您了。 我注意到《libuv doc》上的一段话: 在 2016/6/21 17:52, Jackson Tian 写道:
|
socket操作使用epoll/kqueue,就在主线程上操作。 |
如您所讲,epoll和IO线程池没有直接关系,前者由内核提供,负责多路IO复用, 在 2016/6/22 14:07, Jackson Tian 写道:
|
之前有看过netty的实现思路,感觉跟这里的磁盘IO的处理机制差不多,虽然他处理的是网络IO操作,事件的操作只能在单线程中操作。 |
题目中 自身代码 指的是,创建主循环,从观察者中取请求对象等操作。
按我的理解,不可能在IO线程池中,是在js主线程还是node的其他线程?
另外,callback肯定在js主线程上执行,那么时间循环应该不包括callback的执行吧。
请教了。
The text was updated successfully, but these errors were encountered: