User Tools

Site Tools


howto:save_ram_by_using_exec

Save some RAM by using carefully placed exec's

At the end of /usr/bin/startsimple.sh, there are there 3 lines:

      (sleep 3; /usr/bin/keyboardstatus) &
      (sleep 8; /opt/xandros/bin/start_netserv) &
      (sleep 16; /usr/local/bin/asusosd) &

The purpose is to wait the given amount of second and then start those 3 daemons…. and it runs in the background, in order not to block the start-up process. Parentheses mean that the shell will invoke subshell executing those commands. But, the subshell will stay there, as long as keyboardstatus (etc…) runs, which is until the Eee is turned off… see by issuing this command:

 ps auxfw|grep -3 keyboardstatus

and notice that keyboardstatus (etc…) is descending from /bin/sh.

The subshell is of course not necessary, so we get rid of it by modifying the lines to be:

      (sleep 3; exec /usr/bin/keyboardstatus) &
      (sleep 8; exec /opt/xandros/bin/start_netserv) &
      (sleep 16; exec /usr/local/bin/asusosd) &

Just issue (on the terminal) the command

  sudo nano /usr/bin/startsimple.sh

and add those exec's, save and close, reboot and you are done. Verify by:

 ps auxfw|grep -3 keyboardstatus

You save three subshells, which amounts to perhaps one megabyte of RAM saved… not much, but it helps :-)

howto/save_ram_by_using_exec.txt · Last modified: 2008/08/01 09:17 by garabik