8 - 4 8 - 4
MELSEC-Q
8 MULTITASK PROCESSING
(3) Execution order when BASIC programs are executed
simultaneously
The following explains the execution order of each program when multiple BASIC
programs are executed at start-up.
In reality, the BASIC programs do not operate (execute) by themselves. Each
BASIC program operates together with the system program according to the
scheduling by the system of the communication module.
When multiple BASIC programs run in parallel, the communication module
selects (gives execution privilege to) the program with the highest priority among
the executable programs (see the previous page) in the queue at the time of
switching execution of each program. Then it lets the program execute until the
next execution switching occurs. By repeating this operation, the communication
module allows multiple programs to run in parallel.
Priority (high)
Priority (low)
Programs that became
executable are sorted
by their priorities and
are placed in the queue.
The program with the highest
priority or which entered
the queue the earliest is
executed first.
n
n
Queue
3
1
2
2
The program given the execution privilege by the OS goes into the execution
status and executes the specified instructions as shown in the figure above. It
makes a transition to the next status when the switching of the execution occurs.
Makes a transition to
another status
according to the
instruction executed
immediately before
the switching of the
execution.
Execution status
Executable status
Wait status
Sleep status
Stop status