SIGXCPU
Encyclopedia
On POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

-compliant platforms, SIGXCPU is the signal
Signal (computing)
A signal is a limited form of inter-process communication used in Unix, Unix-like, and other POSIX-compliant operating systems. Essentially it is an asynchronous notification sent to a process in order to notify it of an event that occurred. When a signal is sent to a process, the operating system...

 that is sent to a process
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...

 when it has used up the CPU for a duration that exceeds a certain predetermined user-settable value. name="setrlimit_posix_spec">
name="signal_h_posix_spec">

In source code, SIGXCPU is a symbolic constant
C preprocessor
The C preprocessor is the preprocessor for the C and C++ computer programming languages. The preprocessor handles directives for source file inclusion , macro definitions , and conditional inclusion ....

 defined in the header file
Header file
Some programming languages use header files. These files allow programmers to separate certain elements of a program's source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers...

 signal.h
Signal.h
signal.h is a header file defined in the C Standard Library to specify how a program handles signals while it executes. A signal can report some exceptional behavior within the program , or a signal can report some asynchronous event outside the program .A signal can be generated...

. Symbolic signal names are used because signal numbers can vary across platforms.

Etymology

SIG is a common prefix for signal names. XCPU is an abbreviation for "exceeded CPU time."

Usage

SIGXCPU is sent when the total time spent by the processor executing the process's instructions exceeds the allowed value, as determined by the user through the setrlimit or fcntl system call
System call
In computing, a system call is how a program requests a service from an operating system's kernel. This may include hardware related services , creating and executing new processes, and communicating with integral kernel services...

s (which can be invoked directly or through a shell builtin
Shell builtin
In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute....

 command). This is not the same as total elapsed time, as some of the time since the process started will have been spent waiting on I/O
Input/output
In computing, input/output, or I/O, refers to the communication between an information processing system , and the outside world, possibly a human, or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it...

 and servicing other processes.

By default, SIGXCPU will result in program termination. And the POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...

 standard further states that if this behavior is changed, namely, "if the process is catching or ignoring SIGXCPU, or all threads belonging to that process are blocking SIGXCPU, [then] the behavior is unspecified
Unspecified behavior
Unspecified behavior is a computer programming term used to describe behavior that may vary on different implementations of a programming language. A program can be said to contain unspecified behavior when its source code may produce an executable that exhibits different behavior when compiled on...

" by POSIX. Nevertheless, individual operating systems, like Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, usually define the act of catching or ignoring SIGXCPU as legitimate. Under this setting, the usage model of this signal is typically such that its arrival indicates to the receiving process that the process has reached a CPU consumption "soft limit", soon to be followed by a system-wide "hard limit"; when the latter is reached, the process will be delivered a SIGKILL
SIGKILL
On POSIX-compliant platforms, SIGKILL is the signal sent to a process to cause it to terminate immediately. The symbolic constant for SIGKILL is defined in the header file signal.h. Symbolic signal names are used because signal numbers can vary across platforms, however on the vast majority of...

 signal (cannot be ignored or caught), which would immediately terminate the process.

Thus, the arrival of a SIGXCPU signal provides the receiving process a chance to quickly save any intermediate results and to exit gracefully, before it is terminated by the operating system for good. This kind of a mechanism is especially important in supercomputers, where parallel programs run for long periods of time and use up immense computational resources. And indeed, supercomputer resource managers, like the IBM LoadLeveler
LoadLeveler
LoadLeveler is a job scheduler written by IBM, to control scheduling of batch jobs. LoadLeveler matches the job requirements with the best available computer resource for execution...

, make explicit use of SIGXCPU exactly for this purpose. name="ibm_aix_loadleveler03">


Other uses are possible. For example, on some operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s, the Boehm garbage collector
Boehm garbage collector
In computer science, the Boehm-Demers-Weiser garbage collector, often simply known as Boehm GC, is a conservative garbage collector for C and C++.Boehm GC is free software distributed under a permissive free software licence similar to the X11 license....

 uses SIGXCPU and SIGPWR
SIGPWR
On some Unix-like platforms, SIGPWR is the signal sent to computer programs when the system experiences a power failure. The symbolic constant for SIGPWR is defined in the header file signal.h...

 to synchronize cross-thread garbage collection.

Similarly, Mono
Mono
Mono is considered to refer most often to:* anything single, e.g. as in monorail, a train system using a single rail, as opposed to the conventional two-rail system...

's garbage collection makes use of the SIGXCPU signal to restart a suspended thread.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK