* Bryan Koschmann [Wed, Dec 05, 2001 at 11:36:38AM -0800]:
> Okay maybe this is an oddball or even stupid question, but is there a good
> way to load mozilla into ram so it will load quickly? I was happy with the
> way IE on windows ran, but I know that was mostly because it was all
> integrated.
> 
> Any help would be great, thanks!
> 
>       Bryan

The simplest and best way is to have Mozilla running all the time
just keep it minimized and pop it up when you need it. No need to
exit/restart over and over again. It will, however, be pretty slow
if it hasn't been in use for a while as lots of pages are swapped
out and have to be read in. This can be really annyoing with slow 
disk and/or too little RAM.

Putting mozilla on a ramdisk is easy but IMHO a bad idea: the load 
time will only be slightly faster, and still slower than keeping it 
running. However, if you have memory to spare, the swapping out can
be disabled in a very crude and unwieldy way which requires being
root: lock all of mozilla's pages in memory using the mlock system 
call.

I devised a simple C program which can be used as a launcher:

mlock.c:

  #include <stdio.h>
  #include <sys/mman.h>
  #include <unistd.h>

  extern char **environ;

  int main( int argc, char *argv[] )
  {
     if (mlockall(MCL_FUTURE)==-1)
     {
        printf("Unable to lock memory\n");
        return 1;
     }
      
     if (argc>1)
        execve(argv[1],argv+1,environ);
   
     return 1;
  }

It simply disables paging for the process (by calling mlockall) and then
replaces the process with the program specified in the first argument
(execve).

Note that page locks are not inherited by child processes, so you have
to run mozilla-bin directly instead of the mozilla wrapper (which is a
shell script):

$ su 
# ./mlock /usr/lib/mozilla/mozilla-bin

Now mozilla will stay in memory and never be swapped out no matter how 
much memory other processes require. I wouldn't recommend this method 
though, especially not with beta software like mozilla which probably
has memory leaks. It can quickly consume lots of memory and cause
thrashing, deadlocks and other nasty stuff. But it just goes to show 
that it *is* possible to keep things in memory if one really wants to.

- Johannes Eriksson



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to