Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection-oriented vs. Circuit switching, Connectionless vs. Packet switching

As the title suggests, I am unable to see the difference between the following concepts that are constantly being mentioned in the class on networking at my university:

  • What's the difference between connection-oriented services and (virtual) circuit switching?
  • What's the difference between connectionless services and packet switching?

I feel like the respective terms are constantly being explained using the same analogies. Since I couldn't find a clarifing answer online, I thought it might be good idea to mention this here.

Thank you!

like image 664
lkbaerenfaenger Avatar asked May 05 '15 17:05

lkbaerenfaenger


2 Answers

Most people understand the classic Internet (IP) and Telephone-line (POTS) examples but unfortunately, these examples aren't enough to fully differentiate the four terms:

                         | Packet-switching (PS)        | Circuit-Switching (CS) |
                         |------------------------------|------------------------|
Connectionless (CL)      | IP                           | -                      |
Connection-oriented (CO) | ...                          | Telephone (POTS)       |

From the above, it's easy to see how people can equate CO to CS and equate CL to PS. However this equating is wrong because it turns out, there are protocols that are both connection-oriented and packet-switching:

                         | Packet-switching (PS)        | Circuit-Switching (CS) |
                         |------------------------------|------------------------|
Connectionless (CL)      | IP                           | -                      |
Connection-oriented (CO) | TCP, ATM, X.25               | Telephone (POTS)       |

The bottom-left is now filled in with a third type of network that at first, may seem confusing.
To understand, please compare the three:

  1. (CO, CS): data flow takes the same path -- this layer and all layers below use same path.
  2. (CL, PS): data flow takes different paths -- for this layer and the lower layers themselves may break data up and branch to more alternate paths.
  3. (CO, PS): data flow apparently takes the same path -- this layer and a lower layer are tightly coupled by one detail: the lower layer protocol is taking the higher layer's data flow and breaking up into "packets" that take different paths. The lower layer protocol must reorder at the end in order to "trick" the higher layer into thinking they took the same path (here the higher layer protocol temporarily takes the point of view that packets arriving in order is the same as them taking the same path).

The first case is too inflexible and no longer used. The third cases are is used heavily by the Internet -- in TCP, data flow is a trivial path consisting of one edge going from host to host. At this layer, this is only one possible path and so indeed data flows (trivially) along the same path always. However, it uses a lower layer protocol, IP, that takes our data flow and breaks into "packets" that take different paths. (CO, PS) networks have a fancier name of virtual circuits. Also note that (CL, CS) networks do not exist.

  • Packet-switching / Circuit-switching - data is/is not broken into "packets"
  • Connectionless / Connection-oriented - data may not/does take the same path, or equivalently: data may arrive out of order/always arrives in-order

Please don't conflate the terms circuit switching and virtual circuits by writing "(virtual) circuit-switching". They are two completely different things. For example, POTS Telephone lines are circuit switching but have nothing to do with virtual circuits!

The biggest mistake I see is to assume that all packet-switching networks are connection-less. At school, they taught me that a Packet-switching network necessarily must take the packets and route them individually resulting in different paths and out-of-order delivery. This is wrong! This is only true of CL Packet-switching. From Wikipedia:

Packet switching may be classified into connectionless packet switching, also known as datagram switching, and connection-oriented packet switching, also known as virtual circuit switching.

In fact, when you visit websites in your browser, you'll be using CO packet switching (TCP to be precise).

If you like analogies:

  • (CO, CS): old-style telephone calls. Your words arrive in the order you said them. Telephone call data was not broken into "packets" for routing (in fact, the routing was done manually by Telephone operators using switch boards).
  • (CL, PS): sending a letter using post. Your letters may arrive out of order. The letters are the "packets".
  • (CO, PS): X gives a document to an assistant. The assistant sends each page of the document in a letter. At the other end, another assistant reorganises the pages of the document and gives them to Y. X and Y are able to send all the pages in order to each other; but really they got scrambled, taking various routes in the post; and were finally unscrambled.
like image 170
James Lawson Avatar answered Oct 13 '22 21:10

James Lawson


To me, it seems like it should be:

What is the difference between connection-oriented and connectionless services? (layer 3/layer 4 question)

What is the difference between packet switched and circuit switched services? (layer 1/layer 2 question)

A connection-oriented service could be anything that utilizes TCP (transmission control protocol) as it requires a reliable connection where data needs to arrive in a certain order and error free. Services such as ftp, http, and telnet utilize TCP. TCP uses a series of ACK and SYN messages to ensure that the connection is up and that packets are arriving as intended. This is done on all packets that are sent and received. If a packet is dropped, a message is sent back to the sender to re-transmit the packet. TCP operates at layer 4.

On the otherhand, a connectionless service could be anything that utilizes UDP (user datagram protocol) and/or IP (internet protocol) where traffic doesn't need to be guaranteed to arrive at it's destination. Applications that need to be fast use UDP as the dropping packets is a tradeoff when working in near real-time. Services such as snmp, syslog, and some speed test sites use UDP. UDP also operates at layer 4. IP operates at layer 3.

Circuit switching is a technology that is traditionally used in the telecom industry. TDM (time division multiplexing) is used to allocate circuits for services such as voice service. When a circuit is set up, say for a phone call on a DS0 within a T1, that phone call has all the bandwidth that is allocated to that circuit (DS0) and as a result that bandwidth isn't shared with anyone else. At the physical layer (layer 1) T1's, DS0's, DS1's, DS3's, and optical carrier level circuits (SONET) are used for transport. Circuits that are provisioned on the above technologies are dedicated end-to-end.

Packet switching is a where data is segmented into packets and switched through a network. A major technology that utilizes packet switching at layer 2 is Ethernet. With packet switching, packets are moved around over shared media where resources are not dedicated end-to-end. As a result, congestion may occur.

like image 1
shadyryda Avatar answered Oct 13 '22 22:10

shadyryda