Open LouisJenkinsCS opened 7 years ago
Things that need to be done to implement process management...
Its possible that given that the reserved area for allocation page directories are, we can only have 1024 potential processes in memory at once. However, hopefully by the time this becomes an issue I'll have implemented a swap space for it.
Following this model, we can see that now it will be easy for each process to have it's own threads. The threads themselves will just allocate their own 4KB stack from the process specific zone. The POSIX standard dictates that forking while having multiple threads result in undefined behavior if using shared-memory because the other threads (besides the one that called fork) no longer exist. Hence, I'll handle forking as a simple copy of address space, with no regard to threads.
Right now, Tasks must clone their stack from their parent... for pretty much no reason besides the complexity. Get this out of the way now. As well, processes can easily be extended on the current model by creating a new page directory on an identity mapped block of virtual memory. Which also brings up the need to create a zone allocator, which I started but stopped earlier. After this, the need to move stacks is moot, since each new process will just have the same virtual addresses but different physical frames that they are mapped to.
Afterwards, I can definitely see having a process for handling keyboard, one for VGA, one for HDD, etc. I would be able to abstract the entire model to processes, like UNIX. However, I'd need IPC and some shared memory synchronization, so that'll be a lot of fun.