At 12:13 PM 6/4/01 -0700, Tavis Rudd wrote:
>On Monday 04 June 2001 11:54, Ian Bicking wrote:
> > Tavis Rudd <[EMAIL PROTECTED]> wrote:
> > > Good idea.  I've never heard of a Stack class like this
> > > but it would be very easy to create a subclass of Queue
> > > that has LIFO rather than FIFO behaviour.  Do you think
> > > it would make much of a difference?
> > Well, what about .pop() and .append() ?  If they are
> > atomic, then they are thread-safe.  Append is atomic, and
> > I bet pop is too.  But maybe there's spiffier things that
> > the Queue class does that a Stack class could do too.
> > Queue docs specifically refer to subclassing to make a
> > Stack class.
>
>The Queue class provides support for a maximum size and
>blocking gets and puts associated with full and empty Queues.
>Subclassing Queue would provide these and should require no
>other changes to the WebKit code.  But is a Stack actually faster
>than Queue with most recently active threads in this case?
>
>Tavis

Probably only in extreme cases.  Suppose you had 100,000 threads, and you 
don't have enough RAM, so that most of them are swapped out to disk.  Then 
clearly you're better off re-using a few threads over and over instead of 
cycling through all the threads and constantly having to swap them in and 
out to disk.  Stack will reuse the same threads as much as possible, while 
Queue will cycle through all threads.

In a real-world scenario with only 20 threads or so, I would hope you have 
enough RAM that this is a non-issue.  You still might gain a small cache 
benefit from re-using the latest thread instead of cycling through 
them.  But I doubt it would be measurable.


--

- Geoff Talvola
   [EMAIL PROTECTED]

_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to