//================================================================================================================================= [1] >> 进程间通信方式1--无名管道pipe [ -->>无名管道的使用流程 1>>int pipe(int pipefd[2]); #先创建无名管道,再创建子进程  #血缘进程 [ Description: pipe() creates a pipe, a unidirectional(单向) data channel that can be used for interprocess(进程间) communication. The array pipefd is used to return two file descriptors(文件描述符) referring to the ends of the pipe. pipefd[0] refers to the read end of the pipe. pipefd[1] refers to the write end of the pipe. Data written to the write end of the pipe is buffered(缓冲) by the kernel until it is read from the read end of the pipe ] ] //================================================================================================================================= [2] >> 进程间通信方式2--有名管道fifo [ -->>有名管道的使用流程 1>>int mkfifo(const char *pathname, mode_t mode); [ DESCRIPTION: mkfifo() makes a FIFO special file with name pathname. mode specifies the FIFO's permissions. It is modified(修改) by the process's
       umask in the usual way: the permissions of the created file are (mode & ~umask). Once you have created a FIFO special file in this way, any process
       can open it for reading or writing ] 2>>int open(const char *path, int oflag, ... ); 3>>ssize_t write(int fd, const void *buf, size_t count); 4>>ssize_t read(int fd, void *buf, size_t count); ] //================================================================================================================================= [3] >> 进程间通信方式3--信号
注意:程序接收到信号后,程序会暂停执行,转去响应信号,然后再继续执行程序 -->><1>kill -l 查看信号类型 #linux有64种信号 [ 所有常见到的信号: SIGNUP–中断关闭时触发–>进程终止
	
	SIGINT–ctrl+c触发该信号–>终止进程(为什么ctrl+c能关闭进程的原因) SIGQUIT–ctrl+\触发该信号–>终止进程(与ctrl+c效果一致) SIGILL–执行了非法指令时触发–>终止进程
	
	SIGSEV–内存溢出,野指针时触发–>终止进程(经常看见段错误后,进程就强制退出的原因) SIGPIPE–写入管道错误触发–>终止进程
	
	SIGKILL–用来关闭进程(进程被关闭的原因) SIGSTOP–暂停进程(gdb调试能设置断点暂停进程的原因) SIGTSTP–ctrl+z–暂停进程
	
	SIGCONT–继续运行进程(GDB调试,能继续运行程序的原因) SIGALRM–定时器信号;定时器时间到了后会让进程结束
	
	SIGUSR1/2–用户可以使用的两个信号 ] -->><2>信号处理方式 [ 缺省方式 (默认中断处理方式) 忽略该信号
	捕捉信号 (用户中断处理函数) ] -->><3>kill - <信号编号> <进程号> #终端先进程发送信号指令  #例1:kill -19 6688 ,6688进程发送信号19 -->><4>killall - <信号编号> <名称> #例1:kill -19 a.out ,向a.out所生成的所有进程发送信号19 -->><5>int kill(pid_t pid, int sig); -->><6>unsigned int alarm(unsigned int seconds); #set an alarm clock for delivery(交互) of a signal [ Description : #时间到了就向该进程发送闹钟信号 alarm() arranges for a SIGALRM signal to be delivered(递送) to the calling process in seconds seconds. Return Value : alarm() returns the number of seconds remaining(剩余) until any previously scheduled(分配) alarm was due(到期) to be delivered(递送), or zero if there was no previously scheduled alarm. ] -->><7>int pause(void); [ pause() causes the calling process (or thread) to sleep 
	until a signal is delivered that either terminates(结束) the process or causes the invocation of a signal-catching function. ] -->><8>sighandler_t signal(int signum, sighandler_t handler); [ 注意:typedef void (*sighandler_t)(int); signal() sets the disposition(处理) of the signal signum to handler, which is either SIG_IGN(忽略方式), SIG_DFL(缺省方式), or the address of a programmer-defined function
	SIG_IGN = ignored(忽略) SIG_DFL = default(默认) The signals SIGKILL and SIGSTOP cannot be caught(捕捉) or ignored(忽略). ] //================================================================================================================================= //=================================================================================================================================