MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
[MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine
On Fri, 17 Jul 1998 19:51:11 -0600
Chris Gray<cg#ami-cg,GraySage.Edmonton.AB.CA> wrote:
> I didn't quite follow all of that, but I'll ask this question: where
> does your server spend its time waiting if it has nothing to do?
> Mine spends its time in a single 'select' call, which contains the
> fd-bits for the main connection socket, and all client sockets. I'm
> not multi-threaded, so that is easy for me to do.
Did you note the performance concerns of select() vs poll() at:
http://www.kanga.nu/~petidomo/lists/mud-dev/1998Q2/msg01208.html
?
--<cut>--
There is one thing to watch out for here: if you use select(2) in your
polling loop, be aware that the size of your FD array is equal to the
value of your largest FD. This is because select(2) uses a bitmask for
its FD array. This means one of your threads will want to poll FDs 991
to 1000. Unfortunately, your FD array is still 1000 long. What's
worse, the kernel still has to do a minimal scan for all those 1000
FDs. The solution to this is to use poll(2) instead, where you only
have to pass as many FDs as you want to poll, and the kernel scans
only those.
--<cut>--
--
J C Lawrence Internet: claw#null,net
(Contractor) Internet: coder#ibm,net
---------(*) Internet: claw#under,engr.sgi.com
...Honourary Member of Clan McFud -- Teamer's Avenging Monolith...
- Thread context:
- [MUD-Dev] Re: DBMS in MU*'s, (continued)
- [MUD-Dev] Design Patterns for Concurrent, Parallel, and Distributed Systems,
Alex Oren alexo#bigfoot,com, Sun 19 Jul 1998, 08:32 GMT
- [MUD-Dev] Re: [CODE] [LANGUAGE/PLATFORM SPECIFIC] My Event Engine,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Sat 18 Jul 1998, 01:51 GMT
[ Other Periods
| Other mailing lists
| Search
]