<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j" -->

---
title: After 20 years I finally learned what 'double buffering' is
description: Double buffering solves a race condition, the author realizes after 20 years. Screen tearing happens because the refresh rate isn't aligned with how long it...
canonical: https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: After 20 years I finally learned what 'double buffering' is | daily.dev
og:description: Double buffering solves a race condition, the author realizes after 20 years. Screen tearing happens because the refresh rate isn't aligned with how long it...
og:url: https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j
og:image: https://api.daily.dev/og/posts/3bXZBGb1J.png
og:image:alt: After 20 years I finally learned what 'double buffering' is
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# After 20 years I finally learned what 'double buffering' is

**[Math ∩ Programming \(Jeremy Kun\)](https://daily.dev/sources/jeremykun)** · 2 min read · 0 upvotes · 0 comments

## Summary

Double buffering solves a race condition, the author realizes after 20 years. Screen tearing happens because the refresh rate isn't aligned with how long it takes to write a frame to the buffer, so the display shows a frame mid-write. Double buffering fixes this by keeping two buffers: one being written, one being displayed and read-only, swapping roles once a frame finishes. The insight clicked while studying CUDA programming from the book 'Programming Massively Parallel Processors,' where a lecture applies the same technique to solve a race condition reading and writing the same memory buffer.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.jeremykun.com/shortform/2026-11-21-1938>

## Questions this post answers

### What problem does double buffering actually solve in graphics rendering?

Double buffering solves a race condition between writing and displaying a frame. Because a screen's refresh rate isn't aligned with how long it takes to write a frame to the buffer, the display can show a frame mid-write, causing jitter and tearing. The fix keeps two buffers, one being written and one being displayed read-only, swapping roles once a write finishes.

_Developers debugging frame tearing can find clearer explanations of buffering techniques on daily.dev._

### Is double buffering only used for graphics rendering?

No, double buffering is a general technique for avoiding race conditions when reading and writing shared memory, applied beyond graphics. A lecture from the book 'Programming Massively Parallel Processors' uses double buffering in CUDA programming to prevent race conditions when a memory buffer is read and written concurrently.

_Anyone picking up CUDA or parallel programming can track concurrency patterns like this on daily.dev._

## Similar posts on daily.dev

- [Capping your frame rate 3 FPS below your refresh rate isn't just a suggestion; it's a requirement](https://daily.dev/posts/capping-your-frame-rate-3-fps-below-your-refresh-rate-isn-t-just-a-suggestion-it-s-a-requirement-pdsgxbcol) · XDA Developers · 0 upvotes · 0 comments
- [120 Frames a Second, and It Still Feels Choppy](https://daily.dev/posts/120-frames-a-second-and-it-still-feels-choppy-nanq0dmy3) · Medium · 0 upvotes · 0 comments
- [Dodging A 60-Year-Old Design Flaw In Your RAM](https://daily.dev/posts/dodging-a-60-year-old-design-flaw-in-your-ram-suj2gu1zl) · Hackaday · 0 upvotes · 0 comments
- [I tested VRR on and off for a week, and I'm keeping it off](https://daily.dev/posts/i-tested-vrr-on-and-off-for-a-week-and-i-m-keeping-it-off-fmupidyls) · XDA Developers · 0 upvotes · 0 comments

---

Tags: [#graphics-programming](https://daily.dev/tags/graphics-programming), [#cuda](https://daily.dev/tags/cuda)

[View this post on daily.dev](https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"After 20 years I finally learned what 'double buffering' is","url":"https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j"},"datePublished":"2026-11-22T04:03:29.246Z","dateModified":"2026-11-22T04:03:53.564Z","description":"Double buffering solves a race condition, the author realizes after 20 years. Screen tearing happens because the refresh rate isn't aligned with how long it...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"Math ∩ Programming (Jeremy Kun)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Math ∩ Programming (Jeremy Kun)","logo":"https://media.daily.dev/image/upload/s--73B_dqmt--/f_auto,q_auto/v1794732938/logos/jeremykun?_a=BAMAMiiw0","url":"https://daily.dev/sources/jeremykun"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"graphics-programming,cuda","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Math ∩ Programming (Jeremy Kun)","item":"https://daily.dev/sources/jeremykun"},{"@type":"ListItem","position":3,"name":"After 20 years I finally learned what 'double buffering' is"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/after-20-years-i-finally-learned-what-double-buffering-is-3bxzbgb1j#faq","mainEntity":[{"@type":"Question","name":"What problem does double buffering actually solve in graphics rendering?","acceptedAnswer":{"@type":"Answer","text":"Double buffering solves a race condition between writing and displaying a frame. Because a screen's refresh rate isn't aligned with how long it takes to write a frame to the buffer, the display can show a frame mid-write, causing jitter and tearing. The fix keeps two buffers, one being written and one being displayed read-only, swapping roles once a write finishes. Developers debugging frame tearing can find clearer explanations of buffering techniques on daily.dev."}},{"@type":"Question","name":"Is double buffering only used for graphics rendering?","acceptedAnswer":{"@type":"Answer","text":"No, double buffering is a general technique for avoiding race conditions when reading and writing shared memory, applied beyond graphics. A lecture from the book 'Programming Massively Parallel Processors' uses double buffering in CUDA programming to prevent race conditions when a memory buffer is read and written concurrently. Anyone picking up CUDA or parallel programming can track concurrency patterns like this on daily.dev."}}]}
```

