11 - 462 11 - 462
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
If the specification of <timeout value> is omitted or "0:0:0:0" is specified in <timeout
value>, the program waits for an infinite time.
• It is possible to prohibit the use of multiple resources at any one time by specifying
multiple resource numbers in one program.
• When multiple programs use resources to which different resource numbers are
assigned, determine the order of the resource numbers specified in the ZRESERVE
instruction as follows in order to prevent programs from going into deadlock status (in
which case the execution cannot be made).
(The following shows a case where the resource numbers are specified from the
least order and the ZRESERVE instruction is executed.)
(Program-A-)
• •
ZRESERVE 0
ZRESERVE 1
ZRESERVE 2
ZRELEASE 2
• • • •
•
ZRELEASE 1
ZRELEASE 0
• •
•
• •
• •
• •
• • • •
•
(Program-B-)
ZRESERVE 1
ZRESERVE 2
ZRELEASE 2
ZRELEASE 1
• •
• • • •
•
• • • •
•
(Program-C-)
ZRESERVE 0
ZRESERVE 2
ZRELEASE 2
ZRELEASE 0
• •
•
• •
•
• •
•
• • • •
•
• • •
• • • •
•
• • •
•
• • • •
•
•
(Example of deadlock occurrence)
When programs -D- and -E- are being executed concurrently, if E executes line
number 150 before D executes line number 200, D stops executing at line number
200.
Then, if E tries to execute line number 220, the execution stops in line number 220
because D has already executed the ZRESERVE instruction and specified resource
number 0.
D waits for the execution of the ZRELEASE instruction for resource number 1 and E
waits for the ZRELEASE instruction for resource number 0, which means that the
two programs keep each other from being executed.
(Program-D-)
• •
150 ZRESERVE 0
200 ZRESERVE 1
250 ZRELEASE 1
260 ZRELEASE 0
• •
•
• •
• •
• •
(Program-E-)
150 ZRESERVE 1
220 ZRESERVE 0
260 ZRELEASE 0
270 ZRELEASE 1
• •
• •
• •
• •
• •
•
Deadlock status occurs.
1)
2)
3)
1)
2)
indicates the progress of the program execution time.
REMARK
• See Section 8.3 for the details about exclusive control of resources.
• See the ZRELEASE instruction.
Содержание 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...