Hardware Reference
In-Depth Information
Changing the Scheduler
Now that you know
noop
is better than the CFQ for your needs, how do you go about changing the scheduler? There
are two ways to set the kernel I/O scheduler. The first method I will talk about is a temporary way to change it. After a
reboot it will go back to the default CFQ scheduler. In Figure
2-21
you can see all the available I/O schedulers. The one
in the brackets is the current scheduler. To change that to the
noop
scheduler, run this command:
Figure 2-21.
Changing the I/O scheduler
# echo noop > /sys/block/mmcblk0/queue/scheduler
You can see in Figure
2-21
I have changed the scheduler from the CFQ to
noop
.
The next way to change the I/O scheduler is more permanent. This is the method I recommend you do, as it will
help your Raspberry Pi's I/O performance. Ensure that you have your
/boot
filesystem mounted. If it is not, you can
simply mount it with this command:
# mount /boot
Once you have your
/boot
filesystem mounted, open up the file
/boot/cmdline.txt
and append it to the end of
the kernel boot line:
elevator=noop
You can see in Figure
2-22
an example of my kernel boot line.
Figure 2-22.
Kernel boot settings
After all that effort, you can run
top
to see how little memory your Raspberry Pi is now using. In Figure
2-23
my
Raspberry Pi is actively consuming approximately 21 MB of memory.
Figure 2-23.
The top command showing memory usage
Now that the operating system takes up very little memory and system resources, make sure that your applications
are also lightweight where possible.