当前位置:网站首页>[learning notes] process creation
[learning notes] process creation
2022-07-28 06:56:00 【Step on a meteor】
#include <stdio.h>
#include <unistd.h>
int pipeline_child()
{
printf("child PPID:%d,PID:%d\n", getppid(), getpid());
while(1);
return 0;
}
int pipeline_father()
{
printf("father PPID:%d,PID:%d\n", getppid(), getpid());
while(1);
return 0;
}
int main()
{
pid_t pid = fork();
if (pid == -1) {
printf("failed process!\n");
return -1;
}
// Subprocesses
if(pid == 0) {
printf("child process!\n");
printf("child PPID:%d,PID:%d\n", getppid(), getpid());
pipeline_child();
} else {
// The parent process
sleep(1);
printf("father process!\n");
printf("father PPID:%d,PID:%d\n", getppid(), getpid());
pipeline_father();
}
return 0;
}
边栏推荐
- MySQL主从
- Suger Bi create task
- 技术分享 | 接口测试价值与体系
- 软件测试(概念篇)
- 进程和线程的区别
- It is recommended to wear air conduction earphones, which do not need to wear in ear
- KVM热迁移
- Technology sharing | sending requests using curl
- Life cycle (process) of software testing
- Test interview questions collection (III) | computer network and database (with answers)
猜你喜欢

What kind of air conduction Bluetooth headset with good configuration is recommended

NFS shared storage service

DHCP原理与配置

iptables防火墙

VMware Workstation 配置net模式

Network - transport layer (detailed version)

Technology sharing | common proxy tools for interface testing

cocos2d-x 学习笔记——瓦片地图TiledMap

技术分享 | 接口测试常用代理工具

Installation and configuration of unit test framework jest with typescript
随机推荐
Network - data link layer
Traversal binary tree
Difference between process and thread
What's a good gift for Tanabata? Niche and advanced product gift recommendation
Test interview questions collection (I) | common required questions and procedures of software testing (with answers)
What is the most practical gift for Tanabata? A gift that will never go wrong is worth buying
软件测试的生命周期(流程)
Applets: WSX scripts
思寒漫谈测试人职业发展
JS reverse question 100 - question 1
SSH service configuration
DNS正向解析实验
Life cycle (process) of software testing
测试面试题集锦(一)| 软件测试常见必考问题与流程篇(附答案)
Ubuntu MySQL setting remote access permissions
遍历 二叉树
MySQL主从
HDU-5783 Divide the Sequence(贪心水题)
Wechat applet custom compilation mode
Question brushing record ---- reverse the linked list (reverse the whole linked list)