Multitasking

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Stefan

Multitasking

Post by Stefan »

Hi,
where can I get good information about multitasking
which is also understandable for newbies??

tnx

mfg Stefan
Alexei Frounze

RE:Multitasking

Post by Alexei Frounze »

>On 2001-02-26 12:10:20, Stefan wrote:
>Hi,
>where can I get good information about multitasking
>which is also understandable for newbies??
>

Multitasking often can be seen as interrupting one
task and continuing another.
For example, you may want to switch tasks upon
timer interrupt. This way you have to store
all registers belonging to outgoing task somewhere
in RAM (the stack of the task is a perfect place
for this) and then load all registers belonging
to the incoming task and issue IRET.
If you use stack as a storage for task registers,
the only information you need to know about each
task is its SS:SP so that you can load those
SS:SP values, pop off the stack those registers
and IRET will pop CS:IP (along with FLAGS register)
and continue the incoming task.
If you want to have 10 tasks, make an array
of 10 far pointers for those SS:SP so that
you can store SS:SP pointers somewhere and
read them from somewhere.
I have an example program for TurboC on this topic.
Though it's more than just task switching described
above.

Good Luck
vitaly

RE:Multitasking

Post by vitaly »

>On 2001-02-26 17:16:45, Alexei Frounze wrote:
>>On 2001-02-26 12:10:20, Stefan wrote:
>>Hi,
>>where can I get good information about multitasking
>>which is also understandable for newbies??
>>
>
>Multitasking often can be seen as interrupting one
>task and continuing another.
>For example, you may want to switch tasks upon
>timer interrupt. This way you have to store
>all registers belonging to outgoing task somewhere
>in RAM (the stack of the task is a perfect place
>for this) and then load all registers belonging
>to the incoming task and issue IRET.
>If you use stack as a storage for task registers,
>the only information you need to know about each
>task is its SS:SP so that you can load those
>SS:SP values, pop off the stack those registers
>and IRET will pop CS:IP (along with FLAGS register)
>and continue the incoming task.
>If you want to have 10 tasks, make an array
>of 10 far pointers for those SS:SP so that
>you can store SS:SP pointers somewhere and
>read them from somewhere.
>I have an example program for TurboC on this topic.
>Though it's more than just task switching described
>above.
>
>Good Luck

Well... unless you have a 8086, you should
better use the task register. Much more
efficient...
Khumba

Task register?

Post by Khumba »

Hello. If anyone's even going this far down on the
list anymore, I have a question about the Task
Register... What is it? I would like to make my OS
multitasking with the TR, but I have no idea how.
Could you please tell me if there are any sites
around that talk about it? Thank you!

>On 2001-10-29 11:44:11, vitaly wrote:
>>On 2001-02-26 17:16:45, Alexei Frounze wrote:
>>>On 2001-02-26 12:10:20, Stefan wrote:
>>>Hi,
>>>where can I get good information about multitasking
>>>which is also understandable for newbies??
>>>
>>
>>Multitasking often can be seen as interrupting one
>>task and continuing another.
>>For example, you may want to switch tasks upon
>>timer interrupt. This way you have to store
>>all registers belonging to outgoing task somewhere
>>in RAM (the stack of the task is a perfect place
>>for this) and then load all registers belonging
>>to the incoming task and issue IRET.
>>If you use stack as a storage for task registers,
>>the only information you need to know about each
>>task is its SS:SP so that you can load those
>>SS:SP values, pop off the stack those registers
>>and IRET will pop CS:IP (along with FLAGS register)
>>and continue the incoming task.
>>If you want to have 10 tasks, make an array
>>of 10 far pointers for those SS:SP so that
>>you can store SS:SP pointers somewhere and
>>read them from somewhere.
>>I have an example program for TurboC on this topic.
>>Though it's more than just task switching described
>>above.
>>
>>Good Luck
>
>Well... unless you have a 8086, you should
>better use the task register. Much more
>efficient...
Puzzler183

Well...

Post by Puzzler183 »

I think it is some protected mode register. I
implemented a small multitaking OS without using
it so I don't knwo about the speed difference.
Post Reply