The Internet, Protocols and Bandwidth
AP Computer Science Principles · Unit 4 — Computer Systems and Networks
A network of networks
A computing device is a physical artifact that can run a program: a phone, a laptop, a router, a server. Devices joined together so they can share data form a computer network; a computing system is any group of devices and programs working together toward a common purpose. The Internet is not one network but a network of independently owned and operated networks that agree to exchange data.
Data moves between two devices along a path: the sequence of directly connected devices from sender to receiver. Choosing that path is routing. Two measures describe a connection. Bandwidth is the maximum amount of data that can be sent in a fixed amount of time, usually stated in bits per second (Mbps = millions of bits per second). Latency is the delay before a single bit arrives. A high-bandwidth link can still feel slow if latency is high, because every request must wait a full round trip before anything comes back.
Bandwidth is quoted in bits, but file sizes are quoted in bytes, and $1$ byte $=8$ bits. Almost every timing question on the exam turns on that factor of eight. Real connections also lose part of their capacity to packet headers, retransmissions and sharing with other users, so effective throughput is lower than the advertised bandwidth.
Protocols and layers
A protocol is an agreed-upon set of rules that specify the behavior of a system. Because the Internet's protocols are open (publicly documented and non-proprietary), any manufacturer can build a device that joins the network without asking permission. That openness is a major reason the Internet grew so fast.
The protocols are stacked in layers, and each layer uses the one below it as an abstraction:
- IP (Internet Protocol) gives every device an address and moves individual packets toward a destination address. IP makes no promise that a packet arrives, arrives once, or arrives in order.
- TCP (Transmission Control Protocol) sits on top of IP. It numbers packets, has the receiver acknowledge them, re-sends missing ones, and reassembles them in order. Reliability costs time.
- UDP (User Datagram Protocol) also sits on IP but skips acknowledgments and re-sending. It is faster and is used when a late packet is worthless anyway, such as live voice or game position updates.
- HTTP is the protocol of the World Wide Web: a browser requests a resource and a server responds. The Web is one application that runs on the Internet; the two words are not synonyms.
- DNS (Domain Name System) translates a name such as
example.orginto an IP address before any HTTP request can be sent.
The payoff of layering is independence: a web browser speaks HTTP and does not care whether the bits underneath travel by fiber, Wi-Fi or satellite.
Worked example: tải file qua đường truyền thật
Một file video nặng $2{.}4$ GB (lấy $1$ GB $=1000$ MB). Gói cước quảng cáo $80$ Mbps, nhưng do phần đầu gói và chia sẻ đường truyền, thông lượng thực chỉ bằng $75\%$ băng thông. Tính thời gian tải tối thiểu, và cho biết nếu quên thừa số 8 thì sẽ ra con số nào.
Solution
Bước 1 — đổi dung lượng sang bit. $2{.}4$ GB $=2400$ MB $=2400\times 8=19\,200$ megabit.
Bước 2 — thông lượng thực. $80\times 0{.}75=60$ Mbps.
Bước 3 — chia. $t=\dfrac{19\,200}{60}=320$ giây, tức khoảng 5 phút 20 giây.
Nếu quên nhân 8 (coi 2400 MB như 2400 megabit) thì ra $\dfrac{2400}{60}=40$ giây — nhanh gấp 8 lần thực tế. Nếu quên trừ hao 25% thì ra $\dfrac{19\,200}{80}=240$ giây. Cả hai con số sai đều có trong phương án nhiễu của đề thật; luôn viết đơn vị bên cạnh từng con số để thấy megabyte và megabit không triệt tiêu nhau.