由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Java NIO 问题求教
相关主题
请问关于用threadPoolExecutor实现threadpool的问题?how to read from a non-return socket stream?
最近node.js real time web 很火如何快速处理上万个文件?
node.js还是tomcatRe: Client-Server and actionPerformed
Another ?: Re: Keep track # of threadsquestion on single thread & multithread
问一个基础问题如何让两个socket并行执行thread
怎么学multithreading/concurrency?新手问一个多线程的问题
Can Java thread return a value?Re: Help!!! Java in Unix. Thread. I need exit and ls concurrently runn
求教 java.lang.outofMemoryjava(1.4.2) threads: out of memory error
相关话题的讨论汇总
话题: thread话题: event话题: nio话题: request话题: model
进入Java版参与讨论
1 (共1页)
r******g
发帖数: 138
1
不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
结束才被处理获得response?
F****n
发帖数: 3271
2
Because I/O are usually highly uncertain operations.
What about one of your 10 long running job starts to wait for the device/
party it is communicating with? In the blocking model, the thread will just
wait and get totally wasted. In an asynchronous/event-based model, the
thread will hang this job and process other jobs.

thread

【在 r******g 的大作中提到】
: 不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
: concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
: long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
: for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
: pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
: 结束才被处理获得response?

w**z
发帖数: 8232
3
CPU bound 不适合 event driven

thread

【在 r******g 的大作中提到】
: 不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
: concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
: long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
: for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
: pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
: 结束才被处理获得response?

r******g
发帖数: 138
4
不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
结束才被处理获得response?
F****n
发帖数: 3271
5
Because I/O are usually highly uncertain operations.
What about one of your 10 long running job starts to wait for the device/
party it is communicating with? In the blocking model, the thread will just
wait and get totally wasted. In an asynchronous/event-based model, the
thread will hang this job and process other jobs.

thread

【在 r******g 的大作中提到】
: 不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
: concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
: long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
: for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
: pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
: 结束才被处理获得response?

w**z
发帖数: 8232
6
CPU bound 不适合 event driven

thread

【在 r******g 的大作中提到】
: 不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
: concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
: long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
: for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
: pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
: 结束才被处理获得response?

c*m
发帖数: 836
7
事实上NIO的性能的确也不比传统多线程读写差,你可以google一下,有很多文章。

thread

【在 r******g 的大作中提到】
: 不太明白Event-driven为什么比socket+threadpool model 更能处理大量request
: concurrently. 假如socket+threadpool 设置的pool size是10,而且每个thread 都是
: long running job的话, 第11个request会block。对NIO来说,尽管只有一个thread
: for event loop,每获得的event读和写也需要单独的thread来处理,如果也用thread
: pool的话并且pool size也是10,那第11个request不也是要等前面10个request有一个
: 结束才被处理获得response?

g*********9
发帖数: 1285
8
memory and thread switching are overhead for blocking model.

【在 w**z 的大作中提到】
: CPU bound 不适合 event driven
:
: thread

x*a
发帖数: 7
9
what is NIO?
w***1
发帖数: 1951
10
Compare to java.io

【在 x*a 的大作中提到】
: what is NIO?
c*********p
发帖数: 3217
11
我记得,thread 的话会有个峰值,然后性能下降.
1 (共1页)
进入Java版参与讨论
相关主题
java(1.4.2) threads: out of memory error问一个基础问题
请教:怎么把synchronize的method改成用thread 但thread safe呢?怎么学multithreading/concurrency?
NoThread concurrencyCan Java thread return a value?
core java多线程一般面试什么求教 java.lang.outofMemory
请问关于用threadPoolExecutor实现threadpool的问题?how to read from a non-return socket stream?
最近node.js real time web 很火如何快速处理上万个文件?
node.js还是tomcatRe: Client-Server and actionPerformed
Another ?: Re: Keep track # of threadsquestion on single thread & multithread
相关话题的讨论汇总
话题: thread话题: event话题: nio话题: request话题: model