public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Copy-on-write fork
@ 2002-04-19 19:18 Chris January
  2002-04-19 19:29 ` Christopher Faylor
  2002-10-21 15:58 ` Sven Köhler
  0 siblings, 2 replies; 9+ messages in thread
From: Chris January @ 2002-04-19 19:18 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Copy-on-write fork
@ 2002-04-19 20:26 Robert Collins
  0 siblings, 0 replies; 9+ messages in thread
From: Robert Collins @ 2002-04-19 20:26 UTC (permalink / raw)
  To: Chris January, cygwin



> -----Original Message-----
> From: Chris January [mailto:chris@atomice.net] 
> Sent: Saturday, April 20, 2002 12:07 PM
> To: cygwin@cygwin.com
> Subject: Copy-on-write fork
> 
> 
> 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.h
> tml], does anyone know why a copy-on-write implementation of 
> fork takes longer than the current Cygwin version?? 

What would be interesting would be to closely monitor the relevant
perfmon items and see if you can determine the thing causing the delay.
You'd probably need a custom program to get enough detail though :[.

Rob

--
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/

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Copy-on-write fork
@ 2002-04-20  8:01 Chris January
  0 siblings, 0 replies; 9+ messages in thread
From: Chris January @ 2002-04-20  8:01 UTC (permalink / raw)
  To: cygwin

> > I assume that one possible reason is that the copy-on-write fork may be
> > somehow bypassing normal in-memory sharing of text segments but I never
> > knew for sure.
> >
>
> Have either of you tried this comparison on XP, to see if it's any
different
> there?  I'm running XP here, if Chris J. wants to put the c-o-w DLL up
somewhere
> so I can download it and try it.
Please do - I would be interested to see how it runs on XP - you can
download a static library containing just fork() here:
http://www.doc.ic.ac.uk/~ccj00/atomice.net/show.cgi?article=1019312635446.68
4814058244

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/

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-10-22 18:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 19:18 Copy-on-write fork Chris January
2002-04-19 19:29 ` Christopher Faylor
2002-04-19 19:58   ` Gary R. Van Sickle
2002-10-21 15:58 ` Sven Köhler
2002-10-21 16:50   ` Chris January
2002-10-21 21:41     ` Gary R. Van Sickle
2002-10-22 12:25     ` Sven Köhler
2002-04-19 20:26 Robert Collins
2002-04-20  8:01 Chris January

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).