tasks and virtual memory
Posted: Tue Apr 29, 2003 11:10 am
I've a question about creating/killing tasks for my OS. It supports the multitasking (via TSS), v86 tasks and virtual memory.
To create a task first of all I allocate the TSS, a pl0-stack and the task
page directory.
The physical allocator use a stack approach to manage the free frames.
Then to initilize the task user space I temporary switch to the new virtual
address space, set the stack, the code & data space and I come back to the
old address space.
Whenever a task is killed I remove it from the ready queue and put it into the
zombie queue; later a process called "kpager" (permanently in execution) will provide
to get it from the zombie queue and to free the killed task space...
This is the idea... but something doesn't work. I've tested it in VMware and that's ok, but in a real PC (PIII600MHz, 256MB RAM) it reboots with a GPF (or goes "out of memory"). Only if the "kpager" doesn't free the pages in the kernel address space all goes well...
The problem could be in the "kfree()" function or in the "delete_page()", but I've tested these functions for a month... and I think are ok!
I'm not asking you to debug my code... it's my work... but I'd like to know
if my approach is correct or not and if could be errors when I switch to the
tasks and kernel address space...
Well.. here is the code (the task.c and paging.c programs) you can use it as you
wish or try to help me if you want... every helps are welcome!
Thanks in advance!
P.S. Maybe it would be better if I post the whole code of the OS... ???
[attachment deleted by admin]
To create a task first of all I allocate the TSS, a pl0-stack and the task
page directory.
The physical allocator use a stack approach to manage the free frames.
Then to initilize the task user space I temporary switch to the new virtual
address space, set the stack, the code & data space and I come back to the
old address space.
Whenever a task is killed I remove it from the ready queue and put it into the
zombie queue; later a process called "kpager" (permanently in execution) will provide
to get it from the zombie queue and to free the killed task space...
This is the idea... but something doesn't work. I've tested it in VMware and that's ok, but in a real PC (PIII600MHz, 256MB RAM) it reboots with a GPF (or goes "out of memory"). Only if the "kpager" doesn't free the pages in the kernel address space all goes well...
The problem could be in the "kfree()" function or in the "delete_page()", but I've tested these functions for a month... and I think are ok!
I'm not asking you to debug my code... it's my work... but I'd like to know
if my approach is correct or not and if could be errors when I switch to the
tasks and kernel address space...
Well.. here is the code (the task.c and paging.c programs) you can use it as you
wish or try to help me if you want... every helps are welcome!
Thanks in advance!
P.S. Maybe it would be better if I post the whole code of the OS... ???
[attachment deleted by admin]