Basic knowledge about UNIX semaphores

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.