[Linux] PHP programmers play with the Linux series-using supervisor to implement daemon and supervisor daemon
1. PHP programmers turn to the Linux series-how to install and use CentOS
2. PHP programmers play with Linux series-lnmp Environment Construction
3. PHP programmers play with the
Linux System Programming (2nd edition)Jump to: Navigation, search
Directory
1 Getting Started and basic concepts
2 file I/O
3 buffered I/O
4 Advanced file I/O
5 Process Management
6 Advanced Process Management
7 Threads
8 file and directory management
9 Memory Management
Ten Signal
One time (not here system programming, is the C library API)
A Appendix A C-lan
Use of new Linux APIs signalfd, timerfd, and eventfdUse of new Linux APIs signalfd, timerfd, and eventfd
Three new versions of fd added to Linux kernel:
Signalfd: 2.6.22
Timerfd: 2.6.25
Eventfd: 2.6.22
Three fd meanings:
Lsignalfd
The traditional method of signal processing is to register a signal processing function. Because the signal occurs asynchronously, it
error occurred while writing data to 0 addressReturn}/************************* This function is used to reload the program************************/void Deal (void){Char buffer[255];memset (buffer, 0, sizeof (buffer));sprintf (Buffer, "CD ~/test");System (buffer);/** This delay is very important, if no delay, CTRL + C signal can not be processed in time (that is, CTRL + C failure), the program will be cyclic loading* If no delay is added, the program is re-executed later. The/TEST1 statement re
trap to a certain signal, so ... Of course it is, this script is too east. Time to take a chance. Look at ^_^.Report:Introduction to Linux signals1) SIGHUP This signal is issued at the end of the user terminal connection (normal or abnormal), usually at the end of the terminal control process, notify the same session of the various jobs, then they are no longer associated with the control terminal.2) SIGINT
How the signal is generated:1. Keyboard inputIf CTRL + C means a SIGINT signal is generated2. Abnormal signal generationThis is the case when the program executes to 2/0, the read segment of the pipe is closed and the write end still writes data to the pipeline ...3. Send a signal to the specified process by commandHow to handle the signal:1. Ignore2. Perform default processing (usually terminating program)3. Perform a custom action (capture of the si
Before looking at the signal, there is not much attention to the comparison of different signals. When I see it again today, I suddenly feel very similar to some of the signals, and even very easy to confuse. Let's take a moment to summarize this weekend.first, close the process signalThe common 4 off process signal is sigkill,sigint,sigterm,sigquit.
SIGKILL, which is used to close processes, cannot be captured or ignored. The scenario is tha
recovery parameter.The integer parameter passed to the signal processing routine is the signal value, which allows a signal processing routine to process multiple signals. The system call signal return value is the specified signal Signum the previous processing routine or error when the error code Sig_err is returned.1#include 2#include 3#include 4 5 voidSigroutine (intNO) {6 Switch(NO) {7 Casesigint:printf ("sigint\n"); Break;8
= Sa_resethand | Sa_nodefer;//See note (2)act.sa_flags = 0;//See note (3)sigaction(SIGINT, act, oldact);while (1) {Sleep (1);printf ("Sleeping%d\n", i);i++;}}Note:(1) If in the signal SIGINT (Ctrl + C) Signal processing function Show_handler execution process, the process receives a signal sigquit (crt+\), will block the signal until the end of Show_handler execution will not process the signal sigquit.(2)
1. Signal Processing functionThe related function prototypes are as follows:#include How the process handles the signal (the early signal processing mechanism):The process can tell the kernel how to handle the signal through the signal system call.1. Accept the default processingProcessing signal (SIGINT,SIG_DFL) According to the original intent area of the signal2. Ignore the signalSignal (sigint,sig_ign)
Linux IPC (Inter-Process Communication, Inter-process Communication) pipeline learning, ipcinter-Process1. the standard Stream pipeline operation supports the file stream mode, which is used to create the pipeline linking another process. This blog introduces the function popen and pclosepopen in detail. 2. unknown pipeline (PIPE) features: 1) communication can only be performed between kinship processes (Parent and Child or brother) 2) Half Duplex (f
narrow down the bug check scope by using the mail information. If it is an embedded device, you need to write the information into the file, save it in flash.
3. Use the watchdog to feed the dog. If the program is suspended or is stuck in an endless loop for a long time, the program will be reloaded.
4. Use the Linux signal mechanism to solve segment errors (a bit similar to the Soft Watchdog)
Next I will focus on the solution to the 4th key points
process of a smaller resource collection, which does not hold system resources, but by requesting resources to run the process, is the smallest unit of the system scheduling. A process can contain multiple threads.Zombie Process: This is destroyed after the process has been executed, but it is sometimes retained for some reason, although it has freed up most of the system resources, but still retains a small portion of the system resources, which we call "zombie process" for this process.the ca
One, what is the signal
With Windows we know that when we do not end a program properly, we can force the task Manager to end the process, but how does this actually happen? The same functionality is done on Linux by generating signals and capturing signals, and the running process captures the signal and then makes a certain operation and ends up being terminated.
Signals are an event generated by UNIX and Linu
A. Trap1.trap is a shell built -in command used to specify how signals are handled in the script. For example, pressing CTRL + C causes the script to terminate execution, in fact the system sends a SIGINT signal to the script process, and the default processing of the SIGINT signal is to exit the program. If you want to do not quit the program in CTRL + C, then you have to use the trap command to specify ho
One linux command every day (42): link to the kill Command: One linux command every day (1): ls command http://www.2cto.com/os/201210/163049.html ; One linux command every day (2): cd command http://www.2cto.com/os/201210/163050.html A linux command (42): kill Command every day link: A
For details about how to view camera parameters in Linux, refer to Linux general technology-Linux programming and kernel information. In linux, video-related tasks must involve the video for linux layer, which is abbreviated as v4l. This program is written based on this API
reason, on running UNIX systems during shutdown, init issuesSigterm to all processes that are not essential to powering off, waits a few seconds, and then issues sigkill to forcibly terminate other processes to allow the computer to halt.
Linux kill signal list
$ kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS
second and returns only when all the processes are dead. note: If the signal is ignored or does not work, or the process stays in the zombie state, killall may wait permanently.
Files)The location of the/proc file system.Known bugs (known bugs)Killing files only takes effect for executable files that have been opened during execution. That is, a hybrid executable file cannot be killed in this way.It should be warned that the input of killall name may not produce the expected results on non-
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.