Skip to content

Static Variables

April 24, 2012

I have now made a change to get rid of some fixed variable arrays. Previously the task table was a fixed array of limited size, as was the table of standard message ports. I have now changed these to dynamically allocated linked lists; this gives these items the ability to grow unlimited (except by memory constraints).

As always, making these changes brought to light a couple of unnoticed bugs which had been causing system instability and also a horrendous memory leak in the kernel. These have now been corrected, leading to more stability. The memory allocation routine has also been improved and simplified. Previously I kept a record, in struct MemStruct, of the pid that allocated memory. The intention was to allow the kernel to automatically deallocate any unused memory once a process ends. On reflection this was not a particularly good idea. As the kernel allocates and deallocates all memory on its heap it seemed better to just make sure it didn’t leave any unused memory allocated (which I think I have managed so far). As for user memory, that is deallocated automatically when the pages are released by the DummyTask process.

I haven’t managed to crash the system with simple tests since making these changes, but I’m sure there are many bugs left lurking.

The source code download on my website now reflects these changes (and all previous ones mentioned), but I have yet to update the documentation and listings; I’ll do this in due course.

From → IanOS

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: