Scheduler Services for System Code 

 
Contents: 0x08    End Time Slice 

This ends a time slice, which does different things depending on the policy of the thread. For policy 0 and policy 3 threads ending the time slice does nothing because the scheduler will switch to the highest priority thread that's ready to run, which should be the same thread that just ended it's time slice. For policy 1 tasks the current time slice will end, the amount of time owed to the thread is reset to 0 and the thread is marked as 'up to date'. The length of time before the thread gets another time slice is determined by the threads 'period' setting. For policy 2 threads ending a time slice gives cpu time to other policy 2 threads, but if there's no other policy 2 threads it will return to the same thread that just ended it's time slice.

Input
 None

Output
 AL     Status
 

0x10    Spawn Policy 0 Thread


This creates a policy 0 thread system level thread.

Input
  BX     Starting CS
  CL     Maximum qTime
  CH     Priority
  EDX    Starting EIP
  ESI    Passed to new task
  EDI    Passed to new task
  EBP    Passed to new task

Output
  BX     Task ID
  AL     Status
 

0x11    Spawn Policy 1 Thread


This creates a policy 1 thread system level thread.

Input
  BX     Starting CS
  CL     Length of a time slice
  CH     Number of 64 mS periods between the start of each time slice
  EDX    Starting EIP
  ESI    Passed to new task
  EDI    Passed to new task
  EBP    Passed to new task

Output
  BX     Task ID
  AL     Status
 

0x12    Spawn Policy 2 Thread


This creates a policy 2 thread system level thread.

Input
  BX     Starting CS
  CL     Initial count
  CH     Maximum count
  EDX    Starting EIP
  ESI    Passed to new task
  EDI    Passed to new task
  EBP    Passed to new task

Output
  BX     Task ID
  AL     Status
 

0x13    Spawn Policy 3 Thread


This creates a policy 3 thread system level thread.

Input
  BX     Starting CS
  CX     Priority
  EDX    Starting EIP
  ESI    Passed to new task
  EDI    Passed to new task
  EBP    Passed to new task

Output
  BX     Task ID
  AL     Status
 

0x20    Stop Thread 


This prevents a thread from getting any cpu time until it's started again (regardless of policy).

Input
  EBX    Task ID

Output
  AL     Status
 

0x21    Start Thread 


Used to start a thread that was stopped with function 0x20.

Input
  EBX    Task ID

Output
  AL     Status
 

0x80        Kill current thread


The function takes no parameters and never returns. Any resources allocated by a thread should be de-allocated before the thread calls this function.