Diferences between TSS and software taskswitching

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
Thunder

Diferences between TSS and software taskswitching

Post by Thunder »

Hello,
What are diferences between TSS-hardware and software multitasking, on what kind of kernel it wrks better(monolithic and microkernel)?

How it woks? I know that on taskswitch it we must save registers, flags and other stuff. But when computer knows when to switch task, I think that we must use IRQ0-timer?
Please, explain me. :)
Thanks
Whatever5k

Re:Diferences between TSS and software taskswitching

Post by Whatever5k »

When using TSS, you initiate a task switch by jumping to the appropriate TSS selector, the CPU then saves the task's state in the current TSS pointed to by the TSS register.
When using stack based (software) task.-switching, you first save the task's state on the current stack, load the stack of the new program (which contains EIP, CS & co.) and initiate an IRET. It *actually* has nothing to do with the IRQ0 timer - it's just that people use the clock to determine if a process has run too long.
So you basically do:

Code: Select all

clock()
  -> quantum--; if quantum = 0; switch_to_process(ANOTHER);
Hope that helps
Post Reply