network
Class ProcessorSharingNode

java.lang.Object
  extended by network.Node
      extended by network.InfiniteServerNode
          extended by network.ResourcePool
              extended by network.ProcessorSharingNode

public class ProcessorSharingNode
extends ResourcePool

Implements a processor sharing node with a single server. The processing capacity seen by each customer decreases linearly with the number of customers.


Field Summary
 
Fields inherited from class network.ResourcePool
losses, lossNode, noOfResources, queue, resources
 
Constructor Summary
ProcessorSharingNode(java.lang.String s, Delay d)
           
 
Method Summary
protected  void accept(Customer c)
          Overrides superclass method.
 void releaseResource()
           
 
Methods inherited from class network.ResourcePool
getLosses, getLossProbability, logResults, meanNoOfQueuedCustomers, meanTimeInQueue, queueLength, resetMeasures, serverUtilisation, setLossNode, toString, varianceOfNoOfQueuedCustomers, varianceOfTimeInQueue
 
Methods inherited from class network.InfiniteServerNode
enter, invokeService
 
Methods inherited from class network.Node
displayResults, forward, getId, getName, setLink
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProcessorSharingNode

public ProcessorSharingNode(java.lang.String s,
                            Delay d)
Method Detail

accept

protected void accept(Customer c)
Overrides superclass method. It uses a devious method to avoid the O(n) cost of updating queue entries after each event. The trick is twofold: 1. Maintain a local virtual time that increases at a rate that's inversely proportional to the population. 2. Store virtual finish times with each customer in the queue. An arrival to a non-empty system cancels the current end-service event. The next customer to leave is always the one with the smallest finish time. The queue is an ordered queue, sorted by finish time. Each queue entry comprises a customer and its finish time. The queue entries are themselves QueueEntries as they contain a customer and a time. A QueueEntry conveniently defines a built-in order based on the time. Here the times are finish times. Note that the enqueue method will add an additional wrapper in the form of a QueueEntry in order to track the customer arrival time in the queue.

Overrides:
accept in class ResourcePool

releaseResource

public void releaseResource()
Overrides:
releaseResource in class ResourcePool