uThreads  0.3.0
Public Member Functions | Static Public Member Functions | Friends | List of all members
Cluster Class Reference

Scheduler and Cluster of kThreads. More...

#include <Cluster.h>

Public Member Functions

 Cluster ()
 
 Cluster (const Cluster &)=delete
 
const Clusteroperator= (const Cluster &)=delete
 
uint64_t getID () const
 Get the ID of Cluster. More...
 
size_t getNumberOfkThreads () const
 Total number of kThreads belonging to this cluster. More...
 

Static Public Member Functions

static ClustergetDefaultCluster ()
 

Friends

class kThread
 
class uThread
 
class Connection
 
class IOHandler
 
class Scheduler
 

Detailed Description

Scheduler and Cluster of kThreads.

Cluster is an entity that contains multiple kernel threads (kThread). Each cluster is responsible for maintaining a ready queue and performing basic scheduling tasks. Programs can have as many Clusters as is necessary. The Cluster's ReadyQueue is a multiple-producer multiple-consumer queue where consumers are only kThreads belonging to that Cluster, and producers can be any running kThread. kThreads constantly push and pull uThreads to/from the ReadyQueue. Cluster is an interface between kThreads and the ReadyQueue, and also provides the means to group kThreads together.

Each Cluster has its own IOHandler. IOHandler is responsible for providing asynchronous nonblocking access to IO devices. For now each instance of an IOHandler has its own dedicated poller thread, which means each cluster has a dedicated IO poller thread when it is created. This might change in the future. Each uThread that requires access to IO uses the IOHandler to avoid blocking the kThread, if the device is ready for read or write, the uThread continues otherwise it blocks until it is ready, and the kThread execute another uThread from the ReadyQueue.

When the program starts a defaultCluster is created for the kernel thread that runs the main function. defaultCluster can be used like any other clusters.

Constructor & Destructor Documentation

Cluster::Cluster ( )

Create a new Cluster

Cluster::Cluster ( const Cluster )
delete

Cluster cannot be copied or assigned.

Member Function Documentation

static Cluster& Cluster::getDefaultCluster ( )
inlinestatic
Returns
defaultCluster
uint64_t Cluster::getID ( ) const
inline

Get the ID of Cluster.

Returns
The ID of the cluster
size_t Cluster::getNumberOfkThreads ( ) const
inline

Total number of kThreads belonging to this cluster.

Returns
Total number of kThreads belonging to this cluster
const Cluster& Cluster::operator= ( const Cluster )
delete

Cluster cannot be copied or assigned.


The documentation for this class was generated from the following files: