Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "unistd.h"
- int main(void)
- {
- int st = 0;
- while (1)
- {
- if (fork() == 0)
- {
- usleep(10);
- break;
- }
- else
- {
- ++st;
- usleep(100);
- }
- }
- printf("step=%d, pid=%d\n", st, getpid());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement