# Readahead

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Readahead
> Markdown URL: https://mediated.wiki/source/Readahead.md
> Source: https://en.wikipedia.org/wiki/Readahead
> Source revision: 1331633863
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|System call of the Linux kernel}}
{{Lowercase title}}
'''Readahead''' is a [system call](/source/system_call) of the [Linux kernel](/source/Linux_kernel) that loads a file's contents into the [page cache](/source/page_cache). This [prefetches](/source/prefetching) the file so that when it is subsequently accessed, its contents are read from the [main memory](/source/main_memory) ([RAM](/source/Random-access_memory)) rather than from a [hard disk drive](/source/hard_disk_drive) (HDD), resulting in much lower file access latencies.<ref>{{cite web
 | url = https://lwn.net/Articles/155510/
 | title = Adaptive file readahead
 | date = 2005-10-12 | access-date = 2014-08-20
 | author = Jonathan Corbet | publisher = [LWN.net](/source/LWN.net)
}}</ref><ref>{{cite web
 | url = http://man7.org/linux/man-pages/man2/readahead.2.html
 | title = readahead(2) - Linux manual page
 | access-date = 2014-04-09
 | website = man7.org
}}</ref>

Many [Linux distributions](/source/Linux_distributions) use readahead on a list of commonly used files to speed up [booting](/source/booting). In such a setup, if the [kernel](/source/kernel_(operating_system)) is booted with the {{mono|profile}} [boot parameter](/source/Linux_kernel_boot_parameters), it will record all file accesses during bootup and write a new list of files to be read during later boot sequences. This will make additional installed services start faster, because they are not included in the default readahead list.<ref>{{cite web
 | url = http://free-electrons.com/pub/readahead/doc/ols2007-readahead-paper.pdf
 | title = Readahead: time-travel techniques for desktop and embedded systems
 | date = 2007-06-15 | access-date = 2014-05-01
 | author = Michael Opdenacker | website = free-electrons.com
 | pages = 5&ndash;6
}}</ref>

In Linux distributions that use [systemd](/source/systemd), readahead binary (as part of the boot sequence) was replaced by systemd-readahead.<ref>{{cite web
 | url = https://fedorahosted.org/readahead/
 | title = Readahead
 | access-date = 2014-04-09
 | website = fedorahosted.org
}}</ref><ref>{{cite web
 |url         = http://www.freedesktop.org/software/systemd/man/systemd-readahead.html
 |title       = systemd-readahead-replay.service
 |date        = 2014-03-26
 |access-date  = 2014-04-09
 |website     = freedesktop.org
 |url-status     = dead
 |archive-url  = https://web.archive.org/web/20140409235938/http://www.freedesktop.org/software/systemd/man/systemd-readahead.html
 |archive-date = 2014-04-09
}}</ref>  However, support for readahead was removed from systemd in its version 217, being described as unmaintained and unable to provide expected performance benefits.<ref>{{cite web|url=https://cgit.freedesktop.org/systemd/systemd/tree/NEWS#n950|title=systemd/systemd – System and Session Manager: Changes with 217|website=cgit.freedesktop.org|access-date=2018-02-09}}</ref>

Certain experimental [page](/source/Page_(computer_memory))-level prefetching systems have been developed to further improve performance.<ref>{{cite web
 |url         = http://prefetch.googlecode.com/files/gsoc-prefetching-presentation.pdf
 |title       = Linux solution for prefetching necessary data during application and system startup
 |year        = 2008
 |access-date  = 2014-07-28
 |author      = Krzysztof Lichota
 |website     = code.google.com
 |url-status     = dead
 |archive-url  = https://web.archive.org/web/20091211124530/http://prefetch.googlecode.com/files/gsoc-prefetching-presentation.pdf
 |archive-date = 2009-12-11
}}</ref>

== In filesystem ==
*[Bcache](/source/Bcache) supports readahead of files and metadata.<ref>{{cite web |title=bcache.txt\Documentation - linux-bcache.git - Unnamed repository; edit this file 'description' to name the repository. |url=https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt |website=evilpiepirate.org |access-date=1 May 2020}}</ref>
*[ZFS](/source/ZFS) supports readahead of files and metadata, when using ARC.<ref>{{cite web |title=Part 10 - Monitoring and Tuning ZFS Performance{{!}} Oracle Community |url=https://community.oracle.com/docs/DOC-914874 |website=community.oracle.com |access-date=1 May 2020}}</ref>

== See also ==
*[Prefetcher](/source/Prefetcher)
*[preload (software)](/source/preload_(software))

== References ==
{{Reflist|30em}}

{{Linux kernel}}
{{Linux}}

Category:Preloading and prebinding
Category:Linux file system-related software

{{Linux-stub}}

---
Adapted from the Wikipedia article [Readahead](https://en.wikipedia.org/wiki/Readahead) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Readahead?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
