Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- int main()
- {
- pid_t pid1, pid2;
- if ((pid1 = fork()) == 0)
- {
- pid1 = getpid();
- printf("nДочерний процесс 1: pid = %dn", pid1);
- //вывод времени
- }
- if ((pid2 = fork()) == 0)
- {
- pid2 = getpid();
- printf("nДочерний процесс 2: pid = %dn", pid2);
- ////вывод времени
- }
- puts("");
- system("ps -x");
- printf("Родительский процесс: pid = %dn", getppid());
- }
Add Comment
Please, Sign In to add comment