>> Forum: comp.unix.programmer >> Thread: How can I multiple read() through multiple threads? >> Message 2 of 2 Save this thread back to search results Subject: Re: How can I multiple read() through multiple threads? Date: 12/17/1999 Author: Dan Kegel << previous in thread กค next >> Hongki Lee wrote: > I have some socket questions about socket reading performance. > Is it possible below? (This is my first question.) Welcome aboard... > 1. Two or more select() with each having a area socket id. > 1 thread has select() with socketid range 3~500 > 2 thread has select() with socketid range 501-1000 > > 2. 1 select() with multiple reading threads. > 1 thread has select() with whole socketid range(eg. 3-1024) > 2,3 threads have each reading operation from socketid queue > that 1 thread put the socket id into it when select() occurs > a reading event. ... (kind of thread pool.) > > Finally, I wonder which method is faster. > 1. 1 thread reading with select() > 2. above no .1 > 3. above no .2 > or another socket implementation methods that you know. A few thoughts: On a multi-processor machine, you probably want to have more than one thread (else you won't be using all the processors). If you'll need to access the disk to serve the clients, you probably want to have more than one thread (else you'll have to wait for disk reads). On some Unixes, poll() may be faster than select(). On Linux, you can go even faster by using SIGIO and asking for extended signal info. See http://www.kegel.com/c10k.html - Dan -- (The above is just my personal opinion; I don't speak for my employer, except on the occasional talk show.)