This is a transcription of the test program from the youtube video:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv) {
  int children = 0;
  int status;
  int i = 0;

  if (argc < 2) {
    printf("Usage: %s <children<\n", argv[0]);
    return 1;
  }

  children = atoi(argv[1]);
  for (i = 0; i < children; i++) {
    printf("Starting child %d\n", i);
    if (fork() == 0) {
      fprintf(stderr, "child%d up %d\n", i, getpid());
      while (1) {
        /* Nothing, just spin */
      }
    } else {
      // parent continues
    }
  }

  wait(&status);
  return 0;
}


** Visibility changed to: Private

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is a direct subscriber.
https://bugs.launchpad.net/bugs/708920

Title:
  Strange 'fork/clone' blocking behavior under high cpu usage on EC2

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to