Skip to contentSkip to conversation

Yet another I/O modeling

DISCUSSION Neil 2 participants 2 messages Feb 27, 2005 – Feb 28, 2005

lore
Share & tools
lore

Neil

author
#0 lore raw

hi,all
select/poll I/O modeling is fast,easy to use,it returns the number of fd which are acitvity,but you should scan the fd array to find which fd is ready,it costs a lot of time on a heavy load server.

I proposal another I/O modeling,named eselect.
struct eselect_struct{
unsigned long readbitmap[MAXBITMAPFD];//suppose the MAXBITMAPFD is
MAX OPEN //FD NUMBER PER PROCESS
int ret;//-1 on error,non-negative return value is the number of

           //acitvity fds
}

we can use __set_bit(),__clear_bit(),__find_first_bit()....functions to maintain the bitmap. So,you shouldnt scan the fd array any more.

#1 lore raw

Quoting Neil <[email protected]>:

Quoted 5 lines

hi,all
select/poll I/O modeling is fast,easy to use,it returns the number of fd which are acitvity,but you should scan the fd array to find which fd is ready,it costs a lot of time on a heavy load server.

Quoted 10 lines

I proposal another I/O modeling,named eselect.
struct eselect_struct{
unsigned long readbitmap[MAXBITMAPFD];//suppose the MAXBITMAPFD is
MAX OPEN //FD NUMBER PER PROCESS
int ret;//-1 on error,non-negative return value is the number of
//acitvity fds
}
we can use __set_bit(),__clear_bit(),__find_first_bit()....functions to maintain the bitmap.
So,you shouldnt scan the fd array any more.

I really don't see why __find_first_bit() is better than "scan the fd array". They both seem like O(N) operations. You might be dividing the tests by 32 (or
64) but in a busy server with 3000 open sockets, what you really want is no scanning at all.

Anyway, your problem is already solved. You should check epoll:

http://epoll.hackerdojo.com/

It's been in the kernel for a while, now (with CONFIG_EPOLL=y).

--
Paulo Marques - www.grupopie.com

All that is necessary for the triumph of evil is that good men do nothing. Edmund Burke (1729 - 1797)