Guardian Programmer's Guide

Table Of Contents
Introduction to Guardian Programming
Guardian Programmer’s Guide 421922-014
1 - 24
Synchronizing Processes
ZSYSTAL contains literals and data structure declarations for TAL programs.
ZSYSC contains literals and data structure declarations for C programs.
ZSYSCOB contains literals and data structure declarations for COBOL85
programs.
ZSYSPAS contains literals and data structure declarations for Pascal programs.
To use the DDL declarations in your application, include the appropriate ZSYS file in
your program. You do this using a ?SOURCE compiler directive before your program
uses any of the literals or data structures listed in the ZSYS file. Like the EXTDECS
files, you need to list only the sections that contain the declarations you need.
The following example for a TAL program includes the literals declared in the
FILENAME^CONSTANT and FILESYSTEM^CONSTANT sections of the ZSYSTAL file:
?SOURCE $SYSTEM.ZSYSDEFS.ZSYSTAL(FILENAME^CONSTANT,
? FILESYSTEM^CONSTANT)
Synchronizing Processes
One or more processes executing concurrently may need to share a particular
resource. This sharing of resources can result in conflicts and possible errors. Binary
semaphores provide a way to synchronize processes so that only one process at a
time can access a shared resource. While a process is using the resource, other
processes can execute concurrently until they need to use the resource; they then
enter a wait state. When the original process is through with the resource, it releases
its hold on the resource, and a waiting process is selected to resume execution and
use the resource.
Using binary semaphores, you can maximize parallelism in processes (that is, the
de
gree to which processes execute concurrently) while ensuring that conflicts over
shared resources are avoided.
Coding programs to use binary semaphores is described in Section
26, Synchronizing
Processes.
Note. Many programming examples shown throughout this guide make use of the literals in
the ZSYSTAL file. You can recognize them by the first four characters, which are always
“ZSYS.