hi, I just implemented some multitasking in my OS using the tutorial from http://code.google.com/p/onyxkernel/wik ... ltitasking.
I can switch inbetween tasks, but sometimes (usually) the first task (PID 0) does not execute for some reason, and provides no error or exception for me to find in bochs. Also, the outcome of the multitasking varies greatly on whether i am running in bochs or on real hardware.
I implemented a small scheduler function that prioritized the processes, but nothing runs at all.
It seems as if something very minute is off in the stack or something like that, as it is not a constant problem, just usually.
Also, I substitued the kmalloc_a for just kmalloc as I could not find the prototype or OSS function for it.
Multitasking in C
Multitasking in C
Website: https://joscor.com
I don't use paging atm.
im going to run a few more tests and then ill post back
im going to run a few more tests and then ill post back
Website: https://joscor.com
Woah! Thanks for the plug to my site. Can't believe someone used it
The task setup in 0 should be an idle task. It doesn't seem to execute because it doesn't really execute. It copies the current kernel stack to task 0's stack so that you can continue to run the currently running task (kernel before multitasking is enabled)
It's this line that causes this when the scheduler is run for the first time.
And yes, kmalloc_a is page boundary aligned. It shouldn't really matter though.
The task setup in 0 should be an idle task. It doesn't seem to execute because it doesn't really execute. It copies the current kernel stack to task 0's stack so that you can continue to run the currently running task (kernel before multitasking is enabled)
It's this line that causes this when the scheduler is run for the first time.
Code: Select all
tasks[pid].stack = context; // save the old context into current task
Last edited by t0xic on Thu Mar 27, 2008 2:14 pm, edited 1 time in total.
nice tutorial btw
yeah, I finally got that part (the null process), and am currently using it as a process daemon to manage (start/stop) other threads. I still don't know why every time I mess with (even test) the task structure items that the task doesnt work after.
t0xic, you should deffinately add more text to your tutorial going more indepth of why you did certain things, there is alot of very useful code, but with very little explanation as to why it is there.
yeah, I finally got that part (the null process), and am currently using it as a process daemon to manage (start/stop) other threads. I still don't know why every time I mess with (even test) the task structure items that the task doesnt work after.
t0xic, you should deffinately add more text to your tutorial going more indepth of why you did certain things, there is alot of very useful code, but with very little explanation as to why it is there.
Website: https://joscor.com
I think a more structured approach would be more beneficial, I was thinking more along the lines of
if you gave an 'intro' to the code-block explaining what it does through abstraction that would be great as well as a trailing wrap-up explaining how it ties in with the rest of the code blocks.
I fixed the issues I was having and now I am having a performance issue with my two RTL8139D's as processes, but I have a feeling it is my polling function that is at fault.
Pe@cE
Code: Select all
(code-block explanation -> code-block -> review -> repeat
I fixed the issues I was having and now I am having a performance issue with my two RTL8139D's as processes, but I have a feeling it is my polling function that is at fault.
Pe@cE
Website: https://joscor.com