Closed ferrous26 closed 10 years ago
Half done.
So, realized that a bit mask is actually a terrible idea for the task descriptor free list. Why? Because it is not constant time.
What we have now is constant time, but it eats up lots of memory (relatively).
So, I asked myself, how do we keep a list of tasks in a memory efficient way? Like the way we do for scheduling and receive queues?
Well, we're not using the next
pointer in a task when the task is dead...so, we could just use it again for the free list. It would be super space efficient, we'd only need the overhead of a head and tail pointer.
This also means we could extend the size of our task descriptor table arbitrarily. Want to go to 512? 1024? No problem.
The problem is we also use the next pointer to signify that the task is dead so we would need to do something else we can use as a dead check. Right now I do t want to change shit until trains can do trains things
We use the stack pointer to signify that a task is dead. The next pointer is free. I put the comment here so I will remember to do this later.
I lied. It is done now.
So that we can lock only half the descriptor related things into the cache.
We will need to separate things into kernel sections:
big kernel
for the descriptor tablesmall kernel
for the active task pointer and interrupt handling pointers, and also the lookup tableWe might want to take this opportunity to replace the free list with a bit mask that works like the priority lookup table. Our descriptor use will be less spread out (which might hurt debugging), but it will be more likely to reuse descriptors (and stack) that is already in the cache.