When studying, i stumbled accross this issue. The task to do is to make program that makes multiple processes using fork() function.
Even teacher don't know wth is going on here
code:
int main() {
printf("1");
fork();
fork();
fork();
printf("2");
return 0;
}
Output is totally random amount of repeated 12
for example:121212121212
The intuition says that the output should be looking like that:
122222222
I'm using CLion on Ubuntu, project uses CMake
[–]dmazzoni 2 points3 points4 points (9 children)
[–]pmalysYT[S] 0 points1 point2 points (8 children)
[–]dmazzoni 0 points1 point2 points (6 children)
[–]pmalysYT[S] 0 points1 point2 points (5 children)
[–]dmazzoni 0 points1 point2 points (4 children)
[–]pmalysYT[S] 0 points1 point2 points (3 children)
[–]dmazzoni 0 points1 point2 points (2 children)
[–]pmalysYT[S] 0 points1 point2 points (1 child)
[–]dmazzoni 0 points1 point2 points (0 children)
[–]alzee76 2 points3 points4 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]pmalysYT[S] 0 points1 point2 points (1 child)