lthread icon indicating copy to clipboard operation
lthread copied to clipboard

Can using aio instead of multi-threading for asynchronous I/O?

Open liexusong opened this issue 10 years ago • 3 comments

I think using aio better than multi-threading.

liexusong avatar Dec 16 '14 06:12 liexusong

I just ran two primitive tests with stdio and a simple complexity calculation of O(1). 100 threads were started using pthreads and lthreads. So, user time: pthreads: ~270ms, lthreads: ~600ms and sys time: 650/350ms accordingly. I want to ask the lthreads community, have you tested the speed of the library in real projects, in particular, have you built an asynchronous server?

TheReverberation avatar Jan 19 '21 16:01 TheReverberation

It is because that context switch needs time. I think lthread is not an out-of-the-box project. It must be changed before being applied. For example. The computed tasks and defer tasks should be separated into other pthreads.

wanghaEMQ avatar Mar 30 '22 09:03 wanghaEMQ

@TheReverberation 100 pthreads VS 100 lthreads? or more than 100 lthreads in 100 pthreads? Maybe you can show your code.

wanghaEMQ avatar Mar 30 '22 10:03 wanghaEMQ