<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rajeev Ganesan on Medium]]></title>
        <description><![CDATA[Stories by Rajeev Ganesan on Medium]]></description>
        <link>https://medium.com/@rajeevganesan26?source=rss-e3ffe1dc9530------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*OWNc46VZrZQ7WudN</url>
            <title>Stories by Rajeev Ganesan on Medium</title>
            <link>https://medium.com/@rajeevganesan26?source=rss-e3ffe1dc9530------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:30:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajeevganesan26/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The OS Trick That Makes fork() Surprisingly Cheap — Copy On Write]]></title>
            <link>https://medium.com/@rajeevganesan26/the-os-trick-that-makes-fork-surprisingly-cheap-copy-on-write-d10c35c7906d?source=rss-e3ffe1dc9530------2</link>
            <guid isPermaLink="false">https://medium.com/p/d10c35c7906d</guid>
            <dc:creator><![CDATA[Rajeev Ganesan]]></dc:creator>
            <pubDate>Sun, 01 Feb 2026 10:49:27 GMT</pubDate>
            <atom:updated>2026-02-02T04:47:20.183Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rwFuaU5cWg8Jt61bNuNZ-g.jpeg" /></figure><h3>1. Introduction to Copy-on-Write in UNIX Systems</h3><p>Copy-on-write (COW) is a memory management optimization used by UNIX operating systems to improve the performance of the fork() system call. Traditionally, creating a child process involved copying the entire address space of the parent, which was expensive and time-consuming. Copy-on-write avoids this overhead by delaying memory duplication until it is actually required.</p><p>Here we focus on analyzing how copy-on-write page management strategies affect the response time of UNIX fork() operations. The study demonstrates that with modern Memory Management Units (MMUs), copy-on-write can be implemented efficiently and generalized across different systems.</p><h3>2. The UNIX fork() Operation and Memory Management</h3><p>The fork() system call creates a new process by duplicating the calling process. Instead of immediately copying all memory pages, both the parent and child processes initially share the same physical memory pages.</p><p>Key characteristics of this mechanism include:</p><ul><li>Page table entries are copied rather than the actual memory pages</li><li>Shared pages are marked as read-only</li><li>Actual copying occurs only when a write operation is attempted</li></ul><p>This approach significantly reduces the cost of process creation, especially when the child process performs minimal or no modifications to the shared memory.</p><h3>3. How Copy-on-Write Improves Fork Performance</h3><p>The study shows that the performance of fork() is largely independent of the total memory allocated by the parent process. This is because only the page tables are duplicated during process creation, not the data itself.</p><p>Important observations from the analysis:</p><ul><li>The size of the parent’s data segment has little direct effect on fork execution time</li><li>Execution time is mainly influenced by how much memory the child process writes to</li><li>Pages are copied only when a write fault occurs</li></ul><p>As a result, copy-on-write provides substantial performance improvements when the child process modifies only a small fraction of the parent’s memory.</p><h3>4. Experimental Setup and Systems Evaluated</h3><p>The analysis was conducted on two workstation systems:</p><ul><li>AT&amp;T 3B2/310</li><li>Hewlett-Packard HP9000/350</li></ul><p>These systems were selected to study the relationship between:</p><ul><li>Parent process memory size</li><li>Fraction of memory written by the child</li><li>Execution time improvements due to copy-on-write</li></ul><p>Since the implementation of copy-on-write is straightforward with modern MMUs, the results obtained from these platforms are applicable to a broader class of UNIX-based systems.</p><h3>5. Key Findings and Performance Implications</h3><p>The experimental results highlight several important insights:</p><ul><li>Fork performance does not degrade significantly with increased parent memory size</li><li>The dominant cost factor is the number of pages actually written by the child</li><li>Copy-on-write minimizes unnecessary memory copying</li></ul><p>This confirms that copy-on-write is particularly effective in scenarios where fork() is followed by exec() , a common pattern in UNIX systems.</p><h3>6. Why Copy-on-Write Matters in Modern OS Design</h3><p>Copy-on-write plays a crucial role in efficient process creation within UNIX operating systems. By postponing memory duplication until modification is required, it reduces overhead and improves system responsiveness.</p><p>The study reinforces that:</p><ul><li>Copy-on-write is a practical and scalable optimization</li><li>It enables fast process creation without sacrificing correctness</li><li>Its benefits are most pronounced in real-world workloads</li></ul><p>Overall, copy-on-write remains a foundational technique in modern operating system design, especially for systems that rely heavily on process-based concurrency.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d10c35c7906d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>