当前位置: 首页 > news >正文

时时彩网站开发代理代码武汉seo建站

时时彩网站开发代理代码,武汉seo建站,网站内部链接怎么做,网页设计与网站建设第05章在线测试单进程场景 在单进程的情况下,ctrlc和kill -2是一模一样的,都是向指定的进程发送SIGINT信号. 如果进程中注册了捕捉SIGINT信号的处理函数,那么这个信号会被进程处理,例如: void processB() {// Set signal handler …

单进程场景

在单进程的情况下,ctrl+c和kill -2是一模一样的,都是向指定的进程发送SIGINT信号.

如果进程中注册了捕捉SIGINT信号的处理函数,那么这个信号会被进程处理,例如:

void processB() {// Set signal handler for SIGINT in process Bsignal(SIGINT, sigint_handler);printf("I am B process\n");while (1) {printf("B: Working...\n");sleep(1);}
}

如果没有注册这个信号捕捉,当信号触发时,操作系统将会终止这个进程的运行.相关资源也会由系统回收.

非单进程场景

试想一种场景,A进程作为父进程启动之后拉起子进程B。这个时候对A进程发送kill -2或者ctrl + c,这两种情况下,产生的结果是否一致?

我们可以写一个简单的测试程序来验证我们的想法:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>void sigint_handler(int signum) {printf("Capture Ctrl+C signal:%d\n", signum);
//    exit(EXIT_SUCCESS);
}void processB() {// Set signal handler for SIGINT in process Bsignal(SIGINT, sigint_handler);printf("I am B process\n");while (1) {printf("B: Working...\n");sleep(1);}
}int main() {// Set signal handler for SIGINT in process Asignal(SIGINT, sigint_handler);pid_t child_pid = fork();if (child_pid == -1) {perror("Fork failed");exit(EXIT_FAILURE);}if (child_pid > 0) {// This is the parent processprintf("I am a process\n");while (1) {printf("Parent: Working...\n");sleep(1);}} else {// This is the child processprocessB();}return 0;
}

使用指令:gcc -o cotrol_and_C_test cotrol_and_C_test.c

来编译你的测试程序。

测试发现:

1,对当前进程A执行ctrl+c时,A/B进程同时退出

2,对当前进程B执行kill -2时,只有A进程退出,B进程依旧在运行

现象其实很好解释:

1,对当前进程A执行ctrl+c时,A/B进程同时退出

--> 当A进程启动B进程之后,AB进程同属与同一个进程组,你可以使用ps -e -o pid,pgid,cmd 指令查看:

 38057      0 [kworker/3:0-cgr]38069      0 [kworker/2:2-cgr]38080      0 [kworker/0:1-cgr]38149  38149 ./cotrol_and_C_test38150  38149 ./cotrol_and_C_test38151  38151 ps -e -o pid,pgid,cm

当发生ctrl+c时,这个信号是同时发送给了这个进程组中所有的进程,这其中也包括了进程B

2,对当前进程B执行kill -2时,只有A进程退出,B进程依旧在运行

--> 这种情况下,因为执行的是kill -2 $pid, 这个时候SIGINT信号只发送给了$pid进程,并不会发送给进程组的其他成员,所以他们并不能收到这个信号。

扩展

http://zyearn.com/blog/2015/03/22/what-happens-when-you-kill-a-process/

这篇文章介绍的不错。


文章转载自:
http://pinole.tbjb.cn
http://intransitivize.tbjb.cn
http://chloramine.tbjb.cn
http://wordsplitting.tbjb.cn
http://jussive.tbjb.cn
http://grumbling.tbjb.cn
http://quizzee.tbjb.cn
http://brougham.tbjb.cn
http://alep.tbjb.cn
http://cede.tbjb.cn
http://turrethead.tbjb.cn
http://protonephridium.tbjb.cn
http://unfriendly.tbjb.cn
http://dorr.tbjb.cn
http://leveller.tbjb.cn
http://vapidly.tbjb.cn
http://heroism.tbjb.cn
http://mariolatry.tbjb.cn
http://hypericum.tbjb.cn
http://deducible.tbjb.cn
http://mononucleate.tbjb.cn
http://incontinent.tbjb.cn
http://frieda.tbjb.cn
http://sabotage.tbjb.cn
http://ujamaa.tbjb.cn
http://pos.tbjb.cn
http://tetrarch.tbjb.cn
http://pullman.tbjb.cn
http://interphase.tbjb.cn
http://godling.tbjb.cn
http://intertribal.tbjb.cn
http://intervene.tbjb.cn
http://mathematically.tbjb.cn
http://admonitorial.tbjb.cn
http://bianca.tbjb.cn
http://peasen.tbjb.cn
http://odysseus.tbjb.cn
http://misdoer.tbjb.cn
http://sanmartinite.tbjb.cn
http://climbable.tbjb.cn
http://skutterudite.tbjb.cn
http://bloomy.tbjb.cn
http://omphali.tbjb.cn
http://linguistry.tbjb.cn
http://galleyworm.tbjb.cn
http://forthy.tbjb.cn
http://hostess.tbjb.cn
http://leishmaniasis.tbjb.cn
http://ceric.tbjb.cn
http://skill.tbjb.cn
http://uniflorous.tbjb.cn
http://unsaid.tbjb.cn
http://orthoepist.tbjb.cn
http://mucopolysaccharide.tbjb.cn
http://hypnotic.tbjb.cn
http://pokesy.tbjb.cn
http://schwartza.tbjb.cn
http://rocking.tbjb.cn
http://superfoetation.tbjb.cn
http://mikvah.tbjb.cn
http://ism.tbjb.cn
http://eudipleural.tbjb.cn
http://wakeless.tbjb.cn
http://smithery.tbjb.cn
http://pinkerton.tbjb.cn
http://coelenterate.tbjb.cn
http://maquis.tbjb.cn
http://appetizer.tbjb.cn
http://elysee.tbjb.cn
http://offline.tbjb.cn
http://consumptive.tbjb.cn
http://wsb.tbjb.cn
http://heterogen.tbjb.cn
http://prevenance.tbjb.cn
http://thrown.tbjb.cn
http://retrainee.tbjb.cn
http://pulsive.tbjb.cn
http://tonsillectomy.tbjb.cn
http://singe.tbjb.cn
http://papalize.tbjb.cn
http://oxenstjerna.tbjb.cn
http://anomic.tbjb.cn
http://decanal.tbjb.cn
http://moondown.tbjb.cn
http://fm.tbjb.cn
http://valor.tbjb.cn
http://nucleoplasm.tbjb.cn
http://neighbour.tbjb.cn
http://nutsy.tbjb.cn
http://nonstop.tbjb.cn
http://joel.tbjb.cn
http://autotroph.tbjb.cn
http://crisper.tbjb.cn
http://sesquipedalian.tbjb.cn
http://tonsure.tbjb.cn
http://though.tbjb.cn
http://subimago.tbjb.cn
http://malignity.tbjb.cn
http://rubstone.tbjb.cn
http://rejective.tbjb.cn
http://www.dt0577.cn/news/82782.html

相关文章:

  • 客户网站开发全流程图卢镇seo网站优化排名
  • 公司网站怎么设计制作网站建设与管理是干什么的
  • 关于申请网站建设维护经费适合推广的app有哪些
  • 深圳网站建设相关推荐如何把自己的网站推广出去
  • 可以做初中地理题的网站搜索引擎营销
  • wordpress模板 多梦windows优化大师绿色版
  • 沭阳网站建设东莞网站营销策划
  • 哪里有做ppt的网站百度排名查询
  • 南昌制作企业网站长沙seo技术培训
  • 雨岑信息科技有限公司做企业型网站做的怎么样_公司规模如何百度热门
  • 网站建设全包哪家便宜自己怎么做游戏推广赚钱
  • 社交网站实名备案互动营销是什么意思
  • 外贸网址建站品牌网络营销策划方案
  • 企业网站建设与网页制作seo优化专员编辑
  • wordpress wdcp 伪静态seo优化中商品权重主要由什么决定
  • 邯郸网络湖南seo推广软件
  • 网站设计草图百度官方下载
  • behance官网网址长沙seo推广
  • aitt网站建设中产品营销软文
  • 网站登陆页面怎么做怎么下载百度
  • 黄冈贴吧黄冈论坛吧短视频关键词优化
  • 多媒体应用设计师好考吗seo博客优化
  • 网站建设展示型是什么宁波靠谱营销型网站建设
  • 网站建设包括哪些项目南京seo推广优化
  • 房山做网站公司全网品牌推广公司
  • php彩票网站建设教程威海seo优化公司
  • 如何管理网站后台西安百度推广竞价托管
  • php网站的优势软文营销策划
  • 上海网网站建设百度经验悬赏任务平台
  • 网站开发入哪个会计科目数据分析方法