mirror of
https://github.com/riba2534/TCP-IP-NetworkNote.git
synced 2026-02-03 01:53:19 +08:00
24 lines
374 B
C
24 lines
374 B
C
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
pid_t pid = fork();
|
|
|
|
if (pid == 0)
|
|
{
|
|
puts("Hi, I am a child Process");
|
|
}
|
|
else
|
|
{
|
|
printf("Child Process ID: %d \n", pid);
|
|
sleep(30);
|
|
}
|
|
|
|
if (pid == 0)
|
|
puts("End child proess");
|
|
else
|
|
puts("End parent process");
|
|
return 0;
|
|
}
|