Skip to content

Threads

Berkus Decker edited this page Aug 2, 2017 · 3 revisions

Threads

Vesper provides threads to represent an execution context and manage processor time. A thread is represented by its thread control block object (TCB). Each TCB has an associated CapSpace and VSpace which may be shared with other threads. A TCB may also have an IPC buffer, which is used to pass extra arguments during IPC or kernel object invocation that do not fit in the architecture-defined message registers. While it is not mandatory that a thread has an IPC buffer, it will not be able to perform most kernel invocations, as they require cap transfer. Each thread belongs to exactly one security domain (this is probably not necessary).

Structures notes

  • kern__thread_create creates a thread in nester address space, inits thread stack to point to in-kernel thread booter. Activation is not created until first thread's upcall. Thread is added to runnable queue.

  • when scheduler donates cpu time to newly created thread, a new activation is created and thread boot upcalls into target space's thread entrypoint.

  • whenever thread returns from the entrypoint, it is about to exit – all resources are cleaned up, activations terminated and thread destroys itself. (same as calling kern__thread_destroy)

For modern OS a for-free thread distributability is crucial (@sa Alpha kernel).

Clone this wiki locally