Re: AVL trees vs. Red-Black trees

Oliver Xymoron (oxymoron@waste.org)
Sun, 28 Nov 1999 09:40:36 -0600 (CST)


On Sun, 28 Nov 1999, Jamie Lokier wrote:

> Oliver Xymoron wrote:
> > > If somebody find this interesting I can provide a patch to add the
> > > include/linux/rbtree.h and lib/rbtree.c that will provde rbtree support.
> >
> > I'd like to take a look at this, I've been looking at putting some more
> > uniform tree structures in the kernel (post 2.4).
>
> fwiw, I did a splay tree (aka. self-adjusting tree) for similar reasons
> that anyone is welcome to take a peek at. The self-adjusting property
> should theoretically provide cache-like behaviour when most of the
> lookups are to relatively few nodes in the tree. The downside is that
> the tree is modified by lookups.

Unfortunately, that means that there's no way it can even begin to scale
on SMP - all "readers" need exclusive locks unless you can somehow
guarantee that there'll only ever be one reader/writer. In some instances,
it might make sense to have completely unlocked per-processor trees
mapping onto shared structures, but it seems a little painful.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/