Discussion 2
1
CS 168, Spring 2026 @ UC Berkeley
Slides credit: Sylvia Ratnasamy, Rob Shakir, Peyrin Kao, Iuniana Oprescu
Packets and Sockets 📦
Logistics
Delays
Delays
Transmission Delay
Capacity = Delay × Bandwidth
Bandwidth
Propagation Delay
Transmission Delay: Formula
Usually bits/second
Transmission Delay: Example
Bandwidth = 4Mbps
Propagation Delay
Capacity = Delay × Bandwidth
Propagation Delay (latency)
Capacity = Delay × Bandwidth
Bandwidth
Propagation Delay
Propagation Delay: Formula
Propagation Delay: Example
Capacity = Delay × Bandwidth
Bandwidth
Propagation Delay
speed of light
Measuring Packet Delay with Timing Diagrams
Packet Delay = Transmission Delay + Propagation Delay
Packet Delay = (Packet Size / Bandwidth) + Propagation Delay
B
A
Bandwidth: 1,000,000 bps
Delay: 0.001s
t = 0s
t = 0.000001s
t = 0.001001s
t = 0.000800s
t = 0.001800s
800-bit packet
Transmission Delay
Propagation Delay
Pipe Diagrams
Pipe diagram shows the bits on the link at a frozen moment in time.
Now that we know the propagation delay, we can tell how many bits are “in flight” (on the link) at any time
B
A
Bandwidth: 5 bps
Delay: 7s
Bandwidth
Propagation Delay
Packets might have to wait before they can be transmitted…
Transient Overload
What happens if two packets arrive at the router simultaneously?
Router
B1
A1
A2
A3
A4
B2
B3
Need a queue!
Queuing Delay
Router
B1
A1
A2
A3
A4
B2
B3
Need a queue!
Persistent overload
Persistent overload: Not enough capacity to handle the incoming packets!
How do we solve persistent overload?
Router
B1
A1
A2
A3
A4
A5
A6
A7
B2
B3
B4
B5
B6
B7
Uh oh...
Burstiness and Queues
Packet Queuing and Life of a Packet
Queues introduce extra delay.
Life of a packet:
Round Trip Time (RTT)
The time it for the packet to reach its destination and receive a response
RTT = 2 * (End-to-End Delay)
Visualizing end-to-end-delay…
Transmission delay
Propagation delay
Transmission delay
Propagation delay
Queueing Delay
Time
End-to-end delay of brown packet
Statistical Multiplexing
Statistical Multiplexing
Statistical Multiplexing
15
12
9
12
15
9
>=
36
12
9
15
15
Layering in the Open Systems Interconnected (OSI) Model
L7: Application
do the thing
L6: Presentation
(ignored here)
L5: Session
(ignored here)
L4: Transport
beyond delivery: (un)reliability, packet assembly, congestion control, ...
L3: Network
global delivery, best-effort
L2: Data link
local delivery, best-effort
L1: Physical
physical transfer of bits
Layering in practice
HTTP(S)
TCP
IP
Ethernet
802.11 Wi-Fi
CAN bus
UDP
USB
SSH
Email (IMAP/POP)
...
L7: Application
L6: Presentation
L5: Session
L4: Transport
L3: Network
L2: Data link
L1: Physical
L3.5: research!
Sockets
26
Application
Transport
Network
Datalink
Physical
app
OS
(networking stack)
app
app
NIC
Port
(Network Interface Card)
Connection (the basic abstraction)
The Internet
Connection
Process
Process
Process
Process
Process
Process
Process
Process
Connection (the basic abstraction)
* (unless you’re implementing security)
The Internet
Connection
Process
Process
Connections
Client
Client
Client
Client
Server
Connections
Client
Client
Client
Client
Server
Are addresses enough to make this work?
1.2.3.4
5.6.7.8
10.20.30.40
9.10.11.12
13.14.15.16
Addresses aren’t enough
Server 1 Machine (5.6.7.8)
Server Process 1
Client 1 Machine (1.2.3.4)
Process 1
Process 2
How does the client computer know which process (i.e. web browser) to deliver data to?
Ports
Server Machine
Client Machine (1.2.3.4)
Process 1
(Port 10000)
Process 2
(Port 20000)
Process 1
(Port 80)
Ports
well known port
Server Machine
Client Machine (1.2.3.4)
Process 1
(Port 10000)
Process 2
(Port 20000)
Process 1
(Port 80)
Worksheet
Question 1: True or False
Worksheet
Question 2: End-to-End Delay
Question 2: End-to-End Delay
Question 2: End-to-End Delay
Question 2: End-to-End Delay
Question 2: End-to-End Delay
Question 2: End-to-End Delay
‼️
Question 2: End-to-End Delay
Worksheet
Question 3: Statistical Multi-What?
Question 3: Statistical Multi-What?
Question 3: Statistical Multi-What?
Questions?
Feedback Form: https://tinyurl.com/cs168-su25-disc-feedback