Guest User

Untitled

a guest
Dec 18th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. int main()
  4. {
  5. pid_t pid1, pid2;
  6. if ((pid1 = fork()) == 0)
  7. {
  8. pid1 = getpid();
  9. printf("nДочерний процесс 1: pid = %dn", pid1);
  10. //вывод времени
  11. }
  12. if ((pid2 = fork()) == 0)
  13. {
  14. pid2 = getpid();
  15. printf("nДочерний процесс 2: pid = %dn", pid2);
  16. ////вывод времени
  17. }
  18. puts("");
  19. system("ps -x");
  20. printf("Родительский процесс: pid = %dn", getppid());
  21. }
Add Comment
Please, Sign In to add comment