Sunday, April 24, 2005

It Works!

OK... The multi-tasking works where it can switch between two threads concurrently. I now will take the code and encapsulate it into the CoreThread component which I will code this week. This means that Screens will have threading capabilities which is great! The kernel will use this threading capabilities to start the module calls so that modules can run concurrently. This is done by a module saving its state (registers and stack) when it yields (which a kernel API can flag the module to yield) and then closing itself. When the kernel re-runs the same module it passes its state back so that the module can restore it. Because the saving and restoring is done by the module, its not interface dependent or even language dependent. I am so happy with how the project is moving in the last few months in both code & design. Note that each thread has its own stack of module calls where each call in the stack has its own state. The current implementation uses ErrSetJump and ErrLongJump to save/restore the registers and copies the stack between an initialized variable at the beggining of the stack and a variable at the end of the stack. It will be currently stored in feature memory. While this is slower than setting/getting the A7 register, its more implementation independent and wont break on cobalt which many other implementations do.

No comments: