8 - 9 8 - 9
MELSEC-Q
8 MULTITASK PROCESSING
(1) To limit the access to the resource
In order to limit the access to resources, the following should first be understood:
(a) Mutual exclusive control of the resource is performed strictly under the
agreement between the programmers. The mutual exclusive control of the
resource is meaningless if such agreement is not followed.
1
1
Programmer A
Programmer B
The resource with a given resource number
(e.g., the text screen) must be referenced
using the same number by all programs.
1
5
Programmer A
Programmer B
If the resource number of a resource
(e.g., the text screen) is different
between programs, the mutual exclusive
control cannot be achieved.
(b) A program that uses a resource (see (2)) with an assigned resource number
must always execute the ZRESERVE instruction before it uses the
resource. After finishing using the resource, it must execute the ZRELEASE
instruction immediately so that another program can use the resource.
If the resource with the assigned resource number is already being used by
another program when the ZRESERVE instruction is executed, the
execution is halted until that program finishes using the resource and
executes the ZRELEASE instruction.
In order to prevent the execution of a program from being stopped for a
long period of time, specify a "timeout" when executing the ZRESERVE
instruction.
An error occurs if the resource is not available within the specified period of
time, which makes it possible to perform another processing by the error
handling.
(c) Try to limit the access to one resource at a time if possible when using
resources to which resource numbers are assigned.
(d) When using multiple resources with assigned resource numbers
simultaneously, decide the order of the specified resource numbers in each
ZRESERVE instruction. (To prevent deadlock of the program.)
For example, use the resources in sequence from the smaller or largest
resource number. (See (3).)
Содержание 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...