[haiku-development] Re: Haiku self-hosting.

  • From: Luposian <luposian@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 1 Apr 2008 23:14:20 -0700

On Apr 1, 2008, at 6:32 PM, Stephan Assmus wrote:

Hi Luposian,

Copy a file in Haiku (while I don't think running it in an emulator
should matter, run it on REAL hardware, as that is what I am using).
Small, large, 100Mb, 500Mb.  It doesn't matter.  Wait until it looks
like EVERYTHING is done.  The drive light is no longer lit or blinking
at all.  Then wait even 30 seconds longer than that (just to make
ABSOLUTELY sure Haiku is happy).  Hit F12, to go into Kernel Debugging
mode, and then type "reboot".  When you reenter Haiku, look for where
you copied your file.  On my system, it's gone.  Any number of files
I've ever copied or unpacked or created... are gone when I do this
("spontaneous reboot").

the implementation of the writing back is not yet ideal. There is a TODO in the code, it boils down to the fact that Haiku doesn't have an I/O scheduler yet. Currently, Haiku writes back 32 KB of file data every three seconds, *if* there is no memory pressure (in case of pressure it writes much faster). This means that if you write a 500 MB file, but have plenty of memory left, Haiku will use about 3 hours 20 minutes to write all the contents of the file to disk. Obviously, this is not ideal by any measure. If you write lots of small files, and wait a bit before pulling the plug, you should see some of them survived on the disk and some not.

The reason why Haiku currently does not write the files as soon as possible, is that it should not interfere with other work going on. That would defeat the purpose of caching. Without an I/O scheduler, Haiku cannot tell whether the system is busy or not. I hope this interpretation is accurate, but I might be off.

In any case, you are obviously right that this is an issue, but it does not require quite as wordy emails to bring the point across... :-). Axel, who has been working on these parts the most, is definitely aware of the issue according to the TODOs in the code.

As always, please bear with us and have some patience. :-)

Um, not to sound too forward or anything (i.e. "non-heterosexual"), but... can I hug you? You have just explained, in a very concise, perfectly understandable way, *WHY* Haiku is doing what it's doing.

Why can't everyone be this good at explaining how/why Haiku operates the way it does?

Axel did mention that the I/O scheduler was an issue, but he never explained it much beyond that. Certainly, not to the degree, in as few words, as you have! Man, we gotta put you onto the documentation team for the Haiku owner's manual... *EVERYONE*, 3 yrs. old on up, will know how Haiku works! :-D

Now, here's my scenario:

I have 512Mb of RAM. Haiku, initially, takes (if I recall correctly) about 91Mb for itself (according to the "About this system..." option in the Blue Leaf menu). When I copy that 500Mb folder (containing five 100Mb "haiku.image" files), the memory usage bar goes up and up, til it maxes out. At which point, the copy process freezes momentarily. The copy then continues, noticeably slower from then on, as a little memory is reclaimed and then maxed out.... a little memory is reclaimed and then maxed out. This cycle continues, over and over, til the copy is supposedly complete (about 28-30 second), at which point, the copy window disappears. But the drive light is still flashing. It flashes for about 22 seconds longer (about 52 seconds from start to finish) before it stops. The drive light then just "blinks" every couple seconds, til the drive light no longer blinks at all. Solid black.

At this point, I assume the file MUST be written to the disk. But one day, I decided to REALLY let it take it's time and left to do something else. I was gone about 30 minutes. At which point, I hit F`12 and typed "reboot". And the rest is history... literally. When Haiku comes back up, there's NOTHING of the folder or the files inside it, where I copied them. No empty folder and not even 1 single file. It's just GONE! All of it! Like it was never there. And the disk space that Haiku was telling me was taken up? It's all back. Every byte! Like I never copied anything!

Shouldn't SOMETHING be there, in *30 minutes* of waiting?

I'll try writing a tiny text file in StyledEdit and save it. It's under 32K, so it should be done in WELL under 3 seconds, correct? I'll even wait *5 minutes* longer, just to make sure! If the file is still there when I hit F12 and type "reboot", then I will believe that it DOES write files to the disk, it's just really picky about which size of ones it will do or how they're arranged or whatever.

But, if others do the same thing I do (F12+"reboot") and aren't having this problem... what *IS* causing my problem? I'm maxing out my RAM completely! Several times, in fact, during the copy of that one 500Mb folder. So, shouldn't Haiku be furiously writing the files to disk as fast as digitally possible? :-)

Latre!

Luposian


Other related posts: