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

边栏推荐
- postgres groupby merge strings
- 图扑软件数字孪生油气管道站,搭建油气运输管控平台
- 数据中台:始于阿里,兴于DaaS
- 设置 height: auto 却无法触发 transition 动画的解决方案
- OSPF 综合实验
- 有点奇怪!访问目的网址,主机能容器却不行
- Understand the Chisel language. 30. Chisel advanced communication state machine (2) - FSMD: Take Popcount as an example
- Elasticserch 自定义字段,用户会频繁的创建和删除字段,怎么设计mapping?
- MySQL压缩包方式安装,傻瓜式教学
- HCIP9_BGP增加实验
猜你喜欢
随机推荐
读入、输出优化
Fatal error compiling: 无效的目标发行版: 11
flutter 参数传一个范型数据
HCIP 第四天
研发过程中的文档管理与工具
uni.navigateBack 中的坑
WebRTC系列-SDP之编码信息收集
Database Plus 的云上之旅:SphereEx 正式开源 ShardingSphere on Cloud 解决方案
MySQL - low level settings
MySQL - locking mechanism
flutter解决键盘和输入框不适配问题
mysql去除重复数据
Metasploit (MSF) Basic Super Detailed Edition
redis的安装与应用
【CV】OpenVINO installation tutorial
@FeignClient configuration参数配置
Conditional constructor ~wapper
CSRF-Cross-site request forgery-related knowledge
通过建立新的SaaS业务来推动增长的六种方法
Understand Chisel language. 31. Chisel advanced communication state machine (3) - Ready-Valid interface: definition, timing and implementation in Chisel









