Re: RBTree implementation and thread structure

"Salvatore Benedetto" <[email protected]> Sun, 13 Apr 2008 08:39:11 +0000
Newsgroups gmane.os.openbeos.kernel.devel
Message-ID <[email protected]>
On 13/04/2008, Ingo Weinhold <[email protected]> wrote:
>
>  On 2008-04-12 at 23:43:24 [+0200], Salvatore Benedetto <[email protected]>
>  wrote:
>
> >
>  > I have two quick questions.
>  >
>  > First: do we have a red and black tree class implementation that I
>  > could use in the scheduler? Just wondering, not actually doing any
>  > coding yet.
>  >
>  > I see we have a AVLTreeMap class implemented by Ingo, but looks like
>  > it's not used anywhere.
>
>
> It is actually used in my ramfs. That's where it originally comes from. The
>  instantiated code is quite big, though, so one might consider trimming the
>  class (i.e. make it less flexible, use a non-templatized base class, etc.).

Weird. It doesn't show up with cscope. What about the RBTree class?
Any plan to add one?

>
>
>  > Second: I'm trying to understand the thread structure and I can't find
>  > anything in the BeBook. What are these next_* fields for?
>  >     int32           priority;
>  >     int32           next_priority;
>  >     int32           state;
>  >     int32           next_state;
>
>
> They contain the next values for the respective non "next_" fields, which will
>  be set when a running thread is unscheduled. I believe that's really only
>  needed for SMP support. Otherwise one could just set the thread state/priority
>  directly, since unless it was the current thread, the target thread would never
>  be running.

I'm still trying to figure out if that's really necessary. Thanks anyway.

>
>  CU, Ingo
>

Regards,
-- 
Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa
www.haiku-os.it

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone