In operating systems, '''write barrier''' is a mechanism for enforcing a particular ordering in a sequence of writes to a storage system in a computer system. For example, a write barrier in a file system is a mechanism (program logic) that ensures that in-memory file system state is written out to persistent storage in the correct order.<ref>{{cite web|url=https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/writebarr.html |archive-url=https://web.archive.org/web/20220608144201/https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/writebarr.html |title=Chapter 16. Write Barriers |publisher=docs.fedoraproject.org |archive-date=2022-06-08 |url-status=dead |date= |accessdate=2014-01-24}}</ref><ref>{{cite web|url=https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/block/barrier.txt?id=09d60c701b64b509f328cac72970eb894f485b9e |title=I/O Barriers |author=Tejun Heo |work=kernel/git/torvalds/linux.git - Linux kernel source tree |publisher=git.kernel.org |date=2005-07-22 |accessdate=2014-01-24}}</ref><ref>{{cite web|url=https://lwn.net/Articles/400541/ |title=The end of block barriers |author=Jonathan Corbet |publisher=LWN.net |date=2010-08-18 |accessdate=2014-01-24}}</ref>
== In garbage collection == A write barrier in a garbage collector is a fragment of code emitted by the compiler immediately before every store operation to ensure that (e.g.) generational invariants are maintained.<ref>{{cite book |last1=Zorn |first1=Benjamin |title=Barrier methods for Garbage Collection |date=1990 |publisher=Citeseer |location=Department of Computer Science, University of Colorado in Boulder |pages=11–18 |citeseerx=10.1.1.52.8857 }}</ref><ref>{{Cite web|title=GC FAQ -- algorithms|url=https://www.iecc.com/gclist/GC-algorithms.html|access-date=2020-06-30|website=www.iecc.com}}</ref>
== In computer storage == A write barrier in a memory system, also known as a memory barrier, is a hardware-specific compiler intrinsic that ensures that all preceding memory operations "happen before" all subsequent ones.
== See also == * Native Command Queuing
== References == {{Reflist}}
== External links == * [https://lwn.net/Articles/283161/ Barriers and journaling filesystems] (LWN.net, May 21, 2008)
Category:Compilers Category:Memory management
{{Compu-storage-stub}} {{Comp-sci-stub}}