Hierarchical process group management

Management of hierarchical process groups is provided. Aspects include creating a group identifier having an associated set of resource limits for shared resources of a processing system. A process is associated with the group identifier. A hierarchical process group is created including the process as a parent process and at least one child process spawned from the parent process, where the at least one child process inherits the group identifier. A container is created to store resource usage of the hierarchical process group and the set of resource limits of the group identifier. The set of resources associated with the hierarchical process group is used to collectively monitor resource usage of a plurality of processes in the hierarchical process group.

The following disclosure is submitted under 35 U.S.C. 102(b)(1)(A): “Monitor and control resource usage for groups of entry control blocks in IBM z/TPF” by Gabriel Nieves appearing in IBM developerWorks, Apr. 5, 2016, pages 1-8.

BACKGROUND

The present invention generally relates to computer processing systems, and more particularly to managing multiple computer processes in a hierarchical process group.

In multi-tasking processing systems, multiple processes can be active at the same time, where each process consumes processing system resources (e.g., main memory, CPU, disks, etc.). Resource monitoring utilities typically collect system resource usage by individual processes in isolation. This method of resource monitoring does not prevent a group of associated processes from collectively depleting all of the system resources. Resource depletion can be caused by a process creating numerous children processes, which individually may not raise any suspicions from a resource manager because each process does not exceed its own resource limits. A legitimate program with a defect or a malicious “fork bomb” may starve the processing system of all available resources by spawning additional processes to consume the resources. A typical solution is to establish resource limits on the entire system, which only mitigates the effect and reduces the performance of all of the other processes in the processing system.

Therefore, heretofore unaddressed needs still exist in the art to address the aforementioned deficiencies and inadequacies.

SUMMARY

In accordance with an embodiment, a computer-implemented method for managing hierarchical process groups is provided. The method includes creating a group identifier having an associated set of resource limits for shared resources of a processing system. The method further includes associating a process with the group identifier and creating a hierarchical process group including the process as a parent process and at least one child process spawned from the parent process, where the at least one child process inherits the group identifier. The method also includes creating a container to store resource usage of the hierarchical process group and the set of resource limits of the group identifier. The set of resource limits associated with the hierarchical process group is used to collectively monitor resource usage of a plurality of processes in the hierarchical process group.

In accordance with another embodiment, a computer program product for hierarchical process group management includes a non-transitory storage medium readable by a processing circuit and storing instructions for execution by the processing circuit for performing a method. The method includes creating a group identifier having an associated set of resource limits for shared resources of a processing system and associating a process with the group identifier. A hierarchical process group is created that includes the process as a parent process and at least one child process spawned from the parent process, where the at least one child process inherits the group identifier. A container is created to store resource usage of the hierarchical process group and the set of resource limits of the group identifier. The set of resource limits associated with the hierarchical process group is used to collectively monitor resource usage of a plurality of processes in the hierarchical process group.

In a further embodiment, a processing system for hierarchical process group management includes a memory system and one or more processors operable to share access to the memory system. The one or more processors are configured to create a group identifier having an associated set of resource limits for shared resources of the processing system and associate a process with the group identifier. The one or more processors are further configured to create a hierarchical process group including the process as a parent process and at least one child process spawned from the parent process, where the at least one child process inherits the group identifier. The one or more processors are also configured to create a container to store resource usage of the hierarchical process group and the set of resource limits of the group identifier and use the set of resource limits associated with the hierarchical process group to collectively monitor resource usage of a plurality of processes in the hierarchical process group.

DETAILED DESCRIPTION

Embodiments include methods, systems, and computer program products for managing hierarchical process groups (HPGs). Embodiments can improve computer system resource management, for example, by collecting and monitoring resource usage by groups of associated processes and taking targeted actions on the groups that are exceeding respective allocated sets of limits. In exemplary embodiments, an HPG is created when a parent process elects to be part of a group using a group identifier and spawns a child process. The HPG becomes a container for collecting and monitoring the resource usage for both processes and any future children. Resource limits of the HPG are assigned from the group identifier. By separating the creation of resource limits and monitoring groups, a single group identifier (also referred to as a named limit set) can be used to assign the same resource limits to more than one HPG.

Thus, as configured inFIG. 1, the processing system100includes processing capability in the form of processors101, storage capability in memory system125including the volatile memory114and/or mass storage104, input means such as keyboard109and mouse110, and output capability including speaker111and display115. In one embodiment, a portion of the volatile memory114and mass storage104collectively store the operating system120to coordinate the functions of the various components shown inFIG. 1.

An HPG service150can be incorporated in or interface with the operating system120to manage HPGs in accordance with embodiments as further described herein. In alternate embodiments, the HPG service150is incorporated in or accessible as a cloud computing service and/or other remotely accessible service (e.g., a distributed storage service accessible via network adapter106). The HPG service150can create HPGs, add processes to HPGs, remove processes from HPGs, and monitor resource usage with respect to defined limits.

Referring now toFIG. 2with continued reference toFIG. 1, a block diagram illustrating relationships between multiple process hierarchies in separate containers managed as HPGs is shown in accordance with an embodiment. A group identifier202can be used to associate multiple HPGs, including a first HPG204A, a second HPG204B, and a third HPG204C as illustrated in the example ofFIG. 2. Although depicted as associating three HPGs inFIG. 2, it will be understood that the group identifier202can be used to associate any number of HPGs. In some embodiments, the group identifier202is user-defined, for instance, through a command line interface or application programming interface and created in response to a user request.

The first, second, and third HPGs204A-204C can be system generated to associate processes in respective first, second, and third containers208A,208B,208C and first, second, and third group resource usage206A,206B,206C with the group identifier202. In the example ofFIG. 2, the first container208A includes a first parent process210A and a pair of child processes212A,214A. The second container208B includes a second parent process210B and a child process212B. The third container208C includes a third parent process210C and a pair of child processes212C,214C.

Before any of the HPGs204A-204C can be established, the group identifier202is created. The group identifier202is defined with a set of resource limits (e.g., a named limit set) for the HPGs204A-204C. The resource limits can be fixed or relative to the total allocated resources of the processing system100. A process may be associated with one and only one group identifier202. The group identifier202signifies that the process is eligible to have its resources monitored in an HPG. HPG management is further described with respect toFIGS. 3-5.

Referring now toFIG. 3, a method300for managing HPGs is shown. The method300is described in further reference toFIGS. 1 and 2and may be modified to include additional steps or an alternate order of steps. The method300may be performed through the HPG service150ofFIG. 1.

At block302, a group identifier202is created having an associated set of resource limits for shared resources of the processing system100. The set of resource limits can include one or more limits with respect to memory usage, a number of reads, a number of writes, a storage block size, and a processor usage. At block304, a process is associated with the group identifier202. At block306, an HPG is created, such as HPG204A, including the process as a parent process210A and at least one child process212A,214A spawned from the parent process210A, where the at least one child process212A,214A inherits the group identifier202.

At block308, a container208A is created to store resource usage206A of the HPG204A and the set of resource limits of the group identifier202. The one or more other HPGs204B-204C can separately store resource usage206B-206C of each of the one or more other HPGs204B-204C and the set of resource limits of the group identifier202.

At block310, the set of resource limits associated with HPG204A is used to collectively monitor resource usage of a plurality of processes in the HPG204A.

A process becomes associated with a group identifier either during its creation or afterward using, for instance, an application programming interface. When a process is given a group identifier using an application programming interface, it becomes possible for an HPG to be created for that process. When the process spawns a child process that inherits its group identifier, an HPG is created for both processes, such as parent process210B and child process212B of HPG204B.

For instance, HPG204B creates container208B for storing the resource usage206B of its members and copies the resource limits of the group identifier202of the parent process210B. As depicted in the example ofFIG. 4, a new child process402may inherit the group identifier202of its parent process during process creation and join the HPG of its parent process by copying the group identifier as depicted in blocks404and408ofFIG. 4. If the child process402does not inherit its parent's group identifier, it will not be associated with the HPG of the parent process nor help in its creation as depicted in blocks404and406. At block410, if the parent process is not in an HPG, then at block412an HPG is created for both the parent process and the child process; otherwise, the child process joins the HPG of the parent process at block414.

An HPG may continue to exist and monitor the resource usage of its members as long as at least one process is still a member. As depicted in the example ofFIG. 5, a process502is removed from an HPG when it exits or changes/removes its group identifier, as depicted in blocks504,506,508, and510. When the last process in the HPG leaves, the HPG is deleted as depicted by blocks512and514.

Any action may be taken on the single process or the whole group by a resource monitor when any usage limit is exceeded by the HPG. The resource limits and actions on the HPG may be independent from any resource monitoring of the individual processes.