Guardian Procedure Calls Reference Manual
assigned, except in the case of backup opens. When a file is closed, its file number becomes
available for a subsequent file open to use.
• Maximum number of open files
The maximum number of files in the system that can be open at any given time depends on
the space available for control blocks: access control blocks (ACBs), file control blocks (FCBs),
and open control blocks (OCBs). The amount of space available for control blocks is limited
primarily by the physical memory size of the system. The maximum amount of space for ACBs
is determined by the size of the process file segment (PFS). See the description of the pfs-size
parameter under the PROCESS_CREATE_ Procedure (Superseded by PROCESS_LAUNCH_
Procedure) (page 985).
• Multiple opens by the same process
If a given file is opened more than once by the same process, a unique file number is returned
for each open. These file numbers provide logically separate accesses to the same file; each
file number has its own ACB, its own file position, and its own last error value. If a nowait IO
operation is started and a second nowait operation is started (using a second file number for
the same file), the IO requests are independent and may arrive in either order at the destination
and may complete in either order.
Multiple opens on a given file can create a deadlock. This 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:
Cannot exceed 65,279 opens per disk.Disk Files
Defined by process (see discussion of controlling openers in the Guardian Programmer’s Guide).Process
Unlimited opens.$0
462 Guardian Procedure Calls (F)