here is the ideA: we want to map fd to pointers to an object. the search has to be *FAST*. the fastest search method is the binary search on an array. add user event only happens every so often, but lookups happen more often. so we do this: typedef struct map { int fd; Obj *o; } map; then create an array (dynamic, or whatever): map users[500]; then we keep this array sorted according to the 'fd' variable. when we need to do a lookup we do a binary search on the array for 'fd' then we have our match.