Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages   Examples  

Waitq Class Reference
[Synchronisation]

Inherits Observable< WaitqObserver >, DefLabeledObject, StatisticObject, TraceProducer, and ReportProducer.


Detailed Description

Waitq realises a master slave synchronisation, where the master gets control after successful synchronisation.

Author:
Ralf Gerstenberger

Note:
Waitq supports Observation

Waitq supports Trace

Waitq supports Report

Waitq realises a master slave synchronisation scheme. Two processes are synchronised with each other. One plays the role of a master process and gets control (execution) after successful synchronisation. The other (slave) is frozen and returned to the master process. A master process can provide a selection function to synchronise with particular processes only. If multiple processes could be used for synchronisation process- priority and FIFO-strategy are used to choose the process. Waitq is used for general process to process synchronisation.

Since:
1.0


Public Member Functions

 Waitq (Simulation *s, Label l, WaitqObserver *o=0)
 Construction.

 ~Waitq ()
 Destruction.

const std::list< Process * > & getWaitingSlaves () const
 List of blocked slaves.

const std::list< Process * > & getWaitingMasters () const
 List of blocked masters.

virtual TracegetTrace () const
 Pointer to trace.

virtual void report (Report *r)
 Generate report.

Master-slave synchronisation
bool wait ()
 Wait for activation by a 'master' process.

Processcoopt (Selection sel=0)
 Get a 'slave' process.

Processavail (Selection sel=0)
 Get available slaves without blocking (optional: select slave).

Statistics
Statistics

virtual void reset ()
 Reset statistics.

unsigned int getNumberOfSynch () const
 Number of synchronisation.

unsigned int getZeroWaitSlaves () const
 Without wait served slaves.

unsigned int getZeroWaitMasters () const
 Without wait served masters.

double getAVSlaveWaitTime () const
 Average slave waiting time.

double getAVMasterWaitTime () const
 Average master waiting time.


Static Public Attributes

Waitq specific marks
const MarkTypeId baseMarkId = 1000
const MarkType markCreate = MarkType("create", baseMarkId+1, typeid(Waitq))
const MarkType markDestroy = MarkType("destroy", baseMarkId+2, typeid(Waitq))
const MarkType markWait = MarkType("wait", baseMarkId+10, typeid(Waitq))
const MarkType markCooptFail = MarkType("cooptFail", baseMarkId+11, typeid(Waitq))
const MarkType markCooptSucceed = MarkType("cooptSucceed", baseMarkId+12, typeid(Waitq))
const MarkType markAvailFail = MarkType("availFail", baseMarkId+13, typeid(Waitq))
const MarkType markAvailSucceed = MarkType("availSucceed", baseMarkId+14, typeid(Waitq))
const MarkType markCooptSelFail = MarkType("cooptSelFail", baseMarkId+15, typeid(Waitq))
const MarkType markCooptSelSucceed = MarkType("cooptSelSucceed", baseMarkId+16, typeid(Waitq))
const MarkType markAvailSelFail = MarkType("availSelFail", baseMarkId+17, typeid(Waitq))
const MarkType markAvailSelSucceed = MarkType("availSelSucceed", baseMarkId+18, typeid(Waitq))
const TagId baseTagId = 1000
const Tag tagMaster = Tag(baseTagId+1)
const Tag tagSlave = Tag(baseTagId+2)


Constructor & Destructor Documentation

Waitq Simulation s,
Label  l,
WaitqObserver o = 0
 

Construction.

Parameters:
s pointer to Simulation object
l label of this object
o initial observer


Member Function Documentation

bool wait  ) 
 

Wait for activation by a 'master' process.

A process calling wait() is deactivated and passed over to a process synchronising with coopt() or avail(). If a slave process is interrupted before a successful synchronisation it is reactivated and the function returns false. (An interrupted slave process does not change user and waiting time statistics, but has influence on queue statistics.)

Process * coopt Selection  sel = 0  ) 
 

Get a 'slave' process.

A master process uses coopt() to synchronise with a slave process. The master can provide a 'selection function' to synchronise with a specific slave process. Until there is a suitable slave process available the master process is blocked. If a blocked master process is interrupted the synchronisation attempt is cancelled and coopt() returns 0. (An interrupted master process does not change user and wait time statistics, but has influence on queue statistics.)

Warning:
A master may not call interrupt() to reactivate a received slave().

Process * avail Selection  sel = 0  ) 
 

Get available slaves without blocking (optional: select slave).

A master process can use avail() to get a suitable slave process if available. Otherwise avail() returns 0.

Warning:
A master may not call interrupt() to reactivate a received slave().


Generated on Mon Aug 11 10:36:07 2003 for ODEMx by doxygen1.3