Re: Doubt in Software Task Switching




Dharma wrote:
Hi all,
I have doubt in Scheduling.

Suppose if we have only one Code Segment the scheduling
algorithm is Preemptive and the task switching is done using
Software

Okay.


There are three task whose functions are task1(), task2(),task3().

Now iam in task1() after some time scheduling happens , task2()
must be called to call this we have to update Stack Pointer, Stack
Segment and the Instruction pointer should point to the instruction in
the Task2().

okay.


1) how the Instruction pointer is modified?

Generally, it is "pushed" on the new thread's stack and a return is
executed.


2) Who is taking care of modifying the Instruction Pointer?

The task manager.


Is it possible to give an example.

Take a look at the coroutines package in the HLA Standard Library. It's
not preemptive, but could easily be made so.
http://webster.cs.ucr.edu/AsmTools/HLA/HLADoc/HLAstdlib/hlastdliba12.html#1042378

Cheers,
Randy Hyde

.



Relevant Pages

  • Doubt in Software Task Switching
    ... Suppose if we have only one Code Segment the scheduling ... There are three task whose functions are task1(), task2,task3. ... how the Instruction pointer is modified? ...
    (comp.lang.asm.x86)
  • Doubt in Software Task Switching
    ... Suppose if we have only one Code Segment the scheduling ... There are three task whose functions are task1(), task2,task3. ... how the Instruction pointer is modified? ...
    (alt.lang.asm)
  • Re: Doubt in Software Task Switching
    ... Suppose if we have only one Code Segment the scheduling ... There are three task whose functions are task1(), task2,task3. ... must be called to call this we have to update Stack Pointer, ... how the Instruction pointer is modified? ...
    (comp.lang.asm.x86)
  • Re: Portable lock-free C code?
    ... +100 core cpu's and have special ASM operations for thread creation ... (Instruction Pointer reserveration), ... and scheduling. ... main memory in a single cycle any more. ...
    (comp.programming.threads)