Understanding Jobs
Within the context of the Trace Analyzer, the term job refers to
a unit of work which the program performs. Examples of such work
would be printing a report, or indexing the records in a trace file, or
applying a data filter. Generally speaking, tasks which meet the
following criteria are managed as jobs:
-
a task which may take a significant time to perform; or
-
a task which must be coordinated or synchronized with other activities
because they all require access to, and may each alter, the same data.
The following tasks are managed as jobs:
-
Loading a file (specifically, indexing the records in a trace)
-
Closing a file
-
Saving/exporting a file
-
Exiting the program
-
Applying a data filter
-
Searching
-
Printing
The Job Engine
Jobs are created as the result of some user action, such as loading a trace
file, or initiating a search. Upon creation, a job is submitted to
a job engine for processing. The job engine acts as a dispatcher
for jobs; its responsibilities are to:
-
add the new job to the queue of waiting jobs;
-
manage conflicts between jobs;
-
sort all waiting jobs in order of their priorities;
-
run the jobs in order of their priorities;
-
minimize the impact of this work on the user interface.
Once a job is submitted for processing as the result of a user action,
such as the click of a button, the program is free to continue responding
to the user's new requests, while the job engine does its work in the background.
In practice, complex or long running jobs may contend with the user interface
for the CPU, even though they are running in the background. This
can cause a noticeable impact on the responsiveness of the user interface.
Job Conflicts
A job submitted for processing may be in conflict with the another active
or queued job, due to:
-
a conflict in the nature of the work performed; or
-
a conflicting dependency upon shared resources.
As an example of case 1 above, a job which is submitted to close a trace
file has a conflicting goal with a job that is loading that file.
An example of case 2 above is a job which applies a new data filter to
the current trace file, while another job is printing, or waiting to print,
the currently loaded set of trace records.
When a job is submitted which results in such a conflict, the user is
prompted to resolve the situation via the Job Conflict dialog window
(see Figure 1).
Figure 1. Job Conflict dialog window
This window presents information about the newly submitted job, as well
as about any active or waiting jobs which would be preempted if the new
job is allowed to continue. The following actions can be taken to
resolve the conflict:
-
Confirm the submission of the new job. In this case, the dialog
is dismissed and all pending jobs listed immediately are aborted (if in
progress) or removed from the job queue (if waiting). The newly submitted
job is then processed.
-
Cancel the submission of the new job. In this case, the dialog
is dismissed and all pending jobs are allowed to continue normally.
The newly submitted job is discarded.
-
Do nothing. In this case, all pending jobs are allowed to
continue normally. After the last job completes, the dialog automatically
is dismissed, and the new job is then processed.
How Multiple Jobs are Organized
Only one job is actively running in the job engine at any given time.
All other jobs must wait until the active job completes. Jobs are
sorted in a queue by the job engine in the order in which they are to be
performed. This is not necessarily the same order in which they were
submitted, since some jobs by their nature must be performed before others,
or will make others obsolete. If there are any other jobs active
or queued when a new job is submitted, the job engine must determine:
-
how (if at all) the new job impacts the active job and any others waiting
in the queue;
-
where in the queue the new job will be placed.
Jobs are organized according to a priority scheme, in which different
types of work are assigned different priorities. In addition to its
priority, an attribute of each job is its precedence with respect
to other jobs; in other words, how other jobs are affected when this
job is submitted. Table 1 summarizes the precedence
assigned to the various job types used by the Trace Analyzer. The
table is organized in priority order by job type, with the highest (most
urgent) priority job type first, descending to the lowest (least urgent)
priority last.
Job Type |
Precedence Behavior |
Exit Program |
Aborts all other jobs of lower or equal priority *; becomes only
job in system |
Close Trace |
Aborts all other jobs of lower or equal priority * |
Load Trace |
Aborts all other jobs of lower or equal priority * |
Apply Data Filter |
Aborts all other jobs of lower or equal priority * |
Find Record |
Aborts only other Find Record jobs * |
Write Trace |
Aborts nothing; queues among waiting jobs first by priority,
then in order of submission (first in, first out) |
Print Report(s) |
Aborts nothing; queues among waiting jobs first by priority,
then in order of submission (first in, first out) |
Table 1. Job precedence and priority
(* Indicates there can be only one job of this
type at a time)
Copyright © 2000-2001 Golden Code
Development Corporation. ALL RIGHTS RESERVED.