uThreads
0.3.0
|
Object to represent kernel threads. More...
#include <kThread.h>
Public Member Functions | |
kThread (Cluster &) | |
Create a kThread on the passed cluster. More... | |
kThread (const kThread &)=delete | |
kThread cannot be copied or assigned. | |
const kThread & | operator= (const kThread &)=delete |
kThread cannot be copied or assigned. More... | |
std::thread::native_handle_type | getThreadNativeHandle () |
return the native hanlde for the kernel thread More... | |
std::thread::id | getID () |
returns the kernel thread ID More... | |
Static Public Member Functions | |
static kThread * | currentkThread () |
Get the pointer to the current kThread. More... | |
static uint | getTotalNumberOfkThreads () |
Friends | |
class | uThread |
class | Cluster |
class | IOHandler |
class | Scheduler |
Object to represent kernel threads.
kThread is an interface for underlying kernel threads. kThreads are pulling and pushing uThreads from ReadyQueue provided by the Cluster and context switch to them and execute them. Each kThread belongs to only and only one Cluster and it can only pull uThreads from the ReadyQueue of that Cluster. However, kThreads can push uThreads to the ReadyQueue of any cluster.
defaultKT is the first kernel thread that executes and is responsible for running the main() function. defaultKT is created when the program starts.
Each kThread has a mainUT which is a uThread used when the ReadyQueue is empty. mainUT is used to switch out the previous uThread and either pull uThreads from the ReadyQueue if it's not empty, or block on a condition variable waiting for uThreads to be pushed to the queue.
kThreads can be created by passing a Cluster to the constructor of the kThread.
kThread::kThread | ( | Cluster & | cluster | ) |
|
inlinestatic |
std::thread::id kThread::getID | ( | ) |
std::thread::native_handle_type kThread::getThreadNativeHandle | ( | ) |
return the native hanlde for the kernel thread
In linux this is pthread_t representation of the thread.
|
inlinestatic |