Circuit, packet and virtual-circuit switching
How data is moved through a network of links and nodes: circuit switching (reserved path, set-up time, no store and forward), packet switching (datagrams routed one by one, store and forward, statistical multiplexing) and virtual circuits (a path set up once, short labels per link); the total delay of a message split into packets over several links, the saving from splitting, and the probability that statistical multiplexing overloads a link, all computed exactly and cross-checked by an event simulation.
Why it exists
Two computers on opposite sides of a country are not joined by one wire. Their data crosses many links and nodes shared with many other users. How the nodes forward the data decides the delay, how many users can share the links, and what happens when a node fails. There are three classical answers.
Prerequisites
You need the idea of layers (layering).
Precise definitions
Circuit switching. Before data flows, a connection set-up reserves a fixed share of every link on the path (a time slot or frequency band, a circuit). The reserved capacity belongs to this connection for the whole call even when nothing is sent. Data then travel without waiting at nodes. Telephone networks work this way.
Packet switching. The message is cut into packets, each carrying its own header; packets share the links and are queued at nodes. Each node receives a whole packet before it starts to forward it (store and forward). Capacity is shared on demand, which is called statistical multiplexing.
Packet switching comes in two forms:
- Datagram network: no set-up. Every packet carries the full destination address and each router chooses the outgoing link for every packet independently from a forwarding table; packets of one message may take different routes and arrive out of order (this is how IP works).
- Virtual-circuit network: a path is chosen and state is set up before data (the connection setup); every packet carries only a short virtual-circuit identifier (VCI) which each switch rewrites on every link; all packets of the call follow the same path in order; the capacity is not reserved exclusively (unless the network also reserves resources). ATM and frame relay worked this way.
| circuit switching | virtual circuit | datagram | |
|---|---|---|---|
| set-up before data | yes | yes | no |
| capacity | reserved per call | shared | shared |
| packet carries | nothing (the circuit is the address) | short VCI | full destination address |
| path | fixed | fixed per call | may change per packet |
| order of delivery | in order | in order | not guaranteed |
| router state | per call | per call | forwarding table only |
| node failure | call dropped | call dropped | packets rerouted |
| congestion | refused at set-up (busy signal) | can occur | can occur |
The table is quoted from the textbooks.
How it works
Delay of a message over several links
Take links in a row, each with rate and propagation delay . A message of bits is cut into packets of bits (no headers, no processing and no queueing delay other than waiting for the previous packet on the same link).
- One packet (): every node has to receive the whole packet before forwarding it, so the transmission delay is paid on every link: .
- packets: the first packet needs to reach the end; each further packet follows one packet-time behind it, so the last packet arrives after
- Circuit switching: after the set-up time the message is sent as a stream over the reserved path without store and forward: .
Time to send 1 Mbit over 3 links of 1 Mbps: start
Computed by a script, not typed| method | total time | formula |
|---|---|---|
| packet switching, 1 packet of 1000000 bits | ||
| packet switching, 10 packets of 100000 bits | ||
| packet switching, 100 packets of 10000 bits | ||
| packet switching, 1000 packets of 1000 bits | ||
| circuit switching, setup 0.1 s | ||
| circuit switching, setup 0.5 s |
Step 0
One message of 10^6 bits, three links of 10^6 bits per second, no propagation delay, no queueing, no header overhead. Computed by the store-and-forward model of scripts/cn_lib.py (path_delay).
A -megabit message over three -Mbps links takes s as one packet, but only s as packets, s as packets and s as packets: splitting lets the links work in parallel (a pipeline). In the limit the time tends to (the time on one link) plus the delay of one small packet per extra link. With a set-up time of s circuit switching needs s, so packet switching with enough packets can be faster even for one message. The saving is real only while the header added to each packet is small; with headers of bits per packet each term grows to and there is an optimum number of packets.
Sharing a link: statistical multiplexing
A Mbps link serves users who each send at Mbps when active. Circuit switching can serve users (one circuit each). Packet switching admits more users because users are not active all the time:
Statistical multiplexing: how often is the link overloaded?: start
Computed by a script, not typed| population | users circuit switching can serve | P(more than 10 active) | as a percentage |
|---|---|---|---|
| 35 users, each active 10 % of the time | |||
| 20 users, each active 10 % of the time | |||
| 50 users, each active 10 % of the time | |||
| 30 users, each active 20 % of the time |
Step 0
Exact binomial sums (fractions) rounded for printing; users are assumed independent. Real traffic is burstier than this model.
With users, each active percent of the time independently, more than are active at once with probability only : the link is overloaded rarely, and then packets queue briefly. Packet switching therefore carries times as many users as circuit switching at almost the same quality. Packet switching is better for bursty traffic; circuit switching for steady streams that need guaranteed rate and no delay variation.
Worked examples
EX 1One packet over several links
EasyA -bit packet crosses links of Mbps with ms propagation delay each: ms.
EX 2Splitting into packets
MediumA -Mbit message, links of Mbps, no propagation delay, no headers. In packets of kbit: s. In packets: s. As one packet: s.
EX 3Circuit against packet
MediumSame message, circuit set-up s: s, slower than packets ( s) and faster than one packet ( s). With a set-up of s circuit switching ( s) beats packets but not .
EX 4Typical questions
GATE level(a) "Which switching technique needs a connection set-up and delivers in order?" Circuit switching and virtual circuits. (b) "Which uses the full destination address in every packet?" Datagram networks. (c) "Which technique wastes capacity during silences?" Circuit switching. (d) "Number of users that circuit switching supports on a Mbps link if each needs Mbps?" . (e) "Store and forward delay of a -packet message over links?" plus propagation.
Cheat box
Cheat box
- Circuit: reserved path, set-up, no queueing, wasteful for bursts. Packet: shared, store and forward, queueing delay.
- Datagram: full address per packet, no set-up, order not guaranteed. Virtual circuit: set-up, short VCI, in order.
- One packet over links: (+ ). equal packets: (+ ).
- Circuit: .
- Statistical multiplexing admits more users than circuits if traffic is bursty.
Traps and GATE patterns
Connections
Builds on
Across subjects
No cross-subject links yet.
The delay terms are defined on the next page (performance metrics). The Internet is a datagram network at the IP layer (IPv4 addressing, routing) on top of which TCP builds a reliable stream; the switches of a LAN forward frames in a similar store and forward way.
PYQs
6 previous year questions from your book. I re-solved each one myself (6 by running or simulating, 0 by reasoning only); the book's key is shown next to my answer. All PYQs
Consider a file of size 4 million bytes being transferred between two hosts connected via a path consisting of three consecutive links of bandwidth 2 Mbps, 500 kbps, and 1 Mbps, respectively. All processing delays and propagation delays are negligible. Assume there is no other background traffic over the path and no additional overhead to transfer the file. Which one of the following is the total time (in seconds) to transfer the file? Note: 1M = 106, 1k = 103
- (a)731
- (b)64
- (c)8
- (d)16
Two hosts are connected via a packet switch with 107 bits per second links. Each link has a propagation delay of 20 microseconds. The switch begins forwarding a packet 35 microseconds after it receives the same. If 10000 bits of data are to be transmitted between the two hosts using a packet size of 5000 bits, the time elapsed between the transmission of the first bit of data and the reception of the last bit of the data in microseconds is: COMPUTER NETWORK
Consider the store and forward packet switched network given below. Assume that the bandwidth of each link is 10^6 bytes/sec. A user on host A sends a file of size 10^3 bytes to host B through routers R1 and R2 in three different ways. In the first case, a single packet containing the complete file is transmitted from A to B. In the second case, the file is transmitted from A to B. In the third case, the file is split into 20 equal parts and these packets are sent from A to B. Each packet contains 100 bytes of header information along with the user data. Consider only transmission time and ignore processing, queuing and propagation delays. Also assume that there are no errors during transmission. Let T1, T2, and T3 be the times taken to transmit the file in the first, second, and third case respectively. Which one of the following is CORRECT?
- (a)T1 < T2 < T3
- (b)T1 > T2 > T3
- (c)T2 = T3, T3 < T1
- (d)T1 = T3, T3 > T2
Consider a source computer (S) transmitting a file of size 106 bits to a destination computer (D) over a network of two routers (R1 and R2) and three links (L1, L2, and L3). COMPUTER NETWORK L1 connects S to R1; L2 connects R1 to R2; and L3 connects R2 to D. Let each link be of length 100 km. Assume signals travel over each link at a speed of 108meters per second. Assume that the link bandwidth on each link is 1 Mbps. Let the file be broken down into 1000 packets, each of size 1000 bits. Find the total sum of transmission and propagation delays in transmitting the file from S to D?
- (a)1005 ms
- (b)1010 ms
- (c)3000 ms
- (d)3003 ms
Consider a network path P → Q → R between nodes P and R via router Q. Node P sends a file of size 106 bytes to R via this path, splitting the file into chunks one after the other, each of size 103 bytes. Node P sends these chunks without any wait time between the successive chunk transmissions. Assume that the size of the extra headers added to these chunks is negligible, and that the chunk size is less than the MTU. Each of the links P → Q and Q → R has a bandwidth of 106 bits/sec, and negligible propagation latency. Router Q immediately transmits every packet it receives from P to R, with negligible processing and queuing delays. Assume P starts transmitting the chunks at time t = 0. Which one of the following options gives the time (in seconds, rounded off to 3 decimal places) at which R receives all the chunks of the file?
- (a)16.000
- (b)8.000
- (c)8.008
- (d)15.992
In a packet switching network, packets are routed from source to destination along a single path having two intermediate nodes. If the message size is 24 bytes and each packet contains a header of 3 bytes, then the optimum packet size is:
- (a)4
- (b)6
- (c)7
- (d)9
Self-check
Question 1
links of Mbps, no propagation delay. How long does a -Mbit message take as packets?
Show answerHide
Packet size kbit, packet time ms. ms.
Question 2
Why does a datagram network need the full destination address in each packet?
Show answerHide
There is no per-call state in the routers; each router decides the next link from the packet's own destination address.
Question 3
A Mbps link, users active percent of the time sending at kbps. How many users can circuit switching serve? Can packet switching serve more?
Show answerHide
circuits of kbps. Packet switching can serve more, accepting a small probability that more than are active at once.
Revision card
One-screen revision
- Circuit: set-up, reserved capacity, no queueing. Datagram: full address, no set-up. VC: set-up, short VCI, in order.
- Store and forward: links, packets: .
- Statistical multiplexing exploits burstiness.
References
- ·Kurose, Ross, Computer Networking: A Top-Down Approach (8th edition), Chapter 1, Section 1.3 (The network core)
- ·Tanenbaum, Wetherall, Computer Networks (5th edition), Chapter 5, Section 5.1 (Network layer design issues: datagram and virtual-circuit networks)
Verification
scripts/enum-checks/cn_basic_check.py: the pipelined store-and-forward delay computed by scripts/cn_lib.py (path_delay) agrees with an independent event-driven simulation on 1500 random paths (1 to 5 links, 1 to 5 packets, random rates and propagation delays); the closed forms N L/R + N d (one packet) and (N + P - 1) L/R + N d (P equal packets, equal links, no queueing) hold on 500 random cases; splitting a message into P packets saves the amount computed on the page on 300 cases; the statistical multiplexing probabilities are exact binomial sums, checked against enumeration of all subsets of users for populations up to 16. MODEL: no packet loss, no queueing other than at the first transmitter, infinite buffers, no header overhead, no processing delay (stated on every table); real networks have all of them. The comparison table of the three switching types and the description of virtual circuits and datagram networks are QUOTED from the textbooks. Textbook chapter references are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand or by a small script (CRC remainders, binomial tail, checksums); long C programs were not re-read line by line (they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose). No defect found. Status raised to self-checked; verified needs a textbook or human check.
last verified: never
My notes (saved in this browser)