Original article: http:// OS .51cto.com/art/201004/195920.htm
UNIX semaphores are also frequently used in our use. Today, we will learn about UNIX semaphores. A signal is a soft interrupt and a method for processing asynchronous events. Generally, the operating system supports many signals. Especially UNIX, which is an important applicationProgramGenerally, signals are processed.
UNIX defines many signals. For example, SIGINT indicates the interrupt character signal, that is, CTRL + C signal, sigbus indicates the hardware fault signal, and sigchld indicates the sub-process status change signal; sigkill indicates the signal to terminate the program, and so on. Semaphore programming is a very important technology in UNIX.
UNIX semaphores can also be viewed in the file/usr/include/sys/signal. h.
# The define sighup process starts when the control terminal dies or the control terminal issues a command
# Signal generated by define SIGINT keyboard interruption
# Define sigquit keyboard termination
# Define sigill illegal command
# Define sigtrap process encounters a trace or an interrupt nesting
# Define SIGABRT: the interrupt signal generated by the abort system call
# Define sigiot is similar to SIGABRT
# Define sigbus process attempts to use unreasonable memory
# Define sigfpe floating point exception
# Define sigkill kill
# Define SIGUSR1 User-Defined
# Define SIGSEGV segment Error
# Define sigusr2 User-Defined
# Define sigpipe: Write-only is not read during pipeline operation
# Define sigalrm the timer clock signal generated by the alarm system call
# Define sigterm process for receiving terminal Signals
# Define sigstkflt stack Error
# Signal that the define sigchld sub-process sends to the parent process that the sub-process has stopped or ended
# Define sigcont signal for continued operation
# Define sigstop stop
# Stop signal generated by the define sigtstp keyboard
# Define sigttin the stdin data needs to be read when running in the backend state
# Define sigttou write to stdout when running in the backend state
# Define sigurg socket emergency
# Define sigxcpu excessive CPU allocation time
# The define sigxfsz process uses a file that exceeds the length specified by the system.
# Define sigvtalrm internal alarm clock expiration
# Define sigprof depicts clock set expiration in a program segment
# Define sigwinch terminal window change
# Define sigio non-synchronous Io
# Define sigpoll sigio pollable event
Use the trap <command-List> <signal-List>
We hope you can remember the above knowledge about UNIX semaphores for future use.
Original article: http:// OS .51cto.com/art/201004/195920.htm
More UnixArticleSee http:// OS .51cto.com/col/522/