SoOSiM-0.1: Abstract full system simulator

Safe HaskellNone

SoOSiM.Types

Synopsis

Documentation

class ComponentIface s whereSource

Type class that defines every OS component

Methods

initState :: sSource

The minimal internal state of your component

componentName :: s -> ComponentNameSource

A function returning the unique global name of your component

componentBehaviour :: s -> ComponentInput -> SimM sSource

The function defining the behaviour of your component

data ComponentContext Source

Context of a running component in the simulator.

We need rank-2 types because we need to make a single collection of several component contexts, each having their own type representing their internal state.

Constructors

forall s . ComponentIface s => CC 

Fields

componentId :: ComponentId
 
currentStatus :: TVar (ComponentStatus s)

Status of the component

componentState :: TVar s

State internal to the component

creator :: ComponentId

ComponentId of the component that created this component

msgBuffer :: TVar [ComponentInput]

Message waiting to be processed by the component

traceMsgs :: [String]

Trace message buffer

simMetaData :: TVar SimMetaData

Statistical information regarding a component

data SimMetaData Source

Constructors

SimMetaData 

Fields

cyclesRunning :: Int
 
cyclesWaiting :: Int
 
cyclesIdling :: Int
 
msgsReceived :: Map ComponentId Int

Key: senderId; Value: number of messages

msgsSend :: Map ComponentId Int

Key: receiverId: Value: number of messages

data ComponentStatus a Source

Status of a running component

Constructors

Idle

Component is doing nothing

WaitingForMsg ComponentId (Dynamic -> SimM a)

Component is waiting for a message from ComponentId, will continue with computation (Dynamic -> SimM a) once received

Running

Component is busy doing computations

data ComponentInput Source

Events send to components by the simulator

Constructors

ComponentMsg ComponentId Dynamic

A message send another component: the field argument is the ComponentId of the sender, the second field the message content

NodeMsg NodeId Dynamic

A message send by a node: the first field is the NodeId of the sending node, the second field the message content

Initialize

Event send when a component is first created

Deinitialize

Event send when a component is about to be removed

Tick

Event send every simulation round

Instances

data NodeInfo Source

Meta-data describing the functionaly of the computing node, currently just a singleton type.

Constructors

NodeInfo 

data Node Source

Nodes represent computing entities in the simulator, and host the OS components and application threads

Constructors

Node 

Fields

nodeId :: NodeId

Globally Unique ID of the node

nodeInfo :: NodeInfo

Meta-data describing the node

nodeComponentLookup :: Map ComponentName ComponentId

Lookup table of OS components running on the node, key: the ComponentName, value: unique ComponentId

nodeComponents :: IntMap ComponentContext

Map of component contexts, key is the ComponentId

nodeMemory :: IntMap Dynamic

Node-local memory

nodeComponentOrder :: [ComponentId]
 

newtype SimM a Source

Instances

data RequestOrYield request response x Source

Constructors

Request request (response -> x) 
Yield x 

Instances

type SimMonad = StateT SimState IOSource

The internal monad of the simulator is currently a simple state-monad wrapping IO

data SimState Source

The internal simulator state

Constructors

SimState 

Fields

currentComponent :: ComponentId

The ComponentId of the component currently under evaluation

currentNode :: NodeId

The NodeId of the node containing the component currently under evaluation

nodes :: IntMap Node

The set of nodes comprising the entire system

uniqueSupply :: UniqSupply

Unlimited supply of unique values

componentMap :: Map String StateContainer
 

data StateContainer Source

Constructors

forall s . ComponentIface s => SC s