Software Delivery: How does the software delivery task manager handle job priorities internally.

Document ID : KB000059941
Last Modified Date : 21/02/2018
Show Technical Document Details
Introduction:

When creating a software job container you can optionally adjust the priority of the container. This document will describe how the software delivery task manager handles job containers based on priority.

Sample job container advanced settings dialogue:

Figure 1

Environment:
Client Automation -- all versions.
Instructions:

Job Containers:

Job container priorities from 1 (highest) to 10 (lowest). The default container priority if not specified or changed is 5. There are 10 queues that are used by task manager to process tasks, one for each priority setting.

Task Manager Priority Queues:

The first queue stores tasks that have priority 1.
The second queue stores tasks that have priority 2.
...
The tenth queue stores tasks that have priority 10.

When a job container is created it is placed at the next available slot in the corresponding priority queue.  For example, if a new priority 4 job container is added to task manager, it will be added to the priority 4 queue.

Task Manager Base Algorithm:

Task manager processes queues in a series of recursive passes. On pass one only the first queue is processed. On the second pass, both the first and the second queues are processed. As a formula,

Base Case: Pass(0) = Process Priority Queue 0
Recursive Step: Pass(x) = if (x > 0) : Process Pass(x-1) & Process Pass(x)

Such that on any given pass, all previous passes are processes again. Here is an example:

Pass One: Process all tasks stored in the first queue (Priority 1)
Pass Two: Process all tasks stored in the first and second queue (Priority 1 & 2)
Pass Three: Process all tasks stored in the first, second and third queue (Priority 1, 2 & 3)
...
Pass Ten: All queues are processed from 1 to 10, in order. (Priority 1 thru 10).

After making all ten passes, task manager will rest and do some maintenance before starting over.

Exceptions to the Base Algorithm:

Empty Priority Queues:
If any priority queue is empty then the corresponding pass for that queue will be skipped.

New Software Job Container Created:
When a user creates a new job container, a notification is generated from the corresponding USD API server process that hosts the user's DSM Explorer and sends the notification to task manager.  While processing any pass(x), task manager will read notifications and process according to one of the below..

Lower Priority than Current Pass:
If the new software job container has a priority lower than the current pass, then the job container task is added to the appropriate priority queue and will be processed when task manager is running the corresponding pass that processes that queue.

Equal Priority to Current Pass:
If the new software job container priority is equal to the current pass, then the job container task is added to the list of tasks currently being processed.  This ensures it will be processed before the finish of the current pass.

Higher Priority than Current Pass:
If the new software job container priority is higher than the current pass, then the job container task is temporarily added to the list of tasks currently being processed as well as the being added to its normal corresponding priority queue for future passes.  This ensures that higher priority tasks are handled sooner then waiting for the next pass as rightfully the task priority is higher than the current pass being processed.

For example, if task manager is processing the fifth pass it will be processing all tasks in order from priority 1 through 5 in the order they were added to their corresponding task queue.  If a new software job container with priority 2 is created at this moment, it will be added to the list currently being processed by the fifth pass to ensure the higher priority job is processed.  If a new software job container with priority 7 is created at this moment, it will be added to the priority 7 queue and not processed until the seventh pass.

Job Container Priority or Activation Time Changes:
Task manager will carry out the same procedure as outlined above for a new software job container.  In addition task manager will remove the old task record from its former queue.

Low Priority Task Starvation:
Based on the algorithm used by task manager it is possible to starve lower priority tasks of processing time by creating too many high priority tasks.  Since higher priority tasks are processed both more frequently and more often than any task with a relatively lower priority, this may cause the perception that lower priority tasks are not being processed. In fact it may take a very long time to complete each further pass towards completion.