I'll explain the current situation :
I have a working base OS, 3 gfx drivers, various stuff, and I'm now working on multitasking.
I found a bunch of example codes, various stuff, and managed to make some non-preemptive multitasking (each task has to explicitly tell the world when I can switch).
I've read interesting stuff about task-gade, hardware switching, etc... but it's still not quite clear.
Anyone has some documentation or example code about task switching and multitasking ?
Basically, from what I understood :
- State of each task is saved in a list
- I install an timer exception with my task-switcher
- When the exception happens, I save the current context, restore another task's context, and run it
This way, multitasking should work (from what I could read), but reality is far from theory. I tried to do that using "software task switching" but it just didn't work.
So, help is welcome!
Multitasking help
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Multitasking help
1: Read the Intel ManualsMagicalTux wrote:Anyone has some documentation or example code about task switching and multitasking ?
2: There are some multitasking tutorials. Browse the OS dev sites that are around
3: http://ringzero.free.fr/os/protected%20mode/Pm/PM8.ASM
4: I'd normally give you an url to my own kernel, but it has gotten too long for the syntax highlighter to handle and now it complains about execution time exceeded...
Anyway a common way to do this is to push all registers onto the stack, change stack (and possibly switch address space), then pop all registers and you're in the new task