PATROL Virtual Machine Scheduler
After the code is optimized, a PATROL process is created (rtcell). This process is then scheduled for execution by passing the process on to the run-queue scheduler (mainrun-queue). When the time arrives for the process to be executed, the run-queue scheduler will hand the process to the PSL scheduler to ensure pseudo simultaneous execution by the execution engine.
The execution engine (also called instruction set processor) is responsible for executing the quad code instructions. Some functions that do not require host OS access can be handled completely within the interpreter. For example, a command like a += 5; is executed inside the VM.
To understand how the PATROL virtual machine works, the following sections explain the process for scheduling of tasks internally.
Main Loop
The following figure displays the scheduler components and there place within the main loop, the central wait state for the agent.
Scheduler Components
Everything the agent does gets initiated from the main loop. Within this loop, the agent will perform the tasks listed in the following table.
Tasks Performed by Agent in Main Loop
Main Run-Queue
The central data structure for the PATROL agent's scheduling of jobs is the main run-queue. This is an internal queue data structure that has all the executable commands, including discovery and pre-discovery, parameters, process cache cycle, menu commands etc. Every PATROL process that has to be scheduled by the Run-queue scheduler has an rtcell that contains the run time information of the process. The main runqueue has jobs that still have to be started, not jobs that are currently running.
The run-queue is ordered by the time that a command should run. This time is altered only by actions such as Update Parameter otherwise the command will run at the time scheduled.
Commands that should only execute once will not be rescheduled. Discovery and process cache has de ned reschedule periods (40 sec & 300 sec). These intervals can be changed my modifying the agent's configuration.
Scheduling is also affected by the agents internal self tuning measures.
A command that has to be executed immediately (i.e. menu command) gets placed at the front of the queue (see Scheduling a PSL process#SchedulingaPSLprocess-67251).