delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/04/19/22:06:31

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-WM-Posted-At: avacado.atomice.net; Sat, 20 Apr 02 03:06:56 +0100
Message-ID: <018501c1e810$0bea9bd0$0100a8c0@advent02>
From: "Chris January" <chris AT atomice DOT net>
To: <cygwin AT cygwin DOT com>
Subject: Copy-on-write fork
Date: Sat, 20 Apr 2002 03:06:55 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

This is mainly a question aimed at Christopher Faylor, but maybe someone
else knows the answer.
My question is, with regard to Chris's post "Re: copy-on-write (oh well)"
[http://www.cygwin.com/ml/cygwin-developers/2000-07/msg00026.html], does
anyone know why a copy-on-write implementation of fork takes longer than the
current Cygwin version??
BTW, I've not had any problems forking beyond the first level using the
example code from 'Window NT/2000 Native API reference'. What problems did
you encounter Chris? My test case is probably not rigorous enough.

A test program and statistics are shown below which clearly show Cygwin's
fork implementation in the lead.

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

int main(void) {
    int pid, i;
    DWORD dwStartTicks, dwEndTicks;
    dwStartTicks = GetTickCount();
    for (i=0;i<100;i++) {
        pid = fork();
        if (!pid)
            exit(0);
    }
    dwEndTicks = GetTickCount();
    printf("average fork time = %g ms\n", (dwEndTicks -
dwStartTicks)/1000.0);
}

test uses the copy-on-write implementation
test2 uses Cygwin's implementation

$ time ./test
average fork time = 3.345 ms

real    0m3.391s
user    0m0.020s
sys     0m0.030s

$ time ./test2
average fork time = 1.972 ms

real    0m2.043s
user    0m0.060s
sys     0m0.220s

Regards
Chris



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019