|
PatchworkOS
da8a090
A non-POSIX operating system.
|
Thread of execution structure. More...
#include <thread.h>
Public Member Functions | |
| _Atomic (thread_state_t) state | |
Data Fields | |
| process_t * | process |
| The parent process that the thread executes within. | |
| list_entry_t | processEntry |
| The entry for the parent process. | |
| tid_t | id |
The thread id, unique within a process_t. | |
| errno_t | error |
| stack_pointer_t | kernelStack |
| The kernel stack of the thread. | |
| stack_pointer_t | userStack |
| The user stack of the thread. | |
| sched_client_t | sched |
| wait_client_t | wait |
| simd_ctx_t | simd |
| note_queue_t | notes |
| syscall_ctx_t | syscall |
| perf_thread_ctx_t | perf |
| interrupt_frame_t | frame |
Thread of execution structure.
A thread_t represents an independent thread of execution within a process_t.
The position of a thread user stack is decided based on its thread id. The user stack of the thread with id 0 is located at the top of the lower half of the address space, the user stack is CONFIG_MAX_USER_STACK_PAGES pages long, and below it is the guard page. Below that is the user stack of the thread with id 1, below that is its guard page, it then continues like that for however many threads there are.
The kernel stack works the same way, but instead starts just under the kernel code and data section, at the top of the kernel stacks region and each stack is CONFIG_MAX_KERNEL_STACK_PAGES pages long.
| thread_t::_Atomic | ( | thread_state_t | ) |
The current state of the thread, used to prevent race conditions and make debugging easier.
| process_t* thread_t::process |
| list_entry_t thread_t::processEntry |
| tid_t thread_t::id |
| errno_t thread_t::error |
| stack_pointer_t thread_t::kernelStack |
| stack_pointer_t thread_t::userStack |
| sched_client_t thread_t::sched |
| wait_client_t thread_t::wait |
| simd_ctx_t thread_t::simd |
| note_queue_t thread_t::notes |
| syscall_ctx_t thread_t::syscall |
| perf_thread_ctx_t thread_t::perf |
| interrupt_frame_t thread_t::frame |