[Home] [Groups] - Message: [Prev in Group] [Next in Group]
12399: Re: [MUD-Dev] Event Scheduling
[Full Header] [Plain Text]
From: cg@ami-cg.GraySage.Edmonton.AB.CA
Newsgroups: nu.kanga.list.mud-dev
Date: Tue, 8 Feb 2000 19:17:54 -0700
Organization: Kanga.Nu
[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@ami-cg.GraySage.Edmonton.AB.CA
http://www.GraySage.Edmonton.AB.CA/cg/
_______________________________________________
MUD-Dev maillist - MUD-Dev@kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev