当前位置:网站首页>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
边栏推荐
- 理论问题与工程问题的差异在哪里?
- gdalinfo: error while loading shared libraries: libgdal.so.30: cannot open shared object file: No su
- Xilinx Constraint Study Notes - Timing Constraints
- 小说里的编程 【连载之二十五】元宇宙里月亮弯弯
- 机器学习笔记--数学库
- Mysql各个大版本之间的区别
- .NET静态代码织入——肉夹馍(Rougamo) 发布1.1.0
- 优炫数据库的逻辑复制怎么样?
- @Repository详解
- 2022年防止网络攻击的15个网络安全实践,你学会了吗?
猜你喜欢
PanGu-Coder:函数级的代码生成模型
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;)
MFC最详细入门教程[转载]
MySQL - low level settings
停止精神内耗 每日分享
Biotin-LC-Hydrazide|CAS:109276-34-8|生物素-LC-酰肼
按键控制流水灯(计时器)
CASA模型、CENTURY模型应用与案例分析
Thesis understanding: "Cross-Scale Residual Network: A GeneralFramework for Image Super-Resolution, Denoising, and "
5分钟搞懂MySQL - 行转列
随机推荐
Mysql各个大版本之间的区别
典型的一次IO的两个阶段是什么?阻塞、非阻塞、同步、异步
如何开启mysql慢查询日志?
Transimpedance amplifier
Inverter Phase Locking Principle and DSP Implementation
机器学习笔记--数学库
Buried development process
MySQL - Detailed Explanation of Database Transactions
小说里的编程 【连载之二十二】元宇宙里月亮弯弯
I.MX6U-ALPHA开发板(EPIT定时器实验)
postgres 水平分表,自动创建分区,按时间分表
MySQL常见索引类型
CSRF-Cross-site request forgery-related knowledge
Inverter insulation detection detection function and software implementation
小说里的编程 【连载之二十一】元宇宙里月亮弯弯
HCIP 第六天
Kind of weird!Access the destination URL, the host can container but not
研发过程中的文档管理与工具
Biotin hydrazide HCl|CAS:66640-86-6|生物素-酰肼盐酸盐
Biotin-LC-Hydrazide|CAS:109276-34-8|生物素-LC-酰肼