22 lines
2.5 KiB
Plaintext
22 lines
2.5 KiB
Plaintext
$FG,5$$TX+CX,"MultiTasking"$$FG$
|
|
|
|
$WW,1$TempleOS is a preemptive multitasking operating system. However, you can turn-off preemption on a task by task basis and the task will not yield ctrl unless it volunteers with $LK,"Yield","MN:Yield"$(), $LK,"Sleep","MN:Sleep"$() or a call to I/O which yields ctrl. Use the $LK,"Preempt","MN:Preempt"$() cmd to turn on or off preemption. This is useful when you have multiple tasks modifying data structures simultaneously. Interrupts still occur when preemption is off.
|
|
|
|
$BK,1$Preemption is turned-off by default when a task is $LK,"Spawn","MN:Spawn"$()ed.$BK,0$
|
|
|
|
The time-slice rate is set by $LK,"JIFFY_FREQ","MN:JIFFY_FREQ"$.
|
|
|
|
TempleOS does not remove tasks from "the queue" when they are waiting. They swap-in, check for whatever condition they are waiting for and swap-out. This keeps it simple, but would cause problems if too many tasks existed. TempleOS is intended for non-server home computers with a maximum of around ten, or so, tasks. See $LK,"Scheduler","FL:::/TempleOS/Kernel/Scheduler.CPP,1"$.
|
|
|
|
TempleOS has no task priority scheme.
|
|
|
|
Disk requests are not broken into pieces for sharing. Therefore, if one task makes a big request, the drive is locked onto that task until it is done. During that time, other tasks can do CPU-only operations, however.
|
|
|
|
|
|
$FG,5$$TX+CX,"Interrupts"$$FG$
|
|
|
|
You can turn-on and off interrupts, in your user programs. This is part of the mission statement, giving complete freedom to programmers Use $LK,"Cli","MN:Cli"$() or $LK,"Sti","MN:Sti"$(). TempleOS currently doesn't use interrupt besides the timer and keyboard interrupt. Since the interrupt flag is part of your task context and since you are voluntarily swapped-out if you call $LK,"GetChar","MN:GetChar"$() or whatever, you won't even notice if you turn-off interrupts at the cmd prompt because you are being swapped-out and interrupts are being turned-on by the next task.
|
|
|
|
I saw no reason to make the hard drive or CD-ROM drive code interrupt driven -- it just creates potential compatibility issues. On a home system, you do one thing at a time, mostly. TempleOS can do multiple things at once, but not as efficiently as a server operating system. It would bogg down with a hundred tasks asking for service. It sure is simpler, though... smaller... simpler to maintain... and understandable by a layman! The disk code does not break-up requests, if you are curious why one task must wait until another finishes an operation.
|
|
|
|
See $LK-A,"::/TempleOS/Demo/Lectures/Spinning.CPP"$. |