Computer Science › Section E · Networking and the internet › Topic E.1

Network fundamentals

Almost every program you use talks to another computer. Before studying the internet itself, you need the basic vocabulary of networks: how far they reach, how machines are wired together, how they take turns on a shared channel, and which devices join small networks into larger ones.

What a network is

A computer network is a set of devices, called nodes or hosts, joined by wired or wireless links so they can exchange data. Networks are classified by reach. A personal area network (PAN) spans a few metres, such as earbuds paired with a phone; a local area network (LAN) covers a home, school or campus; a metropolitan area network (MAN) serves a city; a wide area network (WAN) links distant cities or continents. An open network uses published designs anyone may use without fees; a closed (proprietary) one is owned and licensed by one company. Most data networks use packet switching: data is cut into packets, each labelled with its destination, which travel independently and share links with other traffic. The old telephone system instead reserved a dedicated path for each call, called circuit switching.

Topology: bus, star and mesh

Topology is the pattern in which machines are connected. In a bus, all machines share one line, so every message passes every machine and each keeps only what is addressed to it. In a star, every machine connects to one central device, such as a switch or a Wi-Fi access point. In a mesh, machines have several links, so traffic can detour around a failure; the internet's core behaves like a large mesh. Cables can mislead. A hub simply repeats every signal out of all its other ports, so a network wired to a hub looks like a star but behaves like a bus.

Protocols and taking turns: CSMA/CD

A protocol is an agreed set of rules for communication: message format, the order of exchanges and what to do when something goes wrong. One problem on any shared channel is deciding who may transmit. Early Ethernet, which ran on a shared bus, used Carrier Sense, Multiple Access with Collision Detection (CSMA/CD). A machine waits until the line is quiet, then transmits while still listening. If two start together, both detect the collision, stop and wait a random time before retrying. Modern Ethernet gives each machine its own full-duplex link to a switch port, so collisions no longer occur there.

Wireless turn-taking: CSMA/CA

Radio makes collision detection unreliable: a station's own signal drowns out weaker ones, and two laptops at opposite ends of a building may both reach the access point without hearing each other. That second case is the hidden terminal problem. Wi-Fi, defined by the IEEE 802.11 standards, uses collision avoidance (CSMA/CA) instead. A station waits until the channel has been idle for a short gap plus a random delay. For hidden terminals, it can first send a short request and transmit only when the access point replies that the channel is clear, a reply every station hears. Avoidance reduces collisions but cannot remove them.

Joining networks: from repeaters to routers

A repeater joins two segments of a network and passes every signal across without reading it. A bridge reads each message's destination and passes it across only if it is for the other side, so local traffic stays local. A switch is a bridge with many ports, sending each message only towards its destination. All three build one larger network. A router instead joins separate networks, which may use different technologies, while each keeps its own addresses and rules; the result is an internet, a network of networks. The router linking a network to the outside world is its gateway. A home "router" box usually also contains a switch and a Wi-Fi access point.

Worked example: a message crossing an internet

A café laptop on Wi-Fi sends a document to a printer on an office's wired Ethernet. 1. The laptop labels the message with the printer's internet-wide address and sends it, using CSMA/CA, to its access point. 2. The access point passes it to the café's router, its gateway. 3. That router looks up the destination in its forwarding table and sends it towards the office router. 4. The office router sees the printer is on its own network and hands the message to the switch, using the printer's local hardware address. 5. The switch sends it out of the printer's port only. Check: only the routers had to understand both networks, so each machine needs a local address and an internet-wide one.

Bandwidth and latency

Bandwidth is how much data a link carries per second, in bits per second: 200 megabits per second (Mbps) is 200 million bits each second. Latency is the delay before data arrives, in milliseconds (ms), and the round-trip time is the delay for a message to go out and a reply to return. They are independent: a satellite link can have high bandwidth and high latency. File sizes are usually given in bytes and link speeds in bits, and 1 byte is 8 bits, so convert before dividing.

Worked example: one big file or many small requests

A home link has a bandwidth of 200 Mbps and a 40 ms round-trip time. 1. A 2.4-gigabyte game is \(2.4 \times 10^9 \times 8 = 1.92 \times 10^{10}\) bits. 2. Dividing by the bandwidth gives \(\frac{1.92 \times 10^{10}}{2 \times 10^8} = 96\) seconds at least. 3. A page whose code makes 50 tiny requests in sequence, each waiting for the last reply, spends at least \(50 \times 0.040 = 2\) seconds on round trips alone. 4. Check an upgrade: doubling the bandwidth halves the download to 48 seconds but leaves the 2 seconds unchanged. Big transfers are limited by bandwidth; chatty ones by latency.

Client/server and peer-to-peer

Processes on different machines coordinate through interprocess communication. In the client/server model, a client makes requests and a server satisfies them; the server runs continuously, ready for many clients, as early print servers and file servers did and web servers do now. In the peer-to-peer (P2P) model, processes act as equals, each requesting and supplying service, usually only temporarily. P2P file sharing spreads a file through a swarm of peers that pass on pieces they already hold. P2P describes how two processes communicate, not the network: one laptop can use both models at once.

Distributed systems: clusters, grids and the cloud

A distributed system runs its parts as processes on different computers. A cluster is many computers working closely, over a fast network, like one larger machine, giving high availability (some member answers even if others fail) and load balancing (work shifts to idle members). A grid is looser: machines owned by different people, such as volunteers running the BOINC system, share a huge task. Cloud computing rents shared computers on demand, as virtual machines and storage (IaaS), managed platforms for code (PaaS) or complete applications such as web email (SaaS).

Common mistakes to avoid

First, judging topology by cables alone: machines wired to a hub form a physical star but a logical bus. Second, treating a switch and a router as the same: a switch enlarges one network, a router joins separate ones. Third, assuming collision detection works on Wi-Fi. Fourth, mixing bytes and bits: 100 Mbps is at most 12.5 megabytes per second. Fifth, assuming more bandwidth always helps, when latency limits many small exchanges. Sixth, calling something a P2P network: P2P is how processes talk.

Key takeaways

Networks join nodes by links; PANs, LANs, MANs and WANs differ in reach, and open designs let anyone build compatible equipment. Topologies include bus, star and mesh. CSMA/CD detects collisions on a shared wire; Wi-Fi's CSMA/CA avoids them and handles hidden terminals. Repeaters, bridges and switches enlarge one network; routers join networks into an internet, through each network's gateway. Bandwidth is capacity; latency is delay. Clients request and servers respond, while peers do both. Clusters, grids and clouds are distributed systems.

Flashcards

Flashcard

LAN

Local area network: a home, building or campus

PAN is smaller; MAN and WAN are larger.

Test your understanding

Question 1 of 5

Five computers are cabled to a hub in the middle of an office. How does this network behave?

Question 2 of 5

Two laptops at opposite ends of a building can each reach the Wi-Fi access point but cannot hear each other. Why would collision detection fail here?

Question 3 of 5

What is the shortest possible time to download a 1.5-gigabyte file over a 100 Mbps link?

Question 4 of 5

A school wants to link its campus network to its internet provider's network while keeping them as two separate networks, each with its own addresses and rules. Which device does this?

Question 5 of 5

Which statement about the peer-to-peer model is correct?

← Previous topicNext topic →