8 - 11 8 - 11
MELSEC-Q
8 MULTITASK PROCESSING
(3) Execution order of instructions when limiting access to the
resources
The following describes the execution order of instructions when limiting access
to the resources in the BASIC program.
ZRESERVE:
Requests mutual exclusive control of the resource.
ZRELEASE:
Finishes mutual exclusive control of the resource.
BASIC
program (A)
BASIC
program (B)
The privilege to use the resource
is transferred to program B, which
was kept waiting in the meantime.
Program B requested to use
the resource but is put into
the wait status because
program A is using the resource.
The use of the resource
is finished and
the resource is released.
The privilege to use
the resource is
transferred to program A.
Device to which
access is limited
(Resource number n)
ZRESERVE n
Request
Use
Finish
ZRESERVE n
ZRELEASE n
In use
ZRELEASE n
Request
Use
Finish
In use
As shown above, use the resource after executing the ZRESERVE instruction in order
to use the resource assigned to resource number n. Execute the ZRELEASE
instruction in order to finish using the resource.
Care must be taken when each of the programs executed simultaneously uses multiple
resources. If the order of the resource numbers specified by each ZRESERVE
instruction is not handled as arranged, both programs may keep each other from being
able to continue. (Deadlock prevention)
An example of a deadlock is shown next.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...