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:

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.

Mỗi tầng chỉ nói chuyện với tầng ngay dưới nó Ứng dụng: HTTP, DNS "lấy trang /index.html" Vận chuyển: TCP / UDP cắt gói, đánh số, gửi lại Internet: IP địa chỉ nguồn, đích; định tuyến Đường truyền vật lý cáp quang, Wi-Fi, 4G khung truyền IP: từ ... tới ... TCP: gói số 3 / 7 một mẩu dữ liệu HTTP Đổi Wi-Fi sang cáp quang chỉ đổi tầng dưới cùng — trình duyệt không cần biết.
Gói tin bọc nhiều lớp. Dữ liệu HTTP được TCP bọc thêm số thứ tự, rồi IP bọc thêm địa chỉ nguồn và đích, rồi tầng vật lý chở đi. Bên nhận bóc ngược từng lớp. Vì mỗi tầng chỉ phụ thuộc giao diện của tầng ngay dưới, thay tầng dưới cùng không làm hỏng tầng trên.

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.

Common mistake

Bẫy số một: nhầm Internet với World Wide Web. Email, game online, gọi video đều chạy trên Internet mà không dùng HTTP; Web chỉ là một ứng dụng. Bẫy số hai: tưởng IP bảo đảm gói tới nơi. IP chỉ cố gắng chuyển; việc phát hiện gói mất và gửi lại là của TCP. Bẫy số ba: chia dung lượng tính bằng byte cho băng thông tính bằng bit mà không nhân 8.

Key takeaway

Internet là mạng của các mạng, chạy được nhờ giao thức mở xếp tầng: IP lo địa chỉ và chuyển gói, TCP lo tin cậy và thứ tự, UDP đổi tin cậy lấy tốc độ, HTTP và DNS là tầng ứng dụng. Băng thông đo bằng bit mỗi giây; file đo bằng byte — nhân 8 trước khi chia.

← Algorithms: Searching, Efficiency and Limits · All AP Computer Science Principles lessons · Practice AP Computer Science Principles questions (free, instant scoring) · Packets, Routing and Scalability →