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

网站做备案关停会显示什么网站流量依赖率

网站做备案关停会显示什么,网站流量依赖率,苏州绿叶网站建设,做网站ps建立多大的画布一、进程创建 1.1 认识fork函数 在linux中fork函数是非常重要的函数#xff0c;它从已存在进程中创建一个新进程。新进程为子进程#xff0c;而原进程为父进程。 进程调用fork#xff0c;当控制转移到内核中的fork代码后#xff0c;内核将 分配新的内存块和内核数据结构…一、进程创建 1.1 认识fork函数 在linux中fork函数是非常重要的函数它从已存在进程中创建一个新进程。新进程为子进程而原进程为父进程。 进程调用fork当控制转移到内核中的fork代码后内核将 分配新的内存块和内核数据结构给子进程将父进程部分数据结构内容拷贝至子进程添加子进程到系统进程列表当中fork返回开始调度器调度 1.2 写时拷贝 通常父子代码共享父子在不写入时数据也是共享的当任意一方试图写入便以写时拷贝的方式各自一份副 本。具体见下图 其实我们使用fork()函数创建子进程时操作系统会将父进程数据权限置为只读。后续当我们想要向子进程写入时首先会触发系统错误引起缺页中断而后操作系统就会进行检测当判断为该数据是可写入时发生写时拷贝。 进行写时拷贝时首先会向操作系统申请内存空间进行拷贝然后修改页表对应的物理内存最后将读写权限恢复即可。整个过程都是由操作系统自主实现的。 二、进程终止 前面我们有谈到过当进程退出时会返回父进程或操作系统一个退出码。我们可以使用$?来查看最近一个进程的退出码用0表示正常退出非零表示各种各样的退出原因可以自己设置。 2.1 进程终止的方式 main函数返回 #includestdio.hvoid func() {printf(Hello World!\n); }int main() {func();return 0; }[caryonVM-24-10-centos lesson16]$ ./code Hello World! [caryonVM-24-10-centos lesson16]$ echo $? 0调用exit #includestdio.h #includestdlib.hvoid func() {printf(Hello World!\n);exit(100); }int main() {func();printf(process is done!\n);return 0; }[caryonVM-24-10-centos lesson16]$ ./code Hello World! [caryonVM-24-10-centos lesson16]$ echo $? 100调用_exit #includestdio.h #includestdlib.h #includeunistd.h void func() {printf(Hello World!\n);_exit(100); }int main() {func();printf(process is done!\n);return 0; }[caryonVM-24-10-centos lesson16]$ ./code Hello World! [caryonVM-24-10-centos lesson16]$ echo $? 100Ctrlc 这个我们很常用了就不多赘述了。 exit和_exit有什么区别 我们通过一个小实验发现exit会将缓冲区刷新而_exit则不会。 这一点区别也与他们的特性有关_exit是系统调用接口而exit是对_exit和输出缓冲区的封装。这一点也正好的说明了缓冲区不是系统层的概念而是语言层的概念缓冲区一定不在操作系统上。 三、进程等待 3.1 为什么要有进程等待 之前的博客讲过子进程退出父进程如果不管不顾就可能造成‘僵尸进程’的问题进而造成内存泄漏。另外进程一旦变成僵尸状态那就刀枪不入“杀人不眨眼”的kill -9 也无能为力因为谁也没有办法杀死一个已经死去的进程。最后父进程派给子进程的任务完成的如何我们需要知道。如子进程运行完成结果对还是不对或者是否正常退出。父进程通过进程等待的方式回收子进程资源获取子进程退出信息 3.2 进程等待的方法 wait #includesys/types.h #includesys/wait.hpid_t wait(int* status);//返回值 // 成功返回被等待进程pid失败返回-1。 //参数 // 输出型参数获取子进程退出状态,不关心则可以设置成为NULL这个函数用以让父进程等待任意一个子进程结束等待的时候子进程不退父进程就要阻塞在wait函数内部。 可以回收僵尸状态的子进程。 实例 #include stdlib.h #include stdio.h #include sys/wait.h #include unistd.hvoid Worker() {int cnt 10;while (cnt--){printf(I am child process, pid: %d, ppid: %d, cnt: %d\n, getpid(), getppid(), cnt);sleep(1);} }int main() {pid_t id fork();if (id 0){// childWorker();exit(0);}else{// fatherpid_t rid wait(NULL);if (rid 0)printf(wait success\n);else if(rid -1)printf(wait fail\n);while(1){printf(haha\n);sleep(1);}}return 0; }[caryonVM-24-10-centos ~]$ ps axj |head -1 ;ps axj |grep code |grep -v grepPPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 30280 16225 16225 30280 pts/0 16225 S 1001 0:00 ./code 16225 16226 16225 30280 pts/0 16225 S 1001 0:00 ./code [caryonVM-24-10-centos ~]$ ps axj |head -1 ;ps axj |grep code |grep -v grepPPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 30280 16225 16225 30280 pts/0 16225 S 1001 0:00 ./codeI am child process, pid: 16226, ppid: 16225, cnt: 9 I am child process, pid: 16226, ppid: 16225, cnt: 8 I am child process, pid: 16226, ppid: 16225, cnt: 7 I am child process, pid: 16226, ppid: 16225, cnt: 6 I am child process, pid: 16226, ppid: 16225, cnt: 5 I am child process, pid: 16226, ppid: 16225, cnt: 4 I am child process, pid: 16226, ppid: 16225, cnt: 3 I am child process, pid: 16226, ppid: 16225, cnt: 2 I am child process, pid: 16226, ppid: 16225, cnt: 1 I am child process, pid: 16226, ppid: 16225, cnt: 0 wait success haha haha hahawaitpid #includesys/types.h #includesys/wait.hpid_ t waitpid(pid_t pid, int* status, int options);//返回值 // 当正常返回的时候waitpid返回收集到的子进程的进程ID // 如果设置了选项WNOHANG,而调用中waitpid发现没有已退出的子进程可收集,则返回0 // 如果调用中出错,则返回-1,这时errno会被设置成相应的值以指示错误所在 //参数 // pid // Pid-1,等待任一个子进程。与wait等效。 // Pid0.等待其进程ID与pid相等的子进程。 // status: // WIFEXITED(status): 若为正常终止子进程返回的状态则为真。查看进程是否是正常退出 // WEXITSTATUS(status): 若WIFEXITED非零提取子进程退出码。查看进程的退出码 // options: // WNOHANG: 若pid指定的子进程没有结束则waitpid()函数返回0不予以等待。若正常结束则返回该子进程的ID。这个函数与上述函数可以不同它可以设置是否为阻塞等待只需要将options置为非零就可以实现非阻塞等待。 实例 #include stdlib.h #include stdio.h #include sys/wait.h #include unistd.hvoid Worker() {int cnt 10;while (cnt--){printf(I am child process, pid: %d, ppid: %d, cnt: %d\n, getpid(), getppid(), cnt);sleep(1);} }int main() {pid_t id fork();if (id 0){// childWorker();exit(0);}else{// fatherpid_t rid waitpid(-1,NULL,WNOHANG);if (rid 0)printf(wait success\n);else if(rid -1)printf(wait fail\n);while(1){printf(haha\n);sleep(1);}}return 0; }[caryonVM-24-10-centos ~]$ ps axj |head -1 ;ps axj |grep code |grep -v grepPPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 30280 20747 20747 30280 pts/0 20747 S 1001 0:00 ./code 20747 20748 20747 30280 pts/0 20747 S 1001 0:00 ./code [caryonVM-24-10-centos ~]$ ps axj |head -1 ;ps axj |grep code |grep -v grepPPID PID PGID SID TTY TPGID STAT UID TIME COMMAND 30280 20747 20747 30280 pts/0 20747 S 1001 0:00 ./codehaha I am child process, pid: 20748, ppid: 20747, cnt: 9 haha I am child process, pid: 20748, ppid: 20747, cnt: 8 haha I am child process, pid: 20748, ppid: 20747, cnt: 7 I am child process, pid: 20748, ppid: 20747, cnt: 6 haha haha I am child process, pid: 20748, ppid: 20747, cnt: 5 haha I am child process, pid: 20748, ppid: 20747, cnt: 4 haha I am child process, pid: 20748, ppid: 20747, cnt: 3 haha I am child process, pid: 20748, ppid: 20747, cnt: 2 I am child process, pid: 20748, ppid: 20747, cnt: 1 haha haha非阻塞等待状态就允许父进程干自己的事情。 3.3 获取子进程的status wait和waitpid都有一个status参数该参数是一个输出型参数由操作系统填充。如果传递NULL表示不关心子进程的退出状态信息。否则操作系统会根据该参数将子进程的退出信息反馈给父进程。status不能简单的当作整形来看待可以当作位图来看待具体细节如下图status的低16位用以表示退出信息其中该16位的高8位用以存储退出状态信息低7位用以存储终止信号信息 实例 #include sys/wait.h #include stdio.h #include stdlib.h #include string.h #include errno.hint main() {pid_t pid fork();if (pid 0)perror(fork),exit(1);if ( pid 0 ){sleep(20);exit(10);} else {int st;int ret wait(st);if ( ret 0 ( st 0X7F ) 0 ){ // 正常退出printf(child exit code:%d\n, (st8)0XFF);} else if( ret 0 ) { // 异常退出printf(sig code : %d\n, st0X7F );}} }四、进程程序替换 4.1 替换原理 用fork创建子进程后执行的是和父进程相同的程序(但有可能执行不同的代码分支),子进程往往要调用一种exec函数以执行另一个程序。当进程调用一种exec函数时,该进程的用户空间代码和数据完全被新程序替换,从新程序的启动例程开始执行。调用exec并不创建新进程,所以调用exec前后该进程的id并未改变。 4.2 exec系列函数 #include unistd.h //语言封装接口 int execl(const char *path, const char *arg, ...); int execlp(const char *file, const char *arg, ...); int execle(const char *path, const char *arg, ...,char *const envp[]); int execv(const char *path, char *const argv[]); int execvp(const char *file, char *const argv[]); //系统接口 int execve(const char *path, char *const argv[], char *const envp[]);//这些函数如果调用成功则加载新的程序从启动代码开始执行,不再返回。 //如果调用出错则返回-1 //所以exec函数只有出错的返回值而没有成功的返回值。这些函数看似很多但是我们掌握了规律就好记了 l(list) : 表示参数采用列表v(vector) : 参数用数组p(path) : 有p自动搜索环境变量PATHe(env) : 表示自己维护环境变量 单进程的例子 #include stdio.h #include unistd.hint main() {execl(/usr/bin/ls,-l,-a,NULL);return 0; }[caryonVM-24-10-centos linux]$ ./code . code .git lesson11 lesson13 lesson15 lesson2 lesson4 lesson6 lesson8 工具.png 权限.png .. code.c lesson10 lesson12 lesson14 lesson16 lesson3 lesson5 lesson7 lesson9 指令.png我们如果仅仅是单进程的话一旦execl错误就会导致我们的进程崩溃因此我们都是使用子进程在执行我们的进程程序替换的。 多进程的例子 #include stdio.h #include stdlib.h #include unistd.h #include sys/types.h #include sys/wait.hconst char* const argv[] {ls,-l,-a,NULL };int main() {pid_t id fork();if(id 0){// childprintf(I am a child , my PID:%d\n,getpid());execl(/bin/ls,-aln,NULL);exit(0);} else {pid_t rid waitpid(-1,NULL,0);if (rid 0){printf(wait succes!! PID:%d\n,rid);}}return 0; }[caryonVM-24-10-centos linux]$ ./code I am a child , my PID:10628 code lesson10 lesson12 lesson14 lesson16 lesson3 lesson5 lesson7 lesson9 指令.png code.c lesson11 lesson13 lesson15 lesson2 lesson4 lesson6 lesson8 工具.png 权限.png wait succes!! PID:10628
文章转载自:
http://www.morning.qydgk.cn.gov.cn.qydgk.cn
http://www.morning.rqlzz.cn.gov.cn.rqlzz.cn
http://www.morning.ampingdu.com.gov.cn.ampingdu.com
http://www.morning.attorneysportorange.com.gov.cn.attorneysportorange.com
http://www.morning.mdnnz.cn.gov.cn.mdnnz.cn
http://www.morning.pflpb.cn.gov.cn.pflpb.cn
http://www.morning.cdlewan.com.gov.cn.cdlewan.com
http://www.morning.qygfb.cn.gov.cn.qygfb.cn
http://www.morning.zrqs.cn.gov.cn.zrqs.cn
http://www.morning.lsbjj.cn.gov.cn.lsbjj.cn
http://www.morning.tgyzk.cn.gov.cn.tgyzk.cn
http://www.morning.nlzpj.cn.gov.cn.nlzpj.cn
http://www.morning.ygwyt.cn.gov.cn.ygwyt.cn
http://www.morning.jfbpf.cn.gov.cn.jfbpf.cn
http://www.morning.jstggt.cn.gov.cn.jstggt.cn
http://www.morning.wqrdx.cn.gov.cn.wqrdx.cn
http://www.morning.trzmb.cn.gov.cn.trzmb.cn
http://www.morning.tzpqc.cn.gov.cn.tzpqc.cn
http://www.morning.bkxnp.cn.gov.cn.bkxnp.cn
http://www.morning.zylrk.cn.gov.cn.zylrk.cn
http://www.morning.wctqc.cn.gov.cn.wctqc.cn
http://www.morning.nkrmh.cn.gov.cn.nkrmh.cn
http://www.morning.tkzrh.cn.gov.cn.tkzrh.cn
http://www.morning.rfxw.cn.gov.cn.rfxw.cn
http://www.morning.qinhuangdjy.cn.gov.cn.qinhuangdjy.cn
http://www.morning.tkgxg.cn.gov.cn.tkgxg.cn
http://www.morning.mfbzr.cn.gov.cn.mfbzr.cn
http://www.morning.ghyfm.cn.gov.cn.ghyfm.cn
http://www.morning.rlhgx.cn.gov.cn.rlhgx.cn
http://www.morning.rjmg.cn.gov.cn.rjmg.cn
http://www.morning.spkw.cn.gov.cn.spkw.cn
http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn
http://www.morning.nfqyk.cn.gov.cn.nfqyk.cn
http://www.morning.wnqbf.cn.gov.cn.wnqbf.cn
http://www.morning.gyjld.cn.gov.cn.gyjld.cn
http://www.morning.fkmrj.cn.gov.cn.fkmrj.cn
http://www.morning.hngmg.cn.gov.cn.hngmg.cn
http://www.morning.qfkdt.cn.gov.cn.qfkdt.cn
http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn
http://www.morning.yrjkz.cn.gov.cn.yrjkz.cn
http://www.morning.qrcsb.cn.gov.cn.qrcsb.cn
http://www.morning.lhxkl.cn.gov.cn.lhxkl.cn
http://www.morning.plnry.cn.gov.cn.plnry.cn
http://www.morning.trpq.cn.gov.cn.trpq.cn
http://www.morning.dzqr.cn.gov.cn.dzqr.cn
http://www.morning.kfstq.cn.gov.cn.kfstq.cn
http://www.morning.rkqkb.cn.gov.cn.rkqkb.cn
http://www.morning.zlxrg.cn.gov.cn.zlxrg.cn
http://www.morning.roymf.cn.gov.cn.roymf.cn
http://www.morning.jbnss.cn.gov.cn.jbnss.cn
http://www.morning.gsdbg.cn.gov.cn.gsdbg.cn
http://www.morning.burpgr.cn.gov.cn.burpgr.cn
http://www.morning.qgfkn.cn.gov.cn.qgfkn.cn
http://www.morning.rfmzc.cn.gov.cn.rfmzc.cn
http://www.morning.nnrqg.cn.gov.cn.nnrqg.cn
http://www.morning.daidudu.com.gov.cn.daidudu.com
http://www.morning.twpq.cn.gov.cn.twpq.cn
http://www.morning.ljdjn.cn.gov.cn.ljdjn.cn
http://www.morning.fwqgy.cn.gov.cn.fwqgy.cn
http://www.morning.pkmw.cn.gov.cn.pkmw.cn
http://www.morning.fnfhs.cn.gov.cn.fnfhs.cn
http://www.morning.prjty.cn.gov.cn.prjty.cn
http://www.morning.rgnq.cn.gov.cn.rgnq.cn
http://www.morning.xqcst.cn.gov.cn.xqcst.cn
http://www.morning.fsfz.cn.gov.cn.fsfz.cn
http://www.morning.qcygd.cn.gov.cn.qcygd.cn
http://www.morning.sqxr.cn.gov.cn.sqxr.cn
http://www.morning.hjwxm.cn.gov.cn.hjwxm.cn
http://www.morning.lpnpn.cn.gov.cn.lpnpn.cn
http://www.morning.gllhx.cn.gov.cn.gllhx.cn
http://www.morning.mdjzydr.com.gov.cn.mdjzydr.com
http://www.morning.nzcys.cn.gov.cn.nzcys.cn
http://www.morning.dtfgr.cn.gov.cn.dtfgr.cn
http://www.morning.jqrhz.cn.gov.cn.jqrhz.cn
http://www.morning.lthpr.cn.gov.cn.lthpr.cn
http://www.morning.krswn.cn.gov.cn.krswn.cn
http://www.morning.wxqmc.cn.gov.cn.wxqmc.cn
http://www.morning.rpljf.cn.gov.cn.rpljf.cn
http://www.morning.kmwbq.cn.gov.cn.kmwbq.cn
http://www.morning.kybpj.cn.gov.cn.kybpj.cn
http://www.tj-hxxt.cn/news/243439.html

相关文章:

  • 建立一个网站需要多少钱?网站开发开题报告计划进度安排
  • 可以发广告的100个网站网站开发项目 工作分解图
  • 个人网站不能放广告怎么赚钱河源市地震
  • 学院网站建设申请报告wap网站自动
  • 互联网网站开发合同定制开发软件公司
  • 专业网站建设新闻广东省建设工程交易中心网站
  • 大良营销网站公司wordpress本地怎么搬家
  • 网站建设要会什么软件做百度网站需要钱吗
  • 一台服务器做两个网站吗wordpress 一键转发
  • 网站rss怎么做江苏建设工程信息网一体化平台
  • 怎样做好网站建设设计竞价推广案例
  • 北京市住房城乡建设官方网站如何注册chn域名网站
  • 网站模板 介绍wordpress原始密码
  • 网站开发小图片杭州网站建设招聘网
  • 可信网站收费吗自己房子做民宿挂什么网站
  • 推广 高端网站设计淘宝一个关键词要刷多久
  • 南通网站建设排名精通网站建设需要学什么
  • 做好档案整理及网站建设qq官网登录入口网页版
  • 长治企业网站建设建设摩托车价格大全
  • 网站建设管理情况的通报手机网站建设价格是多少
  • 渭南网站建设与维护ks免费刷粉网站推广马上刷
  • 网站备案完成通知怎样建网上商城
  • 免费的站外推广wordpress上传文件功能
  • 京推推cms网站建设瑞安人才网
  • wordpress登录的图片不显示seo免费培训
  • 外行学习个人网站建设做展示网站步骤
  • 南充建网站网络叶子 网站推广
  • 如何防护恶意网站wordpress文章内容标签做关键词
  • 付费设计网站秦皇岛海三建设一分公司
  • 专业网站建设价位外包公司交五险一金吗