ProducerConsumer initialization

For an overview of the ProducerConsumer please see: ProducerConsumer: overview.

ProducerConsumer initialization sequence

The creation of the ProducerConsumer task is handled by its constructor as depicted in the following sequence diagram:

mtf-core-prodcons-init.png

The construction sequence consists of:
  • Storing a reference to the parent task
  • Creating a new connection point, wrapped in the ConsumerConnectionPoint decorator class
  • Creating a new connection point, wrapped in the ProducerConnectionPoint decorator class

The ProducerConsumer is fully initialized by the OnInitialize() callback as shown in the following sequence diagram:

mtf-core-prodcons-init2.png

The ProducerConsumer initialization process calculates and stores a number of frequently used values as well as creating the task elements and their locks. This consists of the following steps:
  • CalcNumConsumerLinks() - iterates over the list of consumer connections, adding up the total number of links
  • CalcNumProducerLinksAndSlots() - iterates over the list of producer connections, adding up the total number of links and the total number of slots. The number of slots is the sum of the product of the overlay depth and producer link count for each connection.
  • CalcNumConsumerSlots() - calculates the number of consumer slots by multiplying the overlay depth and consumer link count
  • StoreProperties() - stores the consumer and producer advance mode properties
  • CalcTotalDimensions() - calculates the total dimensions by appending the dimensions of the task's ancestors
  • CalcNumElements() - calculates the number of elements as the product of all the task's dimensions
  • CreateElements() - creates the array of ProducerConsumerElements
  • CreateTaskElementLocks() - creates a lock object for each element
  • StoreLinkConnections() - stores a lookup array from link number to connection object for quick access

Last edited Sep 11, 2012 at 6:45 AM by jaorme, version 11

Comments

No comments yet.