No history yet

Introduction to Distributed Systems

Many Computers, One System

When you search for something online or watch a streaming video, it feels like you're interacting with a single, powerful computer. In reality, you're using a distributed system. A distributed system is a collection of separate, independent computers that appear to its users as a single, coherent system.

Think of it like a large restaurant kitchen. There isn’t one chef doing everything. Instead, there's a team of chefs, each with their own station and specialty—one handles grilling, another preps vegetables, and a third plates the dishes. They are independent, but they communicate and coordinate to prepare a complete meal. From the diner's perspective, the kitchen acts as one entity that produces their food.

Lesson image

In a distributed system, these individual computers, often called nodes, are connected by a network. They pass messages back and forth to coordinate their actions and share information. The main goal is to pool resources and capabilities to accomplish tasks that a single computer couldn't handle, or couldn't handle as efficiently.

Working at the Same Time

Two key concepts in distributed systems are concurrency and parallelism. They sound similar but describe different ways of handling tasks.

Concurrency

noun

The ability of a system to handle multiple tasks by making progress on them in overlapping time periods.

Concurrency is like a chef making a salad and a soup at the same time. The chef might chop vegetables for the salad, then turn to stir the soup, then go back to the salad. The tasks are interwoven, not necessarily done simultaneously. The system is juggling multiple tasks and switching between them.

Parallelism

noun

The ability of a system to execute multiple tasks or parts of a single task simultaneously.

Parallelism is like having two chefs working at once. One chef chops vegetables for the salad while another chef is simultaneously stirring the soup. This requires multiple workers (or in computing, multiple processors or computers) to perform tasks at the exact same time. Distributed systems are often built to take advantage of parallelism, splitting a large task among many nodes to get it done faster.

The Hard Parts

Building and managing distributed systems comes with unique challenges that don't exist when working with a single computer.

A key challenge is the lack of a global clock. Each computer in the network has its own internal clock, and these clocks are never perfectly synchronized. This makes it incredibly difficult to determine the precise order of events across the entire system. Was your request processed before or after someone else's if the requests landed on two different machines a millisecond apart? Without a single source of time, it's hard to say for sure.

Another major issue is the independent failure of components. Any single computer, or the network connection between them, can fail at any time. A well-designed distributed system must be fault-tolerant, meaning it can continue to operate correctly even when some of its parts go down. This is like one of the holiday lights in a string burning out, but the rest of the string stays lit. The system must detect failures and gracefully handle them without bringing everything to a halt.

These challenges make creating reliable distributed systems a complex field of computer science. Engineers need to find clever ways to create order out of potential chaos, ensuring that even with unreliable parts and no single source of truth, the system as a whole works predictably and correctly.