tss multitasking implementation..

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
hefeteig

tss multitasking implementation..

Post 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
unknown user

Re:tss multitasking implementation..

Post 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.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:tss multitasking implementation..

Post 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 ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:tss multitasking implementation..

Post by Solar »

That's called "cooperative multitasking" as employed by older versions of the MacOS.
Every good solution is obvious once you've found it.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:tss multitasking implementation..

Post 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 ...
unknown user

Re:tss multitasking implementation..

Post by unknown user »

@pype: ok
hefeteig

Re:tss multitasking implementation..

Post 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 :(
Post Reply