I/O
Input and output: any time a program reads or writes data outside its own memory, such as files, networks or the terminal.
In more detail
I/O is slow compared with calculation, so a program that waits for it wastes time. Asynchronous I/O lets a program keep working while the operation completes.
Examples
In the browser: I/O is slow compared with computation. Browser I/O such as network and IndexedDB is asynchronous, while localStorage does synchronous disk I/O on the main thread.Node.js is designed around starting I/O and continuing with other work while it completes.Related terms
- disk block — The fixed-size unit, typically a few kilobytes, in which data is read from and written to disk.
- B-tree — A balanced search tree whose nodes each hold many sorted keys and have many children, so the tree is very wide and very shallow.
- page cache — Memory the operating system or database uses to keep recently read disk blocks, so repeated reads skip the disk.
- async and await — Language keywords for writing code that waits for slow work, such as a network call, without blocking a thread.
- thread — A path of execution inside a process that the operating system schedules on a processor; one process can have many.
- asynchronous — Describes work that starts now and finishes later, letting the program do other things instead of waiting for it.
- synchronous — Code that runs step by step and makes the program wait for each step to finish before the next one starts.
- localStorage — A browser feature that saves small text values for a website so they are still there after the page is closed and reopened.
- latency — The time between asking for something and getting the answer back.
- Dynamic IO — An experimental Next.js 15 mode in which data access is dynamic by default and you opt into caching with use cache.
- asynchronous I/O — Starting an input or output operation and carrying on with other work, being told later, usually through a callback or promise, when it has finished.
- blocking I/O — An operation that makes the program stop and wait until it finishes, so nothing else on that thread can run meanwhile.
Taught in
- B-Trees: The Structure Behind Every Database Index — Algorithms & Data Structures for Working Engineers
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices
- Querying, Change Tracking, and Saving Data — Modern .NET Core, C# & Enterprise Microservices
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform
- Client Storage Paradigms: Cookies, Storage Tradeoffs — Frontend Architecture & Web Platform
- Revalidation Strategies: revalidatePath & Cache Life — Next.js 15 & Modern App Router Architecture
- libuv Architecture: Event Demultiplexer & Thread Pool — Node.js Internals & Backend Services
- Event Loop Lifecycle: The Six Phases & libuv uv_run — Node.js Internals & Backend Services
- Poll & Check Phases: I/O Callbacks & setImmediate — Node.js Internals & Backend Services
- Asynchronous File I/O: node:fs/promises & Handles — Node.js Internals & Backend Services