[Shootout-list] process creation & message passing

Isaac Gouy igouy2@yahoo.com
Mon, 18 Oct 2004 09:57:20 -0700 (PDT)


> the time it takes to create, and maintain, a variable amount of 
> processes, not something else.

Why a "variable amount of processes"?


> i disagree. even languages that use kernel threads can create
> threads. it is not impossible.

Yes they can, and the number of kernel threads that can be created is
limited by the available memory on the test machine. 


> > imo Good tests would *include* most of the languages.
> i disagree. if we follow this idea with all tests we will get too
> much noise.

We *do* follow this idea with the other tests!


> otherwise we end up with test results like the 
> current objinst. i think objinst is a failure.

Why?


> > chain 
> > - create 3000 *linked* processes/threads/...
> > : print the number of processes 3000 (show program didn't silently
> > fail) (1 parameter: how many times 'create' is repeated)

> what is a linked process?
Answered in the other thread. Can you read Java?


> how do we get a graph over n from this test?

You deleted the series of measurements given in the original posting!? 
Values of n: 1,2,3,4,10,100

> java chain 1   -   4.015s
> java chain 2   -   7.844s
> java chain 3   -  11.625s
> java chain 4   -  15.422s
> java chain 10  -  38.547s
> java chain 100 - 387.25s




public class chain {
   static final int LENGTH = 1000;

   public static void main(String args[]) {
      int n = 1;
      if (args.length > 0) n = Integer.parseInt(args[0]);

      while (n-- > 0) {
         Link chain = null;
         Link link = null;

         synchronized(Link.hold){
            for (int i=1; i<=LENGTH; i++){
               link = new Link(chain);             
               link.start();
               chain = link;
            }
         }
      }
      System.out.println(LENGTH);
   }
}

class Link extends Thread {
   public static Boolean hold = new Boolean(true);
   private Thread next;
   
   Link(Thread t){
      next = t;
   }

   public void run() {
      synchronized(hold){}    
   }
}

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com