• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

17. Server Operating System > How Many Processes Can My Server Handle?

How Many Processes Can My Server Handle?

It is also interesting to see how many processes a server can handle and what resource runs out first. The following is a small C program that simply forks and waits for the child to exit, rapidly building up to the maximum number of processes your machine can handle. Again, it may well crash your machine, so use it only on a machine you can afford to crash. It is downloadable from http://patrick.net/software/fork.c. Compile it like this: gcc -o fork fork.c.

#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>

main(  ) {
     int pid;

    pid= fork(  );

    if (pid== -1) perror("failed: ");
     if (pid==  0) {
         printf("child\n");
         execl("./fork", "");
     }
     else
         printf("parent\n");
     wait(NULL);
 }

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint