Lecture 3 (Feb. 9)

Last Lecture

   -- Statistical Multiplexing in packet-switched networks
     - scheduling
     - congestion control

   -- bandwidth and latency
 
   -- layering architecture

Today

   -- layering architecture (cont'd)
   -- reliable transmission 

--------------------------------------------------------------------

A protocol is a set of rules and formats that govern the communication
between communicating peers. It allows the peers to agree on a set of
valid messages and the meaning of each message.

A protocol unit defines 
a) a service interface to upper layer; i.e., other objects on the
same computer that want to use its communication services. 
b)a peer interface to its peer entity on another machine.

A service access point (SAP) -- the interface between the lower and
upper layers. Each SAP has a unique address. e.g. the SAPs in the telephone
system = sockets where phones are plugged, SAP addresses = phone
numbers of the corresponding sockets.

Protocol data units (PDUs) -- packets exchanged between peer entities
in the same layer.

Service data units (SDUs) -- packets handed to a lower layer by an
upper layer. 

A PDU is typically a SDU with an additional header or trailer that
carries information needed by that layer's protocol.
We say that the SDU is encapsulated in the PDU.


Postal service analogy (cont'd)
----------------------

The SAP is the post office. Between customers the PDU is a letter,
which is also a SDU for the post office. The PDU for the post office
is a mailbag that contains letters to a common destination. 
With respect to the post office, each letter (SDU) has a protocol
header =  an envelope with a destination address and a stamp to include 
prepayment of service charges. The letter is encapsulated in the envelope.



Advantages of Layering
---------------------
 a) break up a complex problem into smaller, more manageable parts
    -- each layer solves only part of the problems.
 b) separation of implementation and specification - implementation
details of a layer is hidden (abstracted) from 
other layers - allows implementations to change without disturbing the
rest of the stack. 
  c) Shared functionality -- many upper layers can share the services
provided by a lower layer.

Disadvantages of Layering
-------------------------
 
Layering = information hiding, and sometimes leads to poor
performance. e.g. TCP uses packet loss as the only indication of
network congestion, but packet loss/corruption could be caused by link
errors in the wireless medium, making TCP inefficient. 


From lower to upper layers in network architecture:


Physical layer - handle transmission of raw bits over a link.

Data Link layer - collects a stream of bits into a larger unit called
a frame.  Data link layer is usually implemented in a device called
network adaptor, which deliver frames to a host.

Network layer - handle routing among nodes in a packet-switched
network. The unit of data exchanged among nodes at this
layer is called a packet. 

The above 3 layers are implemented at all network nodes, including
hosts and switches/routers.

Transport layer - implements a logical channel connecting two hosts.

Application layer - e.g. FTP, HTTP.


Internet Architecture (TCP/IP architecture)
--------------------

IP (Internet Protocol) -- network layer protocol supports the
inerconnection of multiple networking technologies into a single
logical internetwork. 

TCP (Transmission Control Protocol) -- transport layer protocol
provides a reliable byte stream channel

UDP (User Datagram Protocol) -- transport layer protocol 
provides an unreliable datagram delivery channel. 

From top to bottom
 
Applications --> TCP or UDP ---> IP ---> Link and Physical layer


Reliable Transmission
---------------------

Physical layer often uses an encoding scheme for transmitting bit
stream so that bit errors (if not too many) can sometimes be
recovered. We shall study such error correcting schemes later in the
course.

When the bit errors cannot be recovered, corrupt frames must be
discarded. There are link-layer mechanisms that try to recoever from
these discarded frames.

Automatic repeat request (ARQ) consists of two key ideas:

a) acknowledgment (ACK) - a small control frame (without any data)
to indicate to the sender that an earlier frame has been received.
An ACK can also be piggybacked on a data frame.

b) timeout  -- if the sender does not receive an ACK after a
reasonable amount of time (timeout), it will retransmit the original
frame.  
 

Examples of ARQ schemes 

* Stop-and-wait: after transmitting one frame, the sender waits for an
ACK before transmitting the next frame.