🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #34963

Re: NNTP revision - it's about time?

#34963
From: Matt Dillon
Date: Sun, 24 Jan 1999 00:00
72 lines
3827 bytes
:In article <87g1939f3h.fsf@erlenstar.demon.co.uk>,
:Andrew Gierth  <andrew@erlenstar.demon.co.uk> wrote:
:>>>>>> "bill" == bill davidsen <davidsen@tmr.com> writes:
:>
:>comparisons of this kind of thing.
:>
:> bill> The overhead of a fork is basically copying the page tables and
:> bill> setting the copy on write bit as you go. While the overhead of
:> bill> passing a socket is low, I'm not sure in practice it matters.
:>
:>No passing of sockets is required (or used) in the apache model. Each
:>preforked server does its own calls to accept().  (Some systems require
:>locking around the accept calls, some don't.)

    Actually, most systems require locking around the accept calls.
    You can get away without it, but without locking you get this
    situation:

	30 processes waiting on accept ( or select()ing on accept() )
	1 (one) new connection comes in
	30 processes wakeup
	1 process gets the connection
	29 processes go to sleep.

    Oops.  If the sysem uses fcntl locks or flock, however, the locking
    code typically handles the exclusive-lock-handoff case reasonaly
    optimally so only one or two processes wake up on a new connection.

:> bill> In theory it would be a big win if you had socket passing but
:> bill> not a working vfork(),
:>
:>You seem to be misunderstanding vfork(), which is bugger-all use for
:>the nnrpd-daemon situation (it's only ever useful if you're going to
:>immediately follow the fork with an exec() call, because it suspends
:>the parent process until either that happens or the child dies.)
:>
:>You need a full-blown fork() in this case.
:>
:>-- 
:>Andrew.

    It should be noted that fork()'s internals have changed considerably 
    over the years.  fork() is still highly OS independant, but some systems
    ( such as FreeBSD ) optimize it well enough that you basically do not
    have to worry about it... the overhead is very small whether you use
    vfork() or fork().

    For example, FreeBSD does not actually have to duplicate a process's
    map objects or page tables on a fork.

    The real cost of fork() is, of course, unavoidable copy-on-write faults.
    This is true of all systems.

    Older systems had much more overhead.  Even Linux has pretty significant
    overhead due to having to copy physical page tables, but not as bad as
    older systems which either couldn't do copy-on-write properly or couldn't
    manage swap backing store properly ( all resulting in very slow fork()
    performance ).

    And, finally, even if the fork() overhead remained static, performance
    goes up as cpu speed goes up.  Fork() has probably gotten 2x to 4x more
    efficient over the last ten years, but cpu's have gotten 100x faster or
    more.  Fork has become much less of an issue on modern computers.

						    -Matt

-- 
    Matthew Dillon  Engineering, HiWay Technologies, Inc. & BEST Internet
                    Communications
    <dillon@best.net> (Please include original email in any response)

Technical Details
Message-ID: <78el0v$vv$1@flea.best.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <77nr30$15t$1@taliesin.netcom.net.uk> <slrn7a9u1l.pgt.meowing@meowhost.meow.invalid> <78annp$8pac$1@newssvr03-int.news.prodigy.com> <87g1939f3h.fsf@erlenstar.demon.co.uk>

Show Full Headers
Complete Article Headers
Message-ID: <78el0v$vv$1@flea.best.net>
Subject: Re: NNTP revision - it's about time?
Date: Sun, 24 Jan 1999 00:00:00 +0000
From: dillon@best.net (Matt Dillon)
References: <77nr30$15t$1@taliesin.netcom.net.uk> <slrn7a9u1l.pgt.meowing@meowhost.meow.invalid> <78annp$8pac$1@newssvr03-int.news.prodigy.com> <87g1939f3h.fsf@erlenstar.demon.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 436250697
X-Trace: nntp1.ba.best.com 917165925 16662 dillon@206.184.139.131
Organization: BEST Internet Communications, Inc. www.best.com
Newsgroups: news.software.nntp