passive an resource queue

12 views
Skip to first unread message

jsk @ma$+eR

unread,
Jul 14, 2009, 2:46:26 AM7/14/09
to omnetpp
can some one plz tell me tell me how the server plays a role in the
passive and resource queues...

Rudolf Hornig

unread,
Jul 14, 2009, 6:34:30 AM7/14/09
to omn...@googlegroups.com
If you are referring to the server module in the queueinglib example...

 in nutshell:

The contract between the Server and the PassiveQueues are defined by the IServer and IPassiveQueue interfaces (see the correcponding header files).

There are two main events that requires communication between.

1. the queue was empty and a new job has arrived: In this case the queue queries the server(s) attatched to its output and calls the IServer::isIdle() method on all of them. Chooses a server (using a pre-configured SelectionStrategy) and passes the received job to the selected Server.

2. the Server has finished the processing of a job a becomes idle. It checks the length of each queue (by using also a SelectionStrategy class) attached to its input gate by calling IPassiveQueue::length(). Once the appropriate queue is selected, an IPassiveQueue::request() call is made to the queue to send out a job for further processing.

SelectionStrategies are used to select from Queues or Servers based on some logic. see the SelectionStrategy.cc and .h files. Some examples are: priority based, round robin, longest/shortest queue etc...

As for resource related modules: The contract is defined in the IResourcePool.h file.
IResourcePool::tryToAllocate() should try to allocate some resources (and return true if allocatin was successful)
IResourcePoo::release() is called (by a ResourceAllocator) when resources are returned to the pool.

On the other side a block that is used to allocate resources should implement a callback
IResourceAllocator::resourceGranted(). This method is called when an allocator is waiting on a resource and the resource becomes available in the pool (because an other block has released some amount of resource).

Rudolf
Reply all
Reply to author
Forward
0 new messages