# US 2013/0254770 A1 · Method for singleton process control

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2013/0254770 A1
- Document ID: US20130254770A1
- Status: Published application
- Kind: A1
- Application number: 13/901,791
- Filed: 2013-05-24
- Published: 2013-09-26
- Earliest claimed: 2008-01-21
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Mario F. ACEDO; Ezequiel CERVANTES; Paul A. JENNAS, II; Jason L. PEIPELMAN; Matthew J. WARD
- Web page: https://patentgrep.com/patent/US20130254770A1

## CPC

- G06F 9/48: Program initiating; Program switching, e.g. by interrupt
- G06F 9/445: Program loading or initiating (bootstrapping G06F9/4401; security arrangements for program loading or initiating G06F21/57)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for singleton process control in a computer environment is provided. A process identification (PID) for a background process is stored in a first temporary file. The PID is stored by a parent process and subsequently accessed by the background process. The background process is exited if an active PID is determined to exist in a second, global temporary file. The PID from the first temporary file is stored into the second, global temporary file. A singleton code block is then executed.

## Claims

### Claim 1

A method for singleton process control in a computer environment, comprising:
storing a process identification (PID) of a last spawned process for a background process in a first temporary file, the PID stored by a parent process, and subsequently accessed by the background process that is initialized;
initializing a background process variable for keeping track of a predetermined number of tries the parent process is checked to determine if the parent process is alive;
determining if the parent process is alive for the predetermined number of tries, wherein a PID of the background process is written from the first temporary file into a first PID variable when the parent process ends;
storing into the background process variable for so long as the parent process is active;
determining whether a second, global temporary file is empty, wherein:
if the global temporary file is empty:
commencing for a first time an associated program with the PID of the background process if a second, global temporary file is empty, and
storing the PID of the background process from the first temporary file into the second, global temporary file;
writing the existing PID to a second PID variable; and
executing a singleton code block.

### Claim 2 (depends on 1)

The method of claim 1, further including:
if the global temporary file is not empty:
determining if an existing PID stored within the second, global temporary file is active, wherein
if the existing PID is determined to be active in the second, global temporary file, exiting a process associated with the existing PID, and
if the existing PID is determined to be not active in the second, global temporary file, storing the PID of the background process from the first temporary file into the second, global temporary file.

### Claim 3 (depends on 1)

The method of claim 1, further including, previous to storing the PID from the first temporary file into the second, global temporary file, determining if the second, global temporary file is empty.

### Claim 4 (depends on 1)

The method of claim 1, further including creating the first temporary file.

### Claim 5 (depends on 4)

The method of claim 4, further including creating the second, global temporary file.

### Claim 6 (depends on 5)

The method of claim 5, further including starting the background process.

### Claim 7 (depends on 6)

The method of claim 6, further including:
initializing a background process variable,
determining if the parent process is alive for a predetermined number of tries, and
storing into the background process variable for so long as the parent process is active.

### Claim 8 (depends on 7)

The method of claim 7, further including if the predetermined number of tries is reached:
sleeping for a predetermined time, and
redetermining if the parent process is alive for the predetermined number of tries.

### Claim 9 (depends on 8)

The method of claim 8, further including ensuring only one instance of the associated program is started by using the PID of the background process and not using program names, wherein a wrapper script returns a prompt to a user as calls to start a program as the parent process dies.

### Claim 10

A system for singleton process control in a computing environment, the system comprising:
a plurality of files in the computing system;
at least one memory in the computing system; and
at least one processor device operable in the computing environment the singleton process control in communication with the plurality of files and the at least one memory, wherein the at least one processor device:
stores a process identification (PID) of a last spawned process for a background process in a first temporary file, the PID stored by a parent process, and subsequently accessed by the background process that is initialized,
initializes a background process variable for keeping track of a predetermined number of tries the parent process is checked to determine if the parent process is alive,
determines if the parent process is alive for the predetermined number of tries, wherein a PID of the background process is written from the first temporary file into a first PID variable when the parent process ends,
stores into the background process variable for so long as the parent process is active, and
determining whether a second, global temporary file is empty, wherein:
if the global temporary file is empty:
commencing for a first time an associated program with the PID of the background process if a second, global temporary file is empty, and
storing the PID of the background process from the first temporary file into the second, global temporary file;
writing the existing PID to a second PID variable; and
executing a singleton code block.

### Claim 11 (depends on 10)

The system of claim 10, wherein the at least one processor device that performs each one of:
if the global temporary file is not empty:
determining if an existing PID stored within the second, global temporary file is active, wherein
if the existing PID is determined to be active in the second, global temporary file, exiting a process associated with the existing PID, and
if the existing PID is determined to be not active in the second, global temporary file, storing the PID of the background process from the first temporary file into the second, global temporary file.

### Claim 12 (depends on 10)

The system of claim 10, wherein the at least one processor device that, previous to storing the PID from the first temporary file into the second, global temporary file, determines if the second, global temporary file is empty.

### Claim 13 (depends on 10)

The system of claim 10, wherein the at least one processor device that creates the first temporary file.

### Claim 14 (depends on 13)

The system of claim 13, wherein the at least one processor device that creates the second, global temporary file.

### Claim 15 (depends on 14)

The system of claim 14, wherein the at least one processor device that starts the background process.

### Claim 16 (depends on 15)

The system of claim 15, wherein the at least one processor device that performs one of:
initializing a background process variable,
determining if the parent process is alive for a predetermined number of tries, and
storing into the background process variable for so long as the parent process is active.

### Claim 17 (depends on 16)

The system of claim 16, wherein the at least one processor device that, if the predetermined number of tries is reached, performs each of:
sleeping for a predetermined time, and
redetermining if the parent process is alive for the predetermined number of tries.

### Claim 18 (depends on 17)

The system of claim 17, wherein the at least one processor device that ensures only one instance of the associated program is started by using the PID of the background process and not using program names, wherein a wrapper script returns a prompt to a user as calls to start a program as the parent process dies.

### Claim 19

A computer program product for singleton process control in a computer environment, the computer program product comprising a computer-readable storage medium having computer-readable program code portions stored therein, the computer-readable program code portions comprising:
a first executable portion that stores a process identification (PID) of a last spawned process for a background process in a first temporary file, the PID stored by a parent process, and subsequently accessed by the background process that is initialized;
a second executable portion that initializes a background process variable for keeping track of a predetermined number of tries the parent process is checked to determine if the parent process is alive;
a third executable portion that determines if the parent process is alive for the predetermined number of tries, wherein a PID of the background process is written from the first temporary file into a first PID variable when the parent process ends;
a fourth executable portion that stores into the background process variable for so long as the parent process is active; and
a fifth executable portion that determining whether a second, global temporary file is empty, wherein:
if the global temporary file is empty:
commencing for a first time an associated program with the PID of the background process if a second, global temporary file is empty, and
storing the PID of the background process from the first temporary file into the second, global temporary file;
writing the existing PID to a second PID variable; and
executing a singleton code block.

### Claim 20 (depends on 19)

The computer program product of claim 19, further including a seventh executable portion that performs each one of:
if the global temporary file is not empty:
determining if an existing PID stored within the second, global temporary file is active, wherein
if the existing PID is determined to be active in the second, global temporary file, exiting a process associated with the existing PID, and
if the existing PID is determined to be not active in the second, global temporary file, storing the PID of the background process from the first temporary file into the second, global temporary file.

### Claim 21 (depends on 19)

The computer program product of claim 19, further including a seventh executable portion that, previous to storing the PID from the first temporary file into the second, global temporary file, determines if the second, global temporary file is empty.

### Claim 22 (depends on 19)

The computer program product of claim 19, further including a seventh executable portion that that creates the first temporary file.

### Claim 23 (depends on 22)

The computer program product of claim 22, further including an eighth executable portion that that creates the second, global temporary file.

### Claim 24 (depends on 23)

The computer program product of claim 23, further including a ninth executable portion that that starts the background process.

### Claim 25 (depends on 24)

The computer program product of claim 24, further including a tenth executable portion that that performs one of:
initializing a background process variable,
determining if the parent process is alive for a predetermined number of tries, and
storing into the background process variable for so long as the parent process is active.

### Claim 26 (depends on 25)

The computer program product of claim 25, further including an eleventh executable portion that, if the predetermined number of tries is reached, performs each of:
sleeping for a predetermined time, and
redetermining if the parent process is alive for the predetermined number of tries.

### Claim 27 (depends on 26)

The computer program product of claim 26, further including a twelfth executable portion that ensures only one instance of the associated program is started by using the PID of the background process and not using program names, wherein a wrapper script returns a prompt to a user as calls to start a program as the parent process dies.
