Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 1998 10:40:21 +0100 (CET)
From:      Andrzej Bialecki <abial@nask.pl>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        freebsd-current@FreeBSD.ORG, jkh@FreeBSD.ORG
Subject:   Re: Custom init(8) (and some ideas)
Message-ID:  <Pine.NEB.3.95.980205100537.18163B-100000@korin.warman.org.pl>
In-Reply-To: <199802050841.BAA13172@usr08.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi!

Thanks for your replies - now I'm more aware of do's and dont's. Besides,
now I know where the sources for init(8) are... :-))

I must rethink the problem. Perhaps I'll start reaping out chunks of
normal init...

A bit of background, if you're interested: I'm working on the next version
of PicoBSD, and after some shuffling with the layout and adding new
features I found that I can no longer fit into 8MB RAM... I.e. it fits,
but I can't start enough processes to make a dialup connection.

There was one really nasty surprise which I experienced: the way the
gzipped binaries are executed. It wastes a LOT of RAM. And since all of
the programs on my floppy are just one crunched binary (which is gzipped
for saving space on the floppy), when it gets executed it initially takes
almost thrice as much memory than its file size. And of course it can't be
paged out (where to?), which results in crash.

I had some ideas how to fix it, but the implementation of this is far
beyond my knowledge: to modify imgact_gzip NOT to load the gzipped binary,
but just to mmap it, and then unpack it. When I asked John Dyson he said
that it would require a lot of work to change it... Pity.

Also, IMHO it would be a good option to the kernel and/or ld.so to tell
them not to load .text at all (it could apply to .text section of binaries
as well as shared libs), just to mmap it, if the backing filesystem is of
MFS type.

So, I'm still looking for various ways of memory saving, and the way that
init uses to (finally) start a user shell is unnecesarily complicated in
my case. Because what I want in basic setup is just to start some
interactive shells on different ttys.

That said, I think I must go and read /usr/src/sbin/init/init.c... :-))

Andrzej Bialecki

PS. Terry, thanks for your explanation - IMO, this is parallel to what
'man init' says, but gives, I'd say, "stereoscopic view" of the things... 
And no, I linked my init statically, but I forgot that it must never exit
:-) 

---------------------+---------------------------------------------------------
abial@warman.org.pl  | if(halt_per_mth > 0) { fetch("http://www.freebsd.org") }
Research & Academic  | "Be open-minded, but don't let your brains to fall out."
Network in Poland    | All of the above (and more) is just my personal opinion.
---------------------+---------------------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.95.980205100537.18163B-100000>