当前位置:网站首页>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

边栏推荐
- ROS file system and related commands
- Understand Chisel language. 31. Chisel advanced communication state machine (3) - Ready-Valid interface: definition, timing and implementation in Chisel
- 解决IDEA安装安装插件慢问题
- MFC最详细入门教程[转载]
- 静态路由综合实验
- HCIP第二天
- PLSQL Developer安装和配置
- Hack The Box - File Transfers Module详细讲解中文教程
- HCIP第七天
- 牛客2022 暑期多校4 D Jobs (Easy Version)(递推优化策略)
猜你喜欢
随机推荐
Introduction to Totem Pole and Push-Pull Circuits
Probability Theory and Mathematical Statistics
如何开启mysql慢查询日志?
postgres groupby merge strings
2022-7-31 12点 程序爱生活 恒指底背离中,有1-2周反弹希望
Biotin-LC-Hydrazide|CAS:109276-34-8|生物素-LC-酰肼
HCIP 第八天
如何保护智能家居不受黑客攻击
2022-08-01 第四小组 修身课 学习笔记(every day)
研发过程中的文档管理与工具
多表的查询
7.联合索引(最左前缀原则)
典型的一次IO的两个阶段是什么?阻塞、非阻塞、同步、异步
Biotin-EDA|CAS:111790-37-5| 乙二胺生物素
redis高阶使用之Redisson分布式锁源码解析
PanGu-Coder: A function-level code generation model
数据中台:始于阿里,兴于DaaS
MySQL - based
2022-2023 十大应用开发趋势
小说里的编程 【连载之二十五】元宇宙里月亮弯弯









