ck kernel wiki
Register
Advertisement

In short, swap prefetch makes use of a computer's idle time to swap back in applications that may have been swapped out while using another application. Interestingly, swap prefetch does not evict from swap data that was swapped back in to physical memory. Therefore, an application that was swapped back by prefetching may end up needing to be swapped out again, but it'll happen essentially for "free," thereby helping to reduce perceptible desktop lag due to I/O bottlenecking.


Examples[]

Editing Large Files[]

If a person were to edit a very large .TIFF file using Gimp, applications in the desktop's background may be swapped out since it needs a good deal of physical memory. Once the user finishes editing the .TIFF file, he may take a break, and close Gimp -- freeing up tons of physical memory. Swap prefetch will soon swap back in some of the applications that were swapped out during the editing process. This is very important as it allows those applications to be utilized upon returning without waiting for the slow disk to read application data back into physical memory.

Cron Tasks[]

Another scenario is that a daily back-up routine of your home directory may kick in while you're sleeping. Such a back-up may utilize tar and bzip2. It may cause running desktop applications to be swapped out. With swap prefetch, those applications will eventually be swapped back in once the back-up process is completed, making your desktop responsive in the morning! Otherwise, they'll sit in swap until needed by you.

Advertisement