Limiting Disk Usage

The system administrator can use the disk resource control (DRC) system to limit the disk usage of each user. For each usercode, the administrator can establish the maximum amount of space the user can use on each family. The limits are applied in a somewhat different manner for permanent and temporary disk files.

For permanent disk files, the limits imposed by the system administrator apply to the total of all the user's files on a given family. Any process that attempts to increase the total file usage beyond the limit receives an I/O error. For example, suppose the system administrator has established a limit of 2 megabytes on the disk usage for usercode CHAN on DBFAM family. Suppose there are already 1999999 bytes of permanent files under CHAN usercode on DBFAM, and a process attempts a write operation that requires another area to be allocated for one of these files. In this case, the write operation fails.

For temporary disk files, the limits imposed by the system administrator apply to individual processes running under the specified usercode. The administrator specifies the limit by assigning a TEMPFILELIMIT attribute to the usercode. This in turn sets a limit on the value that can be stored by the TEMPFILELIMIT task attribute of processes running under the usercode. If a process attempts to increase its temporary file usage beyond the number of megabytes specified by TEMPFILELIMIT, the process receives an I/O error.

For example, if the TEMPFILELIMIT for usercode CHAN is 3 megabytes, there can be two different processes running with CHAN usercode that each use 2 megabytes for temporary files. The total temporary file usage is thus 4 megabytes. This is not a violation of the TEMPFILELIMIT because the limit is enforced on a process-by-process basis.

Note also that, unlike the permanent disk file limits, the TEMPFILELIMIT cannot be linked to a particular disk family. The process might allocate its temporary files on any family. For example, if the TEMPFILELIMIT is 3 megabytes, and the process has allocated 2 megabytes of temporary files on DBFAM, the process can allocate no more than 1 megabyte on SYSPK.

At any given time, the TEMPFILEMBYTES task attribute records the total number of disk megabytes in use by the process for temporary files. The process can interrogate this task attribute to determine the process is nearing the TEMPFILELIMIT value. Alternatively, you can design the process to include I/O error handling that enables the process to recover from temporary file limit errors.

For information about permanent and temporary disk files, and about I/O error handling, refer to the I/O Subsystem Programming Guide. For more information about the DRC system, refer to the System Administration Guide and the System Operations Guide.