I have been thinking about this too, but this need som deep kernel changes, or even rewriting part of the filsystem source i think..irondog wrote:Cewl.
Remember MS Windows uses Prefetch. It records into a database which files are needed at boottime. A fresh windows installation boots slower than a system that boots for the twentieth time. Prefetch makes sure the harddrive is used very very effectivly at OS bootup. This is hard to equal in GNU/Linux.
What do you think?
This must be impossible without kernel hacks. The only 'program' that can record which files are opened, is the kernel.JimmyW wrote: I have been thinking about this too, but this need som deep kernel changes, or even rewriting part of the filsystem source i think..
I do plan to let initng sens what files a processes uses on startup, and on next boot preload the files from disk to memory cache, before the dependcy for the app is up, this will improve some... I am currently working on this...
Not imposible, youst hard..This must be impossible without kernel hacks. The only 'program' that can record which files are opened, is the kernel.
There is som missing fifos, type make mkfifos in source dir.6thpink wrote:Ok, i said tomorrow but could not wait.
I tested and it seems to work, I have to polish it a bit still. The main issue is that initng complains about not being able to access /var/initng/in and /var/initng/out.
Also, is there any doc file that I can reffer to? I searched but did not find, i will look further, but now yes, tomorrow.¡!
But init isn't a library, it doesn't provide fopen and friends. If you're not hacking the kernel, you need to hack libc. I have to get some sleep, but I don't think init is the right place to introduce Preloading.JimmyW wrote:Not imposible, youst hard..This must be impossible without kernel hacks. The only 'program' that can record which files are opened, is the kernel.
I am thinking of preloding a monitor, or a wrapper to calls dlopen, fopen, and so on, in a library.
When a process that the init process has no data about is started, it will start with enviroment LD_PRELOAD set, and the library will call
all file openings directly to the initsystem... this works good in theory... Lets se if it works....
The role of initng is on boot time, when it preload files listed in a db file, if that service is market starting, this is done in a fork or thread. Collecting tha data to the db, is done by the client-preloaded-lib by him self, or a client-lib and a collect-daemon. Watch the wery good example of sandbox in portage if you dont understand how this works with LD_PRELOAD...irondog wrote:But init isn't a library, it doesn't provide fopen and friends. If you're not hacking the kernel, you need to hack libc. I have to get some sleep, but I don't think init is the right place to introduce Preloading.JimmyW wrote:Not imposible, youst hard..This must be impossible without kernel hacks. The only 'program' that can record which files are opened, is the kernel.
I am thinking of preloding a monitor, or a wrapper to calls dlopen, fopen, and so on, in a library.
When a process that the init process has no data about is started, it will start with enviroment LD_PRELOAD set, and the library will call
all file openings directly to the initsystem... this works good in theory... Lets se if it works....
Never mind, I'be be trying your new code soon and would be very pleased to see if someone is able to cleanly implement prefetch into GNU/Linux.
Prefetch in MS Windows also places files to preload very close to each other (fysical) on the disk/filesystem. There will never be a Linux develloper wanting to implement this into a new kind of filesystem. It's a little dirty idea, but when well implemented users benefit from it.[...]or even rewriting part of the filsystem source i think..
I agree init is the preloader. But main difficulty is the recording of the files to the database.JimmyW wrote:The role of initng is on boot time, when it preload files listed in a db file, if that service is market starting, this is done in a fork or thread.
You mean overloading fopen() with a wrapper for all programs? Is that possible? I'm new to LD_PRELOADCollecting tha data to the db, is done by the client-preloaded-lib by him self, or a client-lib and a collect-daemon. Watch the wery good example of sandbox in portage if you dont understand how this works with LD_PRELOAD...
I know that defraing the filesystem, and load all files at once have real bennefit, but the system with sysvinit and friends today, dont even use the harddrive 50% on boot time, for example, while modprobing modules, or probing an dhcp adress, the hardrive stands right still, that is not hapening, whit initng, not ever, until every file needed this boot is cached, tha harddrive will work..irondog wrote:Prefetch in MS Windows also places files to preload very close to each other (fysical) on the disk/filesystem. There will never be a Linux develloper wanting to implement this into a new kind of filesystem. It's a little dirty idea, but when well implemented users benefit from it.[...]or even rewriting part of the filsystem source i think..
I'm not talking to implement such a filesytem for linux, but the idea of Microsoft to preload files might be a very good thing for Linux to boot faster.
I think most of the performance gain comes from preloading files into memory instead of the 'defragging' of files that are needed to boot the OS. Linux could use this and it might not be too hard to develop it cleanly.
I agree init is the preloader. But main difficulty is the recording of the files to the database.JimmyW wrote:The role of initng is on boot time, when it preload files listed in a db file, if that service is market starting, this is done in a fork or thread.
You mean overloading fopen() with a wrapper for all programs? Is that possible? I'm new to LD_PRELOADCollecting tha data to the db, is done by the client-preloaded-lib by him self, or a client-lib and a collect-daemon. Watch the wery good example of sandbox in portage if you dont understand how this works with LD_PRELOAD...
To continue about preloading: Have you ever seen the difference in speed of launching KDE after a CTRL+ALT+BACKSPACE and the first time KDE is lauched? Have you ever looked how ineffectivly the harddisk is used when booting? If we could just cat all files needed at bootup to /dev/null we would already have a 30% faster bootup on starting the desktop software. Not even talking about all system services.
How to tell all applications to first look for files in the initramfs, if not found look in the default filesystem in a smart general way?Tiger683 wrote:How about doing the preloading through an initramfs.
You could log all the needed files, and crate the initramfs with them in it at shutdown, so that all the changes done
during the session are in it.
Just a basic idea......
T
IMHO this is useless as bootup is nothing more than one single script that is executed. This script can launch programs to run in paralell, but fact is: system bootup still is one single script.JimmyW wrote: Initng will also make sure that the daemon, or script will be ececuted exakty when all dependencys is met, and all in parrallall.
That's silly. It would result into a huge kernel image and move all loading into the bootloader. Besides initramfs and initrd have their own libc (Klibc and Glibcstatic or dietlibc) and don't have anything to do with preloading things on the disk.Tiger683 wrote:How about doing the preloading through an initramfs.
You could log all the needed files, and crate the initramfs with them in it at shutdown, so that all the changes done
during the session are in it.
Just a basic idea......
T
But there is no sane parralell execution in the sysvinit, in inittng every litlle dependncy, mount, daemonstart, pidset... is a new dependecy set, this way it is easy and possible to make a model that newer stops, and start sleeping.irondog wrote:IMHO this is useless as bootup is nothing more than one single script that is executed. This script can launch programs to run in paralell, but fact is: system bootup still is one single script.
The preloader, that is been written to ass we argument, is a fork or thread, to initng, that will preload files, in the best order, becous initng know in witch order services will start, and files will be requested, at the same time system boots up, and the first services is executed, this makes the harddrive NEVER SLEEP.I agree that thins like modprobe and dhcpcd stop the harddisk doing things because the system is waiting. This is exactly why we would want a preloader to run in the background as one of the first things the rc-scripts activate. NEVER LET THE HARDDISK DO NOTHING!! Such a preloader doesn't yet exsit. No GNU/Linux distribution with graphical userinterface boots efficiently, I think not even with INITng.
Thats a ugly hack, on disk block ordering have to be commonly done, in an generic way in the kernel-filsystem code, i am not the person to write that code. but i realy want to see it.That's silly. It would result into a huge kernel image and move all loading into the bootloader. Besides initramfs and initrd have their own libc (Klibc and Glibcstatic or dietlibc) and don't have anything to do with preloading things on the disk.
And what is the benefit if startup is faster on the cost of a slower shutdown?
But the chart shows something that isn't gentoo's baselayout. I could also write an /sbin/init that never makes my harddisk sleep. I would rather have a /sbin/init that is able to launch any GNU/Linux distro (like sysvinit). I think you are comparing apples and pears.The preloader, that is been written to ass we argument, is a fork or thread, to initng, that will preload files, in the best order, becous initng know in witch order services will start, and files will be requested, at the same time system boots up, and the first services is executed, this makes the harddrive NEVER SLEEP.
What say that initng cant boot every linux distro?, sysvinit togehter with distrospecific init scripts dont support the need concept: look at http://www.atnf.csiro.au/people/rgooch/ ... t-scripts/ maby thats explain to you.irondog wrote:But the chart shows something that isn't gentoo's baselayout. I could also write an /sbin/init that never makes my harddisk sleep. I would rather have a /sbin/init that is able to launch any GNU/Linux distro (like sysvinit). I think you are comparing apples and pears.The preloader, that is been written to ass we argument, is a fork or thread, to initng, that will preload files, in the best order, becous initng know in witch order services will start, and files will be requested, at the same time system boots up, and the first services is executed, this makes the harddrive NEVER SLEEP.
The library is always loaded, but the library preloaded can be writted to only report files about 1 minute from uptime.irondog wrote: Nevertheless, with the LD_PRELOAD trick is it possible to unset the fopen wrapper once the system has succesfully booted?
We could hook fopen() for every app to a recording engine to make a list of files needed at boottime. But is it possible to unset LD_PRELOAD again so we could remove the bloat of our so-called "preload-recorder".
unionfs, never heard abount this, this sounds good, vill check it out, i am going to work now, i be back on this forum in about 7 to 10 hours.Tiger683 wrote:Hey, back to the initramfs idea:
the creation of an image and packing it into initramfs should not be problem. now about telling the
apps what to load: you dont have to.
First, you could , in the linuxrc, dd the image into, say, /dev/ramX
(X=1,2,whatever), then mount /dev/ramX over the filesystem with unionfs, so apps would never notice they actually load stuff from ram. the
init itself could be started from there as well. then, at the end, just start a not overloaded daemon/app from the hd
which simply
umounts unionfs, clears /dev/ramX and dies. since the files in ram were mounted OVER those on hd, you never
have to tell anything to switch hd, for them, they were doing it from hd already
T
I said: seeing the graphs of initng you are booting something that doesn't look like you are booting Gentoo. So, you are comparing apples with pears. Besides I'm saying, no matter how good initng works, I can create rc-scripts that make my harddrive go crazy, while starting other programs meanwhile. Paralell stuf can also be included into scripts leaving init the way it is in sysVinit.JimmyW wrote:What say that initng cant boot every linux distro?, sysvinit togehter with distrospecific init scripts dont support the need concept: look at http://www.atnf.csiro.au/people/rgooch/ ... t-scripts/ maby thats explain to you.
IMHO the only thing we _must_ do is record which files were needed during the last boot. A db.irondog wrote:unanswered: Can we unset LD_PRELOAD once programs are started with it?? Do we want all programs to run with LD_PRELOAD set? Is this a big performance leak once the system is up-and-running?
Yes, but would the last 10 boots be even more interesting? We can learn things out of the statistics of every time we boot.Tiger683 wrote:IMHO the only thing we _must_ do is record which files were needed during the last boot. A db.irondog wrote:unanswered: Can we unset LD_PRELOAD once programs are started with it?? Do we want all programs to run with LD_PRELOAD set? Is this a big performance leak once the system is up-and-running?
HMn. Right. But this slows down our shutdown time. Besides, we want the harddisk to be active, but it's also very important not to waste CPU cycles because we are waiting on IO. It must be paralell with the normal bootup processes.NOTE: with linuxrc i mean the initng-equivalent.
This is how i imagine the whole thing:
1) We boot the system for the first time: image is empty, everything runs from hd because /dev/ramX was empty nothing was loaded from ram.
2) we recorded all files initng utilized into, say, /etc/initng/ramfs_db
3) on shutdown, we stuff these into a simple dd-like-image and this into a initramfs with our linuxrc.
4) next time we boot, linuxrc, as, usually, does a dd if=$our_image of=/dev/ramX etc.
Then it mounts the /dev/ramX over the normal root partition with unionfs and duplicate resolution=overload.
5) from here it all runs normally until we reached end of init,
then we just start a script from hd which simply umounts unionfs-mounted /dev/ramX and empties it.
all done.
no fiddling with glibc/kernel internals needed.
cheers,
T