Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2000 15:41:21 -0800
From:      David Greenman <dg@root.com>
To:        Sebastiaan van Erk <sebster@sebster.com>
Cc:        Alfred Perlstein <bright@wintelcom.net>, freebsd-questions@FreeBSD.ORG
Subject:   Re: argument list too long 
Message-ID:  <200011162341.PAA01064@implode.root.com>
In-Reply-To: Your message of "Fri, 17 Nov 2000 00:13:28 %2B0100." <20001117001328.A87281@sebster.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>The point that I'm trying to make is that it's an _arbitrary_ restriction.
>There is no _reason_ for it. It sounds to me like all the other _arbitrary_

   Actually, it's not arbitrary at all. There are very good reasons why it is
the way it is. For one thing, the arguments are stored above the user stack
and all of them have to be programatically addressable, so that limits you
right away to something that is quite a bit less than infinite. The real limit
has to do with the need to copy the arguments into the kernel's virtual address
space when an exec() is done - the kernel must replace the address space with
a new one and has to make a copy of the arguments to do that. A limit of 64k
was chosen so that the kernel VM usage could be kept under control (many
processes can exec() simultaneously in FreeBSD, and each one can eat 64K of
VM). You could save some space by serializing the exec()'s, but this results
in a significant loss of performance for only a marginal gain.
   The bottom line is that the limitation comes from many different areas -
the hardware architecture itself, the API, and from the implementation. While
we could make the arglist larger, it wouldn't be anything but a bandaid and
your program would still fail with the larger list.
   Use xargs. That's why it's there.

-DG

David Greenman
Co-founder, The FreeBSD Project - http://www.freebsd.org
President, TeraSolutions, Inc. - http://www.terasolutions.com
Pave the road of life with opportunities.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011162341.PAA01064>