Distributed & Networked Operating Systems

the peer-to-peer model

Imagine a neighborhood book-swap where there is no central library. If you want a book, you ask around among your neighbors; whoever has it lends it; and you, in turn, lend your books to others. Everyone is both a borrower and a lender at once. The peer-to-peer model organizes a distributed system exactly this way: there is no special server and no special client. Every node, called a peer, is equal and acts as both client (asking for things) and server (providing things) at the same time.

In practice, peers find each other and share resources directly, without funneling everything through one central machine. To look something up, a peer might ask its known neighbors, who ask their neighbors, until the request reaches whoever has the data. Many designs use a structured scheme so a peer can locate data in roughly O(log n) hops among n peers, rather than asking everyone. Because work and data are spread across the peers themselves, the system can grow simply by adding more peers — each new peer brings its own capacity.

Why it matters, and the trade-offs: peer-to-peer removes the central bottleneck and the single point of failure, so it can scale enormously and survive individual nodes leaving (file-sharing networks and many blockchains work this way). The honest cost is that everything is harder without a central authority: there is no single place that holds the truth, so finding data, keeping copies consistent, agreeing on anything, and stopping bad actors all become genuinely difficult coordination problems. You trade the simplicity of a central server for resilience and scale.

In a peer-to-peer file-sharing network, a movie you download does not come from one big server — it arrives in pieces from dozens of other ordinary computers that already have parts of it, and meanwhile your computer uploads pieces to others. No single machine is in charge, and the network keeps working even as individual peers come and go.

Every node is both client and server. No center to bottleneck, but coordination is harder.

Peer-to-peer is not automatically "better" than client-server. It buys scalability and fault tolerance at the cost of much harder data lookup, consistency, and trust. Many real systems are hybrids (peers for bulk transfer, a small central server for coordination).

Also called
P2P點對點架構對等網路