cn-7.pdf

31
www.jntuworld.com JNTUWORLD The Transport Layer 1 THE TRANSPORT LAYER Transport Entity: The hardware and/or software which makes use of services provided by the N/W layer, (with in the transport layer) is called transport entity. Transport Service Provider: Layers 1 to 4 are called Transport Service Provider. Transport Service User: The upper layers i.e., layers 5to 7 are called Transport Service User. Transport Service Primitives: Which allow transport users (application programs) to access the transport service. TPDU (Transport Protocol Data Unit): Transmissions of message between 2 transport entities are carried out by TPDU. The transport entity carries out the transport service primitives by blocking the caller and sending a packet the service. Encapsulated in the payload of this packet is a transport layer message for the server’s transport entity. The task of the transport layer is to provide reliable, cost-effective data transport from the source machine to the destination machine, independent of physical network or networks currently in use. (a). The Transport Service: (i). Services provided to the Upper layers (ii). Quality Of Service (iii). Transport Service Primitives (i). Services provided to the Upper layers: As n/w layer is part of communication subnet and is run by carrier, the users have no control over the (subnet)n/w layer. Therefore, another layer is put on top of the n/w layer to improve the QOS, which is the “TRANSPORT LAYER”. This layer makes use of the help of the services provided by the n/w layer with the help of “Transport Entity”. www.jntuworld.com

Upload: harshita-gopu

Post on 18-Nov-2015

3 views

Category:

Documents


1 download

TRANSCRIPT

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    1

    THE TRANSPORT LAYER

    Transport Entity: The hardware and/or software which makes use of services provided by the

    N/W layer, (with in the transport layer) is called transport entity.

    Transport Service Provider: Layers 1 to 4 are called Transport Service Provider.

    Transport Service User: The upper layers i.e., layers 5to 7 are called Transport Service User.

    Transport Service Primitives: Which allow transport users (application programs) to access

    the transport service.

    TPDU (Transport Protocol Data Unit): Transmissions of message between 2 transport entities

    are carried out by TPDU. The transport entity carries out the transport service primitives by

    blocking the caller and sending a packet the service. Encapsulated in the payload of this packet is

    a transport layer message for the servers transport entity.

    The task of the transport layer is to provide reliable, cost-effective data transport from the source

    machine to the destination machine, independent of physical network or networks currently in

    use.

    (a). The Transport Service:

    (i). Services provided to the Upper layers

    (ii). Quality Of Service

    (iii). Transport Service Primitives

    (i). Services provided to the Upper layers:

    As n/w layer is part of communication subnet and is run by carrier, the users have no

    control over the (subnet)n/w layer. Therefore, another layer is put on top of the n/w layer to

    improve the QOS, which is the TRANSPORT LAYER. This layer makes use of the help of

    the services provided by the n/w layer with the help of Transport Entity.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    2

    If a transport entity is informed halfway through a long transmission that its n/w

    connection has been abruptly terminated, with no indication of what has happened to the data

    currently in transit, it can set up a new network connection to the remote transport entity. Using

    this new n/w connection, it can send a query to its peer asking which data arrived and which did

    not, and then pick up from where it left off. Lost packets and mangled data can be detected and

    compensated by transport layer.

    With transport layer, it is possible for application programs to be written using a standard

    set of primitives and to have these programs work on a wide variety of networks, without having

    to worry about dealing with different subnets interfaces and unreliable transmission. i.e. it forms

    the major boundary between the Transport Service Provider (the upper 4 layers) and the

    Transport Service User(the upper layer(s)).

    (ii). Quality Of Service: The primary function of transport layer is to enhance the QOS provided by

    the n/w layer. The transport user specifies all these QOS parameters where a connection is

    requested. These are specified by the transport user when a connection is requested. Both the desired

    and minimum acceptable values can be given. If these are unachievable, the transport layer informs

    the caller that the connection attempt failed, (without even contacting the destination) along with

    failure reasons. QOS can be characterized by a number of specific parameters such as:

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    3

    Connection establishment delay.

    Connection establishment failure probability.

    Throughput.

    Transit delay.

    Residual error ratio.

    Protection.

    Priority.

    Resilience.

    The Connection Establishment Delay is the amount of time elapsing between a

    transport connection being requested and the configuration being received by the

    transport service.

    The Connection Establishment Failure Probability is the chance of a connection not

    being established with in the maximum establishment delay time, due to some internal

    problems.

    The Throughput parameter measures the number of bytes of user data transferred per

    second, measured over some time interval.

    The Transit Delay measures the time between a message being sent by the transport user

    or the source machine and it is being received by the transport user on the destination

    machine.

    The residual error ratio measures the number of lost or garbled messages as a fraction

    of the total sent.

    The protection parameter provides a way for the transport user to specify interest in

    having the transport layer provide protection against unauthorized third parties (wire

    tappers) reading or modifying the transmitted data.

    The resilience parameter gives the probability of the transport layer itself spontaneously

    terminating a connection due to internal problems or congestion.

    The priority parameter provides a way for the transport user to indicate that some of its

    connections are made important than others and in the event of congestion, to make sure

    that high-priority connections get serviced before the low-priority ones.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    4

    OPTION NEGOTIATION:

    If the transport layer achieve the desired goal, but can achieve a lower, but still

    acceptable rate, it then informs the remote machine about this and asks for connection

    establishment. If the remote machine cannot handle the proposed value, but it can handle a value

    above the minimum, it permits. If it cannot handle any value above the minimum, it rejects the

    connection attempt. Finally, the originating transport user is informed of whether the connection

    was established, the values of parameters agreed upon. This process is called Option

    Negotiation.

    (iii). Primitives for a simple Transport service:

    Eg: Consider an application with a server and a number of remote clients.

    1. The server executes a LISTEN primitive by calling a library procedure that makes a

    system call to block the server until a client turns up.

    2. when a client wants to talk to the server, it executes a CONNECT primitive, with

    CONNECTION REQUEST TPDU sent to the server.

    3. When it arrives, the TE unblocks the server and sends a CONNECTION ACCEPTED

    TPDU back to the client.

    4. When it arrives, the client is unblocked and the connection is established. Data can now

    be exchanged using SEND and RECEIVE primitives.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    5

    5. When a connection is no longer needed, it must be released to free up table space with in

    the 2 transport entries, which is done with DISCONNECT primitive by sending

    DISCONNECTION REQUEST TPDU. This disconnection can b done either by

    asymmetric variant (connection is released, depending on other one) or by symmetric

    variant (connection is released, independent of other one).

    Primitives sent as TPDUs using encapsulation:

    Berkely Sockets: These primitives are socket primitives used in Berkely UNIX for TCP.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    6

    (b). Elements of Transport Protocols:

    The transport service is implemented by a transport protocol between the 2 transport entities. The

    elements are:

    (i). Addressing

    (ii). Connection establishment

    (iii). Connection release

    (iv). Flow control and buffering

    (v). multiplexing

    (vi). Crash recovery

    (i). Addressing:

    When an application process wishes to set up a connection to a remote application

    process, it must specify which one to connect it to, i.e., TSAPs and NSAPs must be specified by

    the transport layer and n/w layer respectively.

    TSAP-----Transport Service Access Point

    NSAP---- Network Service Access Point

    (ii). Connection establishment:

    With packet lifetimes bounded, it is possible to devise a fool proof way to establish

    connections safely. Packet lifetime can be bounded to a known maximum using one of the

    following techniques:

    Restricted subnet design

    Putting a hop counter in each packet

    Time stamping in each packet

    Using a 3-way hand shake, a connection can be established. This establishment protocol doesnt

    require both sides to begin sending with the same sequence number.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    7

    Fig-(a) Fig-(b) Fig-(c)

    Host-1 chooses a sequence

    number, x and sends a

    CONNECTION REQUEST

    TPDU containing it to host-2.

    host-2 replies with a

    CONNECTION ACCEPTED

    TPDU acknowledging x and

    announcing its own initial

    sequence number y. finally,

    host-1 acknowledges host-2s

    choice of an initial sequence

    number in the first data

    TPDU that it sends.

    The first TPDU is a delayed

    duplicate CONNECTION

    REQUEST from an old

    connection. This TPDU arrives

    at host-2 without host-1s

    knowledge. Host-2 reacts to this

    TPDU by sending host-1 a

    CONNECTION ACCEPTED

    TPDU, in effect asking for

    verification that host-1 was

    indeed trying to set up a new

    connection. When host-1 rejects

    host-2s attempt to establish,

    host-2 realizes that it was

    tricked by a delayed duplicate

    and abandons the connection.

    Host-2 gets a delayed

    CONNECTION REQUEST and

    replies to it. At this point, it is

    crucial to realize that host-2 has

    proposed using y as the initial

    sequence number for host-2 to

    host-1 traffic, knowing that no

    TPDUs containing sequence

    number y or

    acknowledgements to y are

    still in existence. When the

    second delayed TPDU arrives at

    host-2, the fact that z has been

    acknowledged rather than y tells

    host-2 that this ,too, is an old

    duplicate.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    8

    (iii). Connection release:

    A connection is released using either asymmetric or symmetric variant. But, the

    improved protocol for releasing a connection is a 3-way handshake protocol.

    Fig-(a) Fig-(b) Fig-(c) Fig-(d)

    One of the user sends a

    DISCONNECTION REQUEST TPDU in

    order to initiate connection release. When

    it arrives, the recipient sends back a DR-

    TPDU, too, and starts a timer. When this

    DR arrives, the original sender sends back

    an ACK-TPDU and releases the

    connection. Finally, when the ACK-TPDU

    arrives, the receiver also releases the

    connection.

    Initial process is

    done in the same

    way as in fig-(a).

    if the final ACK-

    TPDU is lost, the

    situation is saved

    by the timer.

    When the timer is

    expired, the

    connection is

    released.

    If the second

    DR is lost, the

    user initiating

    the

    disconnection

    will not receive

    the expected

    response, and

    will timeout and

    starts all over

    again.

    Same as in fig-( c)

    except that all

    repeated attempts to

    retransmit the DR

    are assumed to be

    failed due to lost

    TPDUs. After N

    entries, the sender

    just gives up and

    releases the

    connection.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    9

    (iv). Flow control and Buffering:

    Flow control is done by having a sliding window on each connection to keep a fast

    transmitter from over running a slow receiver.

    Buffering must be done by the sender, if the network service is unreliable. The sender

    buffers all the TPDUs sent to the receiver. The buffer size varies for different TPDUs. They are:

    Chained Fixed-size Buffers

    Chained Variable-size Buffers

    One large Circular Buffer per Connection

    (a). Chained Fixed-size Buffers:

    If most TPDUs are nearly the same size, the buffers are organized as a pool of identical

    size buffers, with one TPDU per buffer.

    (b). Chained Variable-size Buffers:

    This is an approach to the buffer-size problem. i.e., if there is wide variation in TPDU

    size, from a few characters typed at a terminal to thousands of characters from file transfers,

    some problems may occur:

    If the buffer size is chosen equal to the largest possible TPDU, space will be wasted when

    ever a short TPDU arrives.

    If the buffer size is chosen less than the maximum TPDU size, multiple buffers will be

    needed for long TPDUs.

    To over come these problems, we employ variable-size buffers.

    ( c). One large Circular Buffer per Connection:

    A single large circular buffer per connection is dedicated when all connections are

    heavily loaded.

    1. Source Buffering is used for low band width bursty traffic

    2. Destination Buffering is used for high band width smooth traffic.

    3. Dynamic Buffering is used if the traffic pattern changes randomly.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    10

    (v). Multiplexing:

    In networks that use virtual circuits with in the subnet, each open connection consumes some

    table space in the routers for the entire duration of the connection. If buffers are dedicated to the

    virtual circuit in each router as well, a user who left a terminal logged into a remote machine ,

    there is need for multiplexing. There are 2 kinds of multiplexing:

    1. Up-ward multiplexing: In the below figure, all the 4 distinct transport connections use the

    same network connection to the remote host. When connect time forms the major component

    of the carriers bill, it is up to the transport layer to group port connections according to their

    destination and map each group onto the minimum number of port connections.

    2. Down-ward multiplexing:

    If too many transport connections are mapped onto the one network connection, the

    performance will be poor.

    If too few transport connections are mapped onto one network connection, the service

    will be expensive.

    The possible solution is to have the transport layer open multiple connections and distribute the

    traffic among them on round-robin basis, as indicated in the below figure:

    With k network connections open, the effective band width is increased by a factor of k.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    11

    (vi). Crash recovery:

    To recover from server crashes..

    If there is a transmission between a client and a server and mean while if the server crashes, the

    server will send a broadcast TPDU to all other hosts, announcing that it just crashed. Each client

    can be in any of 2 states:

    One TPDU outstanding, SI

    No TPDUs outstanding, SO

    THE INTERNET TRANPORT PROTOCOLS (TCP AND UDP):

    The internet has 2 main protocols in the transport layer they are:

    1. Connection-Oriented Protocol ( TCP )

    2. Connection-Less Protocol ( UDP)

    TCP ( TRANSMISSION CONTROL PROTOCOL )

    It was specifically designed to provide a reliable end-to end byte stream over an unreliable

    network. It was designed to adapt dynamically to properties of the inter network and to be

    robust in the face of many kinds of failures.

    Each machine supporting TCP has a TCP transport entity, which accepts user data

    streams from local processes, breaks them up into pieces not exceeding 64kbytes and sends

    each piece as a separate IP datagram. When these datagrams arrive at a machine, they are given

    to TCP entity, which reconstructs the original byte streams. It is up to TCP to time out and

    retransmits them as needed, also to reassemble datagrams into messages in proper sequence.

    The different issues to be considered are:

    a. The TCP Service Model

    b. The TCP Protocol

    c. The TCP Segment Header

    d. The Connection Management

    e. TCP Transmission Policy

    f. TCP Congestion Control

    g. TCP Timer Management.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    12

    a). The TCP Service Model:

    TCP service is obtained by having both the sender and receiver create end points called

    SOCKETS

    Each socket has a socket number(address)consisting of the IP address of the host, called a

    PORT ( = TSAP )

    To obtain TCP service a connection must be explicitly established between a socket on

    the sending machine and and a socket on the receiving machine

    All TCP connections are full duplex and point to point i.e., multicasting or broadcasting

    is not supported.

    A TCP connection is a byte stream, not a message stream i.e., the data is delivered as

    chunks

    Eg: 4 * 512 bytes of data is to be transmitted.

    Urgent data is another feature of TCP in which the sending application puts some control

    information in the data stream when an interactive user hits the DEL or CTRL-C key to break off

    a remote computation that has already begun, and gives it to TCP along with URGENT flag.

    This event causes TCP to stop accumulating data and transmit everything it has for that

    connection immediately.

    When the urgent data are received at the destination, the receiving application is

    interrupted and reads the data stream to find the urgent data.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    13

    Sockets:

    A socket may be used for multiple connections at the same time. In other words, 2 or

    more connections may terminate at same socket. Connections are identified by socket identifiers

    at same socket. Connections are identified by socket identifiers at both ends. Some of the sockets

    are listed below:

    Ports: Port numbers below 256 are called Well- known ports and are reserved for standard

    services.

    Eg:

    b). The TCP Protocol:

    Every byte on a TCP connection has its own 32-bit sequence number, used both for

    acknowledgement and window mechanism. The sending and receiving TCP entities exchange

    data in the form of segments [20 byte header + optional part] followed by zero or more data

    bytes] segments can be united or splitted, by the TCP s/w accordingly, based on 2 limits:

    1. each segment must fit in 65,535 byte IP payload

    2. Each segment must fit in MTU (Max. Transfer Unit) of a network.

    PORT-21 To establish a connection to a host to transfer a file using FTP

    PORT-23 To establish a remote login session using TELNET

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    14

    The basic protocol used by TCP entities is the SLIDING WINDOW

    PROTOCOL when a sender transmits a segment, it also starts a timer. When the segment

    arrives at destination, the receiving TCP entity sends back a segment having an

    acknowledgement number equal to the next sequence number it expects to receive. If the sender

    timer goes off before the acknowledgement is received, the sender transmits the segment again.

    TCP at the design time must deal with different problems like:

    Since segments can be fragmented, it is possible that part of a transmitted segment arrives

    and is acknowledged, while the rest is lost.

    Segments can also arrive out of order

    Segments can also be delayed so long in transit that the sender times out and retransmits

    them

    If retransmitted segment takes other route than the original and reaches the receiver,

    duplicates must be differentiated from the original ones.

    Segments may occasionally hit congested networks along its path.

    c). The TCP Segment Header:

    Every segment begins with a fixed-format 20 byte header followed by header options. Then

    follows, up to 65,535-20-20=65,515 data bytes if any.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    15

    Different fields of TCP header are:

    Source Port, Destination Port : Identify local end points of the connections

    Sequence number : Specifies the sequence number of the segment

    Acknowledgement Number : Specifies the next byte expected.

    TCP header length : Tells how many 32-bit words are contained in TCP header

    URG : It is set to 1 if URGENT pointer is in use, which indicates start of urgent data.

    ACK : It is set to 1 to indicate that the acknowledgement number is valid.

    PSH : Indicates pushed data

    RST : It is used to reset a connection that has become confused due to reject an invalid

    segment or refuse an attempt to open a connection.

    FIN : Used to release a connection.

    SYN : Used to establish connections.

    d). TCP Connection management:

    Connections are established in TCP using the 3-way handshake. To establish a

    connection between a server and a client following actions take place at both sides:

    SERVER CLIENT

    Passively waits for an incoming connection by

    executing LISTEN and ACCEPT primitives,

    either specifying a specific source or nobody

    in particular

    Executes a CONNECT primitive specifying

    the IP address and port to which it wants to

    connect, the maximum TCP segment size it is

    willing to accept and additionally some user

    data.

    SYN ACK Meaning

    1

    1

    0

    1

    Piggyback acknowledgement field is not in use

    Connection reply

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    16

    TCP connection establishment in normal case:

    TCP connection management finite state machine:

    1). When a TCP segment arrive at

    destination, the TCP entity

    then ,checks to see if there is a

    process that has done a

    LISTEN on port given in

    destination port field.

    2). If not, it sends a reply with

    RST bit-ON to reject the

    connection other wise, the

    process is given incoming

    TCP segment, by which the

    connection can be accepted or

    rejected.

    3). Acknowledgement is sent

    back, if accepted.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    17

    TCP Connection management from servers point of view:

    1. The server does a LISTEN and settles down to see who turns up.

    2. When a SYN comes in, the server acknowledges it and goes to the SYNRCVD state

    3. When the servers SYN is itself acknowledged the 3-way handshake is complete and server

    goes to the ESTABLISHED state. Data transfer can now occur.

    4. When the client has had enough, it does a close, which causes a FIN to arrive at the server

    [dashed box marked passive close].

    5. The server is then signaled.

    6. When it too, does a CLOSE, a FIN is sent to the client.

    7. When the clients acknowledgement shows up, the server releases the connection and deletes

    the connection record.

    e). TCP Transmission policy:

    Window management in TCP:

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    18

    1. In the above example, the receiver has 4096-byte buffer.

    2. If the sender transmits a 2048-byte segment that is correctly received, the receiver will

    acknowledge the segment.

    3. Now the receiver will advertise a window of 2048 as it has only 2048 of buffer space, now.

    4. Now the sender transmits another 2048 bytes which are acknowledged, but the advertised

    window is0.

    5. The sender must stop until the application process on the receiving host has removed some

    data from the buffer, at which time TCP can advertise a layer window.

    SILLY WINDOW SYNDROME:

    This is one of the problems that ruin the TCP performance, which occurs when data are

    passed to the sending TCP entity in large blocks, but an interactive application on the receiving

    side reads 1 byte at a time.

    Initially the TCP buffer on the receiving side is full and the sender knows this(win=0)

    Then the interactive application reads 1 character from tcp stream.

    Now, the receiving TCP sends a window update to the sender saying that it is all right to

    send 1 byte.

    The sender obligates and sends 1 byte.

    The buffer is now full, and so the receiver acknowledges the 1 byte segment but sets

    window to zero. This behavior can go on forever.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    19

    f). TCP Congestion control:

    TCP does to try to prevent the congestion from occurring in the first place in the following way:

    When a connection is established, a suitable window size is chosen and the receiver

    specifies a window based on its buffer size. If the sender sticks to this window size, problems

    will not occur due to buffer overflow at the receiving end. But they may still occur due to

    internal congestion with in the n/w. lets see this problem occurs.

    Error!

    In fig (a): We see a thick pipe leading to a small- capacity receiver. As long as the sender

    does not send more water than the bucket can contain, no water will be lost.

    In fig (b): The limiting factor is not the bucket capacity, but the internal carrying capacity of the

    n/w. if too much water comes in too fast, it will backup and some will be lost.

    When a connection is established, the sender initializes the congestion window to the size

    of the max segment in use our connection. It then sends one max segment .if this max segment is

    acknowledged before the timer goes off, it adds one segment s worth of bytes to the congestion

    window to make it two maximum size segments and sends 2 segments. As each of these segment

    is acknowledged, the congestion window is increased by one max segment size. When the

    congestion window is n segments, if all n are acknowledged on time, the congestion window

    is increased by the byte count corresponding to n segments. The congestion window keeps

    growing exponentially until either a time out occurs or the receivers window is reached.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    20

    The internet congestion control algorithm uses a third parameter, the threshold in

    addition to receiver and congestion windows.

    Different congestion control algorithms used by TCP are:

    RTT variance Estimation.

    Exponential RTO back-off Re-transmission Timer Management

    Karns Algorithm

    Slow Start

    Dynamic window sizing on congestion

    Fast Retransmit Window Management

    Fast Recovery

    RTT Variance estimation:

    Also known as Jacobsons algorithm. This enables a TCP entity to adapt to changes in

    round-trip time. Mean-deviation is used as a variation measure and the value is used as

    input in the calculation of RTO as.

    MDEV(x) = E [ |x-E(x)| ]

    Where E(x) is the expected value for x

    AERR(K+1) = RTT(K+1)-ARTT(K)

    Where AERR(K+1) = the sample mean deviation measured at time k

    ARTT(K) = sample average round trip time for first k segments.

    The complete algorithm proposed by JACOBSON is

    SRTT(K+1) = [(1-g)][SRTT(K)] + [G][RTT(K+1)]

    SERR(K+1) = RTT(K+1) - SRTT(K)

    SDEV(K+1) = [(1-h)][SDEV(K)] + [h][|SERR(K+1)|]

    Therefore RTO(K+1) = SRTT(K+1) + [f][SDEV(K+1)]

    Where SRTT is an exponentially smoothed estimate of RTT and the values of g, h, f are

    given by g=1/8=0.125, h=1/4=0.25, f=2

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    21

    Exponential RTO Back-off:

    A TCP source increases its RTO each time a segment is retransmitted, when is

    referred to as a BACKOFF process. After the first retransmission of a segment on each

    effected connection, the TCP sources will all wait a longer time to clear the current

    congestion. If a second retransmission is required, each TCP source will then wait an even

    longer time before timing out for a 3rd retransmission, giving the internet an even longer

    period to recover. A simple technique for implementing RTO back-off is to multiply the

    RTO for a segment by a constant value for each retransmission: RTO =

    q*RTO, which causes RTO to grow exponentially, with each retransmission this technique is

    referred to as Binary Exponential Back-off where q=2

    Karns algorithm:

    1. Do not use the measured RTT for a retransmitted segment to update SRTT and SDEV

    2. Calculate back-off RTO using equation RTO=q*RTO when a retransmission occurs.

    3. Use the back-off RTO value for sending segments until an acknowledgement arrives

    for a segment that has not been transmitted.

    Slow Start:

    JACOBSON recommended this procedure in which a congestion window is

    defined which is measured in segments rather than octets. At any time, TCP transmission

    is constrained by the following relationship.

    awnd = MIN [ credit, cwnd ]

    Where awnd = allowed window in segments

    cwnd = congestion window in segments

    credit = the amount of unused credit granted in the most recent

    acknowledgement in segments.

    When a new connection is opened, the TCP entity initializes cwnd=1. Each time an

    acknowledgement is received, the value of cwnd is increased by 1 up to some maximum value.

    cwnd grows exponentially when the first ACK arrives, TCP opens cwnd=2 and can send 2

    segments. When these 2 segments are acknowledged, TCP can send 4 segments and so on.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    22

    Fast retransmit:

    If a TCP entity receives a segment out of order, it must immediately issue an

    ACK for the last in order segment that was received. TCP will continue to repeat this

    ACK with each incoming segment until the missing segment arrives to plug the hole in

    its buffer. When the hole is plugged, TCP sends a cumulative ACK for all of the in order

    segments received so for when a source TCP receives a duplicate ACK, it is made to wait

    to receive 3 duplicate ACKs to same segment. Retransmission takes place, if 4 ACKs are

    not received by sender.

    Fast recovery:

    Retransmit the last segment, cut the cwnd in half and then proceed with the linear

    increase of cwnd. This process can be explained as:

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    23

    1. When the third duplicate ACK arrives

    a. set ssthresh = cwnd/2

    b. retransmit the missing segment

    c. set cwnd = ssthresh+3

    2. Each time an additional duplicate ACK arrives, increment cwnd by a 1 and

    transmit a segment if possible

    3. When a next ACK arrives that acknowledges new data, set cwnd = ssthresh

    Dynamic window sizing on congestion:

    Jacobson proposed the use of slow start to begin with, followed by a linear growth

    in cwnd. The rules are as follows, when a timeout occurs:

    1. Set slow-start threshold equal to current congestion window, ssthresh = cwnd/2

    2. Set cwnd = 1 and perform slow start process until cwnd = ssthresh

    3. For cwnd >= ssthresh, increases cwnd by one for each round trip time

    Limited transmit:

    This algorithm calls for a TCP sender to transmit a new segment the following 3

    conditions are must.

    1. 2 consecutive duplicate acknowledgements are received

    2. The destination TCP entitys advertised allows the transmission of the segment

    3. The amount of outstanding data, after sending the new segment, would remain less

    than or equal to cwnd+2

    TCP timer management:

    TCP uses 3 kinds of timers:

    1. Retransmission timer

    2. Persistence timer

    3. Keep-Alive timer.

    1. Retransmission timer: When a segment is sent, a timer is started. If the segment is

    acknowledged before the timer expires, the timer is stopped. If on the other hand, the timer goes

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    24

    off before the acknowledgement comes in, the segment is retransmitted and the timer is started

    again. The algorithm that constantly adjusts the time-out interval, based on continuous

    measurements of n/w performance was proposed by JACOBSON and works as follows:

    for each connection, TCP maintains a variable RTT, that is the best current estimate of the

    round trip time to the destination inn question.

    When a segment is sent, a timer is started, both to see how long the acknowledgement takes

    and to trigger a retransmission if it takes too long.

    If the acknowledgement gets back before the timer expires, TCP measures how long the

    measurements took say M

    It then updates RTT according to the formula

    RTT = RTT + ( 1- ) M

    Where = a smoothing factor that determines how much weight is given to

    the old value. Typically, =7/8

    Retransmission timeout is calculated as

    D = D + ( 1- ) | RTT-M |

    Where D = another smoothed variable, Mean Deviation

    RTT = expected acknowledgement value

    M = observed acknowledgement value

    Timeout = RTT+(4*D)

    2. Persistence timer:

    It is designed to prevent the following deadlock:

    the receiver sends an acknowledgement with a window size of 0 telling the sender to wait

    later, the receiver updates the window, but the packet with the update is lost

    now both the sender and receiver are waiting for each other to do something

    when the persistence timer goes off, the sender transmits a probe to the receiver

    the response to the probe gives the window size

    if it is still zero, the persistence timer is set again and the cycle repeats

    if it is non zero, data can now be sent

    3. Keep-Alive timer: When a connection has been idle for a long time, this timer may go off to

    cause one side to check if other side is still there. If it fails to respond, the connection is

    terminated.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    25

    UDP ( USER DATAGRAM PROTOCOL )

    It provides a connection-less service for application level procedures. UDP is present on the top

    of IP. UDP adds a port addressing capability to IP. A UDP segment consists of an 8byte header,

    followed by data. The header is as follows:

    Source port, destination port: Identifies the end points with in the source and destination

    machines.

    UDP length: Includes 8-byte header and the data

    UDP checksum: Includes the UDP header, the UDP data padded out to an even number o

    Of bytes if need be. It is an optional field

    The ATM AAL ( ATM Adaptation Layer) Layer protocols

    AAL layer is present on top of ATM layer and is similar to transport layer, in some aspects. The

    goal of AAL is to provide useful services to applications programs and to shield then from the

    mechanics of chopping data up into cells at the source and reassembling them at the destination.

    As ATM layer just outputs 53-byte cells consecutively, and no error control and flow control.

    AAL was defined by ITU.

    Original service classes supported by AAL:

    A,B,C,D are the only classes that were of any use among all 8 district classes.

    To handle these 4 classes of service, ITU defined 4 protocols respectively.

    AAL - 1

    AAL 2

    AAL 3

    AAL 4

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    26

    Later, as the technical requirements for classes C&D were similar, they were combined into

    AAL - 3/4. AAL - 5 was also defined to meet further requirements

    Structure of AAL:

    The ATM adaptation layer is divided into 2 major parts:

    Convergence Sub layer

    SAR ( Segmentation And Reassembly ) Sub layer

    Convergence layer:

    The upper part of AAL is convergence sub layer. Its job is to provide the interface to the

    application. It consists of a subpart that is common to all applications and an application specific

    subpart. The functions of each of these parts are protocol dependent but can include message

    framing and error detection. It is responsible for accepting bit streams or arbitrary length

    messages from the applications and breaking them up into units of 44 to 48 bytes for trans at the

    destination, this sub layer reassembles the cells into the original messages. Message boundaries

    are preserved, if present.

    SAR sub layer:

    The lower part of AAL is SAR sub layer. It can add headers and trailers to the data units

    given to it by the convergence sub layer to form cell payloads. These payloads are then given to

    the ATM layer for transmission. At the destination, the SAR sub layer reassembles the cells into

    messages. It sometimes handles error detection and multiplexing

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    27

    Operation:

    From the above figure, when a message comes into the AAL from the application, the

    convergence sub layer may give it a header and/or trailer. The message is then broken up into

    44-to-48 byte units, which are passed to the SAR sub layer. The SAR sub layer may add its own

    header and trailer to each piece and pass them down to the ATM layer for transmission as

    independent cells.

    AAL - 1:

    It is the protocol used for transmitting class-A traffic, that is real-time, constant bit rate,

    connection-oriented traffic, such as uncompressed audio and video.

    Bits are fed in by the application at a constant rate and must be delivered at the far end, at

    the same constant rate, with a minimum of delay, jitter, and overhead.

    The o/p is a stream of bits, with no message boundaries.

    Missing cells are reported to the application

    AAL-1 uses a Convergence & SAR sub layers, in which

    Convergence sub layer: Detects lost and mis-inserted cells and also smoothes out incoming

    traffic to provide delivery of cells at a constant rate. Finally, it breaks up the i/p messages into

    46 or 47 byte units and are given to SAR for transmission. At the other end, it extracts these

    and reconstructs the original input.

    SAR sub layer: It has a protocol and 2 different formats are present for its cells.

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    28

    Both formats begin with a 1-byte header containing a 3-bit cell sequence number, SN ( to

    detect missing or mis-inserted cells).

    This field is followed by a 3-bit sequence number protection, SNP, over the sequence

    number to allow correction of single errors and detection of double errors in the sequence

    field. It uses CRC with polynomial x3+x+1

    An even parity bit covering the header byte further reduces the likelihood of a bad

    sequence number sneaking in unnoticed

    The p cells are used when message boundaries must be preserved

    The pointer field is used to give offset of start of next message, and its range is 0 to 92

    AAL - 2:

    This protocol has been designed where message boundaries must be preserved so that the

    start of the next full frame can be recognized, even in the presence of lost cells or bad data

    like compressed audio or video.

    It uses Convergence and SAR sub layers, in which

    Convergence sub layer : it does not have a protocol and works same as in AAL-1

    SAR sub layer : It has a protocol and its cell format is

    It has a 1-byte header composing of SN(sequence no),which is used for numbering cells in

    order to detect missing or mis-inserted cells and IT(information type) indicate that the cell is

    the start, middle or end of the message.

    The LI(length indicated)field tells how big the payload is, in bytes(

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    29

    AAL - 3/4:

    This protocol can be operate in 2 modes

    1. stream mode, in which the boundaries are not preserved

    2. message mode, in which the boundaries are preserved

    it supports multiplexing, which allows multiple sessions from a single host to travel along

    the same virtual circuit ( Eg: remote logins ) and be separated at the destination

    It has both the convergence sub layer protocol and a SAR sub layer protocol ,in which

    Convergence sub layer: messages come into this layer from application and are first padded

    out to a multiple of 4 bytes then a header &trailer are attached.

    CS header CS trailer

    CPI ( Common Part Indicator ): gives the message type and counting unit for the BA

    size and length fields

    B tag, E tag: used to frame messages and are incremented after each new message sent

    by which lost or mis-inserted calls can be checked

    BA size: used for buffer allocation i.e., tells the receiver to allocate how much buffer-

    space, for the message in advance of its arrival.

    Length: gives the payload length again

    SAR sub layer: the message from CS layer is received and chopped into 44-byte chunks

    and inserted into payload of a cell whose format is

    Error!

    ST (Segment Type): used for message framing and indicates whether the cell begins a message,

    is in the middle of a message, is the last cell of a message or is a small

    (i.e., single cell) message.

    CPI Btag BAsize Payload ( 1 to 65,535bytes ) padding Etag Length 0 to 65535

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    30

    SN( Sequence Number ): used for detecting lost or mis-inserted cells.

    MID( Multiplexing ID ): used to keep track of which cell belongs to which session (as CS layer

    may buffer several messages belonging to different sessions and send

    pieces of them in random order)All the pieces from messages

    belonging to session i carry i in MID field so that they can be

    correctly reassembled at destination.

    LI+CRC: payload length + checksum of cell.

    Disadvantages of AAL 3/4:

    1. 2 layers of protocol overhead i.e., 8 bytes are added to every message; 4 bytes are added

    to every cell.

    2. It is a heavy weight mechanism for short messages.

    AAL - 5:

    Because of the complexity & Inefficiency generated by 2 layers of protocol in AAL3/4, coupled

    with short checksum led to the invention of SEAL ( Simple Efficient Adaptation Layer )

    protocol i.e., AAL-5.

    It offers unreliable service, with options to have cells with checksum errors either

    discarded or passed to the application any way

    It offers reliable service, with few control to prevent over sums

    It supports 2 modes:

    Stream mode

    Message mode, in which an application can pass a datagram of length 1 to

    65,535 bytes to AAL layer and have it delivered to destination.

    It has both a Convergence Sub layer Protocol and SAR Sub layer Protocol in which,

    CS protocol: Receives message from the application and adds a trailer (8-byte) the

    amount of padding ( < +47bytes )is chosen to make the entire message, including the

    padding and trailer, be a multiple of 48 bytes. It doesnt have any header.

    Payload(1to65,535bytes) UU Length CRC

    www.jntuworld.com

    www.jntuworld.com

  • www.jntuworld.com

    JNTUWORLD The Transport Layer

    31

    UU(User- to-User): available for a CS-service specific sub layer for its own purpose

    Eg: sequencing or multiplexing

    Length: tells how long the true payload is, in bytes. A value of 0 is used to abort the

    current message mid stream.

    CRC: standard 32-bit checksum over the entire message

    SAR sub layer : The message from CS, along with trailer is received and is breaked into

    48-bytes units, each passed to ATM layer for transmission. PTI field is

    set, if message boundaries are to be preserved.

    Advantages of AAL-5:

    Great efficiency.

    It has no overhead in each cell.

    Longer checksum calculates lost, mis-inserted or missing cells without using seq. numbers.

    www.jntuworld.com

    www.jntuworld.com