That means i've used avl trees, B+trees and sometimes think of hashtables for storing kernel's basic data such as threads, process, symbols, module info, etc. This even culminates with "KDS" (Kernel Dynamix System), a hierarchically naming service where you can retrieve almost everything related to the system...
Of course this partially affects performance. When you create a new thread, you have to insert it in its process' AVL ... Alternatively, i could have used a simple "thread table" where every thread gets its own entry and where you need to crawl the table, comparing [tt]thread[ i ].pid[/tt] against [tt]the_process[/tt] when you want to display the list of threads belonging to a given process (e.g. because you're about to kill the process
That's all a matter of trade-offs, but sometimes i get the feeling that i've been too far in complexity for a "microkernel" ...
Is "#define MAX_THREADS 256" or "#define MAX_FILEHANDLES 1024" so evil? I can't tell anymore.
When it came to message passing, i took the decision to have each 'port' in a simple table, addressed by offset, for the sake of performance. While you typically only search threads a few times in their lifespan, you'll do _much more_ search for ports (almost everytime you send a message). I know this is inconsistent with the rest of the design ... and i'm unsure of which approach is the best now. On the 'darkside', it's pretty scary to thing that you could start as many threads as you want, but that the number of communication ports they can open is bounded.
