Page 1 of 1

tss multitasking implementation..

Posted: Mon Jun 23, 2003 1:19 pm
by hefeteig
because i got no answers and feedback on alt.os.development i'll try it here now:

I spent the whole day reading the Intel Manuals and trying to understand how I can use this TSS Stuff to do multitasking in my OS. I understand things better if I write my own summary about it (see paragraph 1 and 2 in the included document).

Now I came to the conclusion that ljmp's are the (a) solution for task switching, because lcall do "nest" task's in each other.

Now my request to you: Please read my document, and tell me if my summary and my implementation (paragraph 3) are correct, and make sense at all.
I'm really wondering if I found a good and common solution to do
multitasking with IA32 and TSS's..
Or are there better sulutions ? IRET ? Task as interrupt handlers ? how does your OS multitasking ?
please let me know!
This is not another "how do i add multitasking to my OS" post. I would like to start an interessting discussion about multisaking implementations with IA32 and TSS's es.

thanks alot for any help!

kind regards

hefeteig

P.s. sorry for my bad english :)

attachment at:
www.c-worker.ch/hos/tss_multitasking.doc

Re:tss multitasking implementation..

Posted: Tue Jun 24, 2003 2:44 pm
by unknown user
my os does multitasking by a kernel task function calling each task and then the timer function sending a signal to the function to pass the control back to the kernel when the task's time runs out (20 jiffies for normal tasks, more for real-time tasks, less for batch tasks), and if a hardware irq happens, the task closest related to the irq is called to handle the function and then control is returned to the interrupted task.

Re:tss multitasking implementation..

Posted: Wed Jun 25, 2003 12:02 am
by Pype.Clicker
unknown user wrote: the timer function sending a signal to the function to pass the control back to the kernel when the task's time runs out
and what if the function that has the control ignores the signal ?

Re:tss multitasking implementation..

Posted: Wed Jun 25, 2003 6:32 am
by Solar
That's called "cooperative multitasking" as employed by older versions of the MacOS.

Re:tss multitasking implementation..

Posted: Wed Jun 25, 2003 7:44 am
by Pype.Clicker
@hefeteig: well, basically, i think you understood it well ... just a few things: 1. i'm not sure intel will like your .doc file very much :P 2. i wouldn't re-enable interrupts before doing ljmp, if i were you: it just ruins the whole atomicity of the thing. Let the new task re-enable them if it needs to. 3. i wouldn't do "clts" that fast. At least make sure you restored the FPU state before you CLTS -- this way if another process tries to reuse the FPU state before its own state was restored, it will catch an exception rather than destroying the state.

@solar: were there such "signals" in legacy cooperative multitasking ? i tought it just expected the user process to make blocking calls "often enough", not telling user process "hey, your time's up now! be nice: release the CPU"

@unknown_user: as MacOS 8 and Win3.11 schemes, your scheme has a major risk of seing the whole system freezed because of one misbehaved task :-@ Your users will *not* enjoy this. Go for preemptive scheme ...

Re:tss multitasking implementation..

Posted: Wed Jun 25, 2003 9:34 am
by unknown user
@pype: ok

Re:tss multitasking implementation..

Posted: Wed Jun 25, 2003 3:37 pm
by hefeteig
@Pype.Clicker: thanks a lot for your input!
btw. your OS project looks good!

kind regards
hefeteig

P.S. grr... each time i forget to fill a field, i have to re-write the whole message :(