change OS name

This commit is contained in:
2023-03-16 12:07:57 +01:00
parent c1a3e1601e
commit 3c4e3c952f
7 changed files with 26 additions and 8 deletions

BIN
System2/create_ps/a.out Executable file

Binary file not shown.

33
System2/create_ps/main.c Normal file
View File

@@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
pid_t fpid;
fpid = fork();
// create child process
if (fpid == -1)
{
perror("perror in fork!");
exit(EXIT_FAILURE);
}
if (fpid == 0)
{
printf("I am the child process, my process id is %d\n", getpid());
sleep(1);
printf("child process DONE\n");
exit(EXIT_SUCCESS);
}
else
{
printf("I am the parent process, my process id is %d\n", getpid());
wait(NULL);
printf("parent process DONE\n");
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}