当前位置:网站首页>IO process thread -> process -> day4
IO process thread -> process -> day4
2022-08-02 08:21:00 【Call me to take care of the sea QAQ】
Table of Contents
Exercise
1. Create an orphan process
2. Create a zombie process
First, orphan process
It means that only the child process is still executing, the parent process has ended, and the parent process number is 1.
1.1 Orphan Function
#include #include #include int main(int argc, const char *argv[]){pid_t pid=fork();if(0 == pid){while(1){printf("Orphan Process\n");sleep(1);}}else if(pid > 0){sleep(2);}else{perror("fork");}return 0;} 1.2 Execution Result
ps -ajx View Linux process information

2. ZombiesProcess
That is, the parent process is still executing, and the child process has ended, but the parent process has not collected the body of the process.
2.1 Zombie function
#include #include #include int main(int argc, const char *argv[]){pid_t pid=fork();if(0 == pid){sleep(2);}else if(pid > 0){while(1){printf("Zombie process\n");sleep(1);}}else{perror("fork");}return 0;} 2.2 Execution Result
ps -ajx View Linux process information

边栏推荐
猜你喜欢

59: Chapter 5: Develop admin management services: 12: MongoDB usage scenarios; (non-core data, non-core data with a relatively large amount of data, small private files such as face photos;)

ROS file system and related commands

HCIP 第十天

MySQL优化:从十几秒优化到三百毫秒
![MFC最详细入门教程[转载]](/img/5d/655e75f6b8a547fefe0137a9b11536.png)
MFC最详细入门教程[转载]

Biotin hydrazide HCl|CAS:66640-86-6|生物素-酰肼盐酸盐

7.联合索引(最左前缀原则)

ROS文件系统以及相关命令

有点奇怪!访问目的网址,主机能容器却不行

Kind of weird!Access the destination URL, the host can container but not
随机推荐
HCIP第二天
Buried development process
Appium swipe problem
MySQL - locking mechanism
小说里的编程 【连载之二十二】元宇宙里月亮弯弯
pnpm + workspace + changesets 构建你的 monorepo 工程
Visual Analysis of DeadLock
PanGu-Coder: A function-level code generation model
Metasploit (MSF) Basic Super Detailed Edition
JVM垃圾回收与性能调优方式
WebForm DropDownList分别绑定年月
Thesis understanding: "Cross-Scale Residual Network: A GeneralFramework for Image Super-Resolution, Denoising, and "
MGRE环境下的OSPF
18、优化网站性能
爬虫——爬虫初识、requests模块
图扑软件数字孪生油气管道站,搭建油气运输管控平台
MySQL - index explanation
MFC最详细入门教程[转载]
Install Metasploitable2 on VMware
Data Middle Office: Started in Ali, Prosperous in DaaS