[MUD-Dev] Event Scheduling

cg at ami-cg.GraySage.Edmonton.AB.CA cg at ami-cg.GraySage.Edmonton.AB.CA
Tue Feb 8 19:17:54 New Zealand Daylight Time 2000


[J C Lawrence:]

> Mine is written in C++, with a standard STL priority queue for
> pending events in botht he Dispatchor and Executor, and short
> circuit evaluation (ie never hits the priority queue) for those
> incoming entries that are adjudged as being already ripe, or will be
> ripe by the time they reach a waiting thread (if a thread is ready).
> This saves the (occassionally) non-trivial insertion cost as well as 
> lock contention on the queues.

Do you handle any currently-ripe entries in the queue before any new
tasks that are immediately ripe? You likely want to do that to avoid
starvation in cases of server overload.


I didn't reply to the original question, since my event queue is simply
a sorted linked list, hence my insert time is O(n), and my delete time
is O(1). Manipulation of that queue has never shown up in my profiling,
however - it's time is tiny compared to actually executing the events.

--
Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg at ami-cg.GraySage.Edmonton.AB.CA
               http://www.GraySage.Edmonton.AB.CA/cg/



_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev



More information about the MUD-Dev mailing list