Hi everyone:
I am going to implement Multitasking in my OS.
now i saw some Wikipedia articles , Wiki articles , JamesM and Google . but i didn't find a useful article that describes and explains the Multitasking <Many of them giving the code then copy and paste>.
Please, Can anyone explains to me how the Multitasking works , Please ?
I want the idea of it and how it works to make my own one
-------------------------------------
Thanks in advance.
[Solved]Multitasking
-
- Member
- Posts: 109
- Joined: Wed Nov 10, 2010 10:49 am
[Solved]Multitasking
Last edited by melgmry0101b on Sun Sep 04, 2011 3:21 pm, edited 1 time in total.
Re: Multitasking
the basic idea is that when the kernel decides it's time to pause one process, it saves a snapshot of all registers, flags, and the instruction pointer (it's "context") ... when it's time to resume a process, it restores all of that data, transparently returning control to the process right where it left off.Mozo40 wrote:Hi everyone:
I am going to implement Multitasking in my OS.
now i saw some Wikipedia articles , Wiki articles , JamesM and Google . but i didn't find a useful article that describes and explains the Multitasking <Many of them giving the code then copy and paste>.
Please, Can anyone explains to me how the Multitasking works , Please ?
I want the idea of it and how it works to make my own one
-------------------------------------
Thanks in advance.
http://wiki.osdev.org/Multitasking_Systems
Re: Multitasking
Hi,
Have a look at Multitasking Systems which gives some background and links.
If you want to think about this so you can do it in your own way, basically think about the "execution context" of your (currently single-tasking) kernel. What basically encompasses everything it needs to run as it does? Initially, this may simply include:
So basically Multitasking involves saving this process state, selecting the next process to run and loading its process state. Again, there is more complexity when you start thinking of things like Multiprocessing, mutual exclusion, task priorities, lock contention and so on. I don't know that I can explain any more about how it works without getting in to implementation details. As you say, there are plenty of practical examples. Although you don't want to copy/paste code, there is absolutely no harm in reading a few code examples to see how it works before deciding how it fits in with your design.
To get a better idea of the theory, you may also be interested to see how it works on a different architecture, such as the 8 bit RISC AVR which can be found here.
Cheers,
Adam
Have a look at Multitasking Systems which gives some background and links.
If you want to think about this so you can do it in your own way, basically think about the "execution context" of your (currently single-tasking) kernel. What basically encompasses everything it needs to run as it does? Initially, this may simply include:
- Memory Space.
- General Purpose registers (including (E/R/)IP and the Stack Pointer).
- Segment Registers
- (E)FLAGS
So basically Multitasking involves saving this process state, selecting the next process to run and loading its process state. Again, there is more complexity when you start thinking of things like Multiprocessing, mutual exclusion, task priorities, lock contention and so on. I don't know that I can explain any more about how it works without getting in to implementation details. As you say, there are plenty of practical examples. Although you don't want to copy/paste code, there is absolutely no harm in reading a few code examples to see how it works before deciding how it fits in with your design.
To get a better idea of the theory, you may also be interested to see how it works on a different architecture, such as the 8 bit RISC AVR which can be found here.
Cheers,
Adam
-
- Member
- Posts: 109
- Joined: Wed Nov 10, 2010 10:49 am
Re: Multitasking
Thank you very much AJ and miker00lz