• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <unistd.h>
2 
3 constexpr int LOOP_COUNT = 100000000;
4 
ParentFunction()5 void ParentFunction() {
6   for (volatile int i = 0; i < LOOP_COUNT; ++i) {
7   }
8 }
9 
ChildFunction()10 void ChildFunction() {
11   for (volatile int i = 0; i < LOOP_COUNT; ++i) {
12   }
13 }
14 
main()15 int main() {
16   pid_t pid = fork();
17   if (pid == 0) {
18     ChildFunction();
19     return 0;
20   } else {
21     ParentFunction();
22   }
23   return 0;
24 }
25