Layering and architecture
مُقدَّمفي هذا الدرس
| English | المعنى |
|---|---|
| Computer networks/kəmˈpjuːtə ˈnetwɜːks/ | connected devices that exchange data using shared protocols |
| layers/ˈleɪəz/ | Software levels separating concerns such as presentation, domain logic and storage. |
| service/ˈsɜːvɪs/ | الخدمة |
| encapsulated/enˈkæpsjʊleɪtɪd/ | التغليف |
| interface/ˈɪntəfeɪs/ | The operations and contracts through which other code uses an object or component. |
| Transmission delay/trænˈsmɪʃn dɪˈleɪ/ | the time to put all of a packet's bits onto the link: packet size ÷ bandwidth |
| Propagation delay/ˌprɒpəˈɡeɪʃn dɪˈleɪ/ | the time for a signal to travel the length of the link: distance ÷ signal speed |
| bandwidth–delay product/ˈbændwɪdθ dɪˈleɪ ˈprɒdʌkt/ | bandwidth times round-trip time: the amount of data in flight that fills the link |
| throughput/ˈθruːpʊt/ | the rate at which data actually arrives end to end, in bits per second |
| bottleneck link/ˈbɒtəlnek lɪŋk/ | the slowest link on a path, which sets the throughput of the whole path |
| store and forward/stɔː ænd ˈfɔːwəd/ | a router receives a whole packet before it sends any of it on to the next link |
The stack
- Computer networks 计算机网络 are built in layers 分层: each layer offers a service 服务 to the layer above and uses the layer below. The course stack has five: physical, link, network, transport and application.
- Data is encapsulated 封装 on the way down (each layer adds its header) and unwrapped on the way up. Each layer sees only its own part of the job.

A 100-byte payload leaves with how many Ethernet+IP+TCP header bytes?
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
14 + 20 + 20 = 54: one header per layer crossed.
Order the five layers from the top of the stack to the bottom.
الصعوبة 3/5 · 200 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Data moves down this list on the sender, each layer adding its header, and up it on the receiver, each layer removing its own.
Layers stay independent
- A change inside one layer needs no change anywhere else, as long as the service interface 接口 stays the same. Ethernet went from 10 Mb/s to 100 Gb/s under the same IP, because the link service (best-effort frames) never changed.
- A leaky interface breaks this. A browser that reads the TTL of the layer below works until that layer changes, and then it breaks for ever.
Ethernet could evolve under identical IP because —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
The service (best-effort frames) never changed, so the layer above never noticed.
One message, wrapped three times
- A 100-byte payload leaves with $14 + 20 + 20 = 54$ bytes of headers around it:
| Layer | Adds | Bytes on the wire |
|---|---|---|
| Application | the 100-byte payload | 100 |
| Transport (TCP) | a 20-byte header | 120 |
| Network (IP) | a 20-byte header | 140 |
| Link (Ethernet) | a 14-byte header | 154 |
- On the way up, the network card removes the Ethernet header, IP removes its 20 bytes and TCP removes its 20.
- The internet is shaped like an hourglass: a narrow waist (IP), a wide top (applications) and a wide bottom (links).
- One protocol in the middle lets everything above talk over everything below. The OSI model has 7 layers: it splits our link layer in two and adds presentation and session layers on top.
The waist of the internet hourglass is —
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
One narrow protocol (IP) lets every application talk over every link.
Four delays per hop
- Every hop adds four delays. Transmission delay 传输时延 is size over rate: a 1500-byte packet at 100 Mb/s takes $12\,000 / 10^8 = 120$ µs.
- Propagation delay 传播时延 is distance over signal speed: 2000 km at $2 \times 10^8$ m/s is $10$ ms. Queueing and processing delays depend on the router and the load.
- The bandwidth–delay product 带宽时延积 is the amount of data in flight: 100 Mb/s with a 20 ms round trip holds $2$ Mb, which is $250$ KB. A sender that keeps less than that in flight leaves the link partly empty.
How long does a 1500-byte packet take to transmit at 1 Gb/s, in microseconds?
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
1500 x 8 = 12 000 bits, divided by 10^9 bit/s is 12 µs.
A signal crosses 6000 km of fibre at 2 x 10^8 m/s. What is the propagation delay in milliseconds?
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
6 x 10^6 m / 2 x 10^8 m/s = 0.03 s = 30 ms.
The slowest link sets the speed
- A download crosses a 1 Gb/s home network, a 10 Mb/s access line and a 100 Mb/s backbone. Its throughput 吞吐量 is set by the slowest of the three, the bottleneck link 瓶颈链路: 10 Mb/s.
- A 10 MB file is $8 \times 10^7$ bits, so it takes $8 \times 10^7 / 10^7 = \mathbf{8}$ s. A faster home router changes nothing; only the bottleneck matters.
Links of 1 Gb/s, 10 Mb/s and 100 Mb/s in a row: time to download a 10 MB file (seconds)?
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
$8 \times 10^7$ bits at the 10 Mb/s bottleneck: 8 s.
Upgrading the 1 Gb/s home network to 10 Gb/s speeds up that download.
الصعوبة 1/5 · 100 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
The 10 Mb/s access line is still the bottleneck.
Worked example: one packet over three links
- A router must receive a whole packet before it sends it on (store and forward 存储转发). A 1500-byte packet crossing three 100 Mb/s links is transmitted three times: $3 \times 120$ µs $= 360$ µs.
- The 2000 km of fibre add 10 ms of propagation, wherever the routers are. The total is $\mathbf{10.36}$ ms: on long paths distance dominates, and on short ones transmission does.
1500 bytes over three 100 Mb/s links (store and forward) plus 10 ms propagation: total delay (ms, two decimals)?
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
$3 \times 0.12 + 10 = 10.36$ ms.
Marks that slip away
- Reading another layer's header. Code that depends on the TTL below breaks when that layer changes.
- Counting headers as payload. $100$ bytes of data travel with $54$ bytes of Ethernet, IP and TCP headers.
- Encapsulating the wrong way. Headers are added going down the stack and removed going up.
Recap
- Five layers: physical, link, network, transport, application; each serves the one above.
- Encapsulation adds a header per layer: $14 + 20 + 20 = 54$ bytes here.
- IP is the waist of the hourglass; layers stay independent while their interfaces hold.
ما المشكلة؟ لا يرى ذلك سوى فريق الموقع.