Guardian Procedure Calls Reference Manual (G06.25+)

Guardian Procedure Calls (F)
Guardian Procedure Calls Reference Manual522629-013
5-119
FILE_OPEN_ Procedure
Multiple opens on a given file can create a deadlock. The following shows how a
deadlock situation occurs:
error := FILE_OPEN_ ( myfile:len , filenuma ... );
! first open on file myfile.
.
.
error := FILE_OPEN_ ( myfile:len , filenumb ... );
! second open on file myfile.
.
.
error := FILE_OPEN_ ( myfile:len , filenumc ... );
! third open on file myfile.
.
----
d .
e LOCKFILE ( filenumb, ... ); ! the file is locked
a . ! using the file number
d . ! associated with the
l . ! second open.
o READUPDATE ( filenumc, ... ); ! update the file
c . ! associated with the
k . ! third open.
----
Locks are granted on an open file (that is, file number) basis. Therefore, if a
process has multiple opens of the same file, a lock of one file number excludes
access to the file through other file numbers. The process is suspended forever if
the default locking mode is in effect.
You now have a deadlock. The file number referenced in the LOCKFILE call
differs from the file number in the READUPDATE call.
Limit on number of concurrent opens
There is a limit on the total number of concurrent opens permitted on a file. This
determination includes opens by all processes. The specific limit for a file is
dependent on the file’s device type:
Disk Files Cannot exceed 32,767 opens per disk
Process Defined by process (see discussion of controlling openers in the
Guardian Programmer’s Guide)
$0 Unlimited opens
$0.#ZSPI 128 concurrent opens permitted
$OSP 10 times the number of subdevices (up to a maximum of 830
opens)
$RECEIVE One open per process permitted
Other Varies by subsystem
Nowait I/O