blob: ddcbd33d8a3f480d4793e0b40ba953fc9d059a5f [file] [log] [blame] [view]
# Thread
thread - runnable / computation entity
The thread object is the construct that represents a time-shared CPU execution
context. Thread objects live associated to a particular
[Process Object]( which provides the memory and the handles to other
objects necessary for I/O and computation.
### Lifetime
A thread can be created implicitly by calling `sys_process_start()`, in which
case the new thread is the "main thread" and the thread entrypoint is defined by
the previously loaded binary. Or it can be created by calling
`sys_thread_create()` which takes the entrypoint as a parameter.
A thread terminates when it `return`s from executing the routine specified as
the entrypoint or by calling `sys_thread_exit()`.
+ [thread_create](../syscalls/ - create a new thread within a process
+ [thread_exit](../syscalls/ - exit the current thread
+ [thread_read_state](../syscalls/ - read register state from a thread
+ [thread_start](../syscalls/ - cause a new thread to start executing
+ [thread_write_state](../syscalls/ - modify register state of a thread
+ [task_resume](../syscalls/ - cause a suspended task to continue running
+ [task_bind_exception_port](../syscalls/ - attach an exception port to a task
+ [task_kill](../syscalls/ - cause a task to stop running