[NTLK] Geek Question: TTask and TUTask

Simon Bell simonbell at me.com
Thu Feb 19 08:06:41 EST 2015


Paul will have a better understanding of this. But here is my take on it.

> On 18 Feb 2015, at 22:53, Matthias Melcher <mm at matthiasm.com> wrote:
> 
> Why did the engineers create TTask and TUTask?

To protect the OS kernel from user access. The same pattern is used for monitors, ports, shared memory: all objects.

A TUTaskWorld encapsulates the ports and shared memory a TUTask needs to communicate with other tasks; it is the world in which the task lives.
A TUTask creates a kernel TTask to run the task code, but the only (very limited!) access to that TTask is through the TUTask. The two are not related in any class hierarchy.

The task queue managed by TScheduler holds only TTask instances. If you are replacing the task switching mechanism I don’t think you need be concerned with CUTask at all. But depending on how deep your replacement goes, you may need to consider that the SWI handler twiddles processor registers stored in the TTask for copying shared memory as well as task switching.

Simon



More information about the NewtonTalk mailing list