04-network layer-02 by apcoms

Upload: rsakm20019931

Post on 30-May-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 04-Network Layer-02 By Apcoms

    1/4

  • 8/14/2019 04-Network Layer-02 By Apcoms

    2/4

    Faisal Amjad CPS 422

    A B

    A1 B1

    C C1

    Conflict between fairness and optimality

    Faisal Amjad CPS 422

    Routing Algorithm and its Properties (Contd)

    What do we need to optimize???One metric could be mean packet delay

    Another one could be network throughputBut both of them are again conflicting goalsIncreasing network throughput would mean havingmore and more packets in the buffers of therouters so that they do not sit idleHowever this would increase mean packet delayTo reduce mean packet delay we should have asmaller queue at the routersHence these two goals prove to be in contradiction

    Faisal Amjad CPS 422

    Routing Algorithms and their ClassesTwo classes of routing algorithmso Non adaptive algorithms ando Adaptive algorithms

    Non-adaptive algorithms do not base their routingdecisions on estimates of current traffic or topology.The choice of routes is computed in advance, off-line anddownloaded to the routers when the network is booted.This is also called static routingAdaptive routing algorithms change their routing decisionsto reflect changes in topology and traffic conditionsAdaptive algorithms differ ino From where they get routing informationo When do they change routes

    o What metric is used for optimizationFaisal Amjad CPS 422

    Shortest Path RoutingA widely used, static routing algorithmThe idea is to build a graph of the subnet, witheach node of the graph representing a router andeach arc representing a communication link.To choose a route between given routers, thealgorithm finds the shortest pathThe shortest path may be computed on the basisof number of hops, the distance, bandwidthavailable, queue lengths etc.Any number of metrics can be used for shortestpath calculation

    Faisal Amjad CPS 422

    Dijkstras Algorithm - Shortest Path Routing

    Each node is labeled (in parenthesis) with itsdistance from the source node along the bestknown pathInitially no paths are known so the nodes arelabeled with infinityAs the algorithm proceeds, paths are found andlabels changed, reflecting better paths.A label may be tentative or permanent.Initially all labels are tentative, but madepermanent when they are established as shortestpaths.

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E

    G

    22 2

    22

    33

    6

    4

    7

    We want to find the shortest route from A to DA is the starting node, made permanent by a filled circleAll links are labeled with the distance from adjacent nodesAll nodes adjacent to A will be considered in this run, inthis case B and G

    1

  • 8/14/2019 04-Network Layer-02 By Apcoms

    3/4

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E

    G

    22 2

    22

    33

    64

    7

    We have labeled all the nodes of the graphNodes adjacent to A are labeled with their distance fromA, alongwith the node identity from which this probe wasmadeNodes not adjacent to A are labeled with infinity

    (2,A)

    (6,A)

    ,-)(

    ,-)( ,-)(

    ,-)(

    ,-)(

    1

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E

    G

    22 2

    22

    33

    64

    7

    Node with a Label having the shortest path will be madepermanent, in this case B (indicated by a filled circle)This node (B) now becomes the working node andsubsequent probe will be made from it

    (2,A)

    (6,A)

    ,-)(

    ,-)( ,-)(

    ,-)(

    ,-)(

    1

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E

    G

    22 2

    22

    33

    6

    4

    7

    All nodes adjacent to B are probed and labels now changedaccording to their distancesNode with the label having shortest distance will be madepermanent nextWhich node (with a tentative label) has the shortestdistance label ??

    (2,A)

    (6,A)

    9,B)(

    ,-)( ,-)(

    ,-)(

    4,B)(

    1

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E

    G

    22 2

    22

    33

    6

    4

    7

    All nodes adjacent to E are probed and labels now changedaccording to their distancesNote that the label of G has to change since its d istance islesser from E (5) rather than directly from A (6)

    (2,A)

    (6,A)

    9,B)(

    ,-)(6,E)(

    ,-)(

    4,B)(

    1

    G (5,E)

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E2

    2 2

    22

    33

    6

    4

    7

    Now all tentative nodes are scanned and the one withshortest distance will be made permanent, and made theworking node

    (2,A) 9,B)(

    ,-)(6,E)(

    ,-)(

    4,B)(

    1

    G (5,E)

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E2

    2 2

    22

    33

    6

    4

    7

    Now all neighbors of G are probed and labeled, in this caseH

    (2,A) 9,B)(

    ,-)(6,E)(

    9,G)(

    4,B)(

    1

    G (5,E)

  • 8/14/2019 04-Network Layer-02 By Apcoms

    4/4

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E2

    2 2

    22

    33

    64

    7

    Since F has smallest distance, it is made permanent

    (2,A) 9,B)(

    ,-)(6,-E(

    9,G)(

    4,B)(

    1G (5,E)

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E2

    2 2

    22

    33

    64

    7

    Since H has smallest distance, it is made permanent

    (2,A) 9,B)(

    ,-)(6,E)(

    8,F)(

    4,B)(

    1G (5,E)

    Faisal Amjad CPS 422

    A

    B C

    DF

    H

    E2

    2 2

    22

    33

    6

    4

    7

    Since H has smallest distance, it is made permanentIn the next run D will have the shortest path from H (10)At the end the shortest path will be constructed from thelabels already made permanentDHFEBA will at the end be reversed to get the (forward)shortest path

    (2, A) 9,B)(

    10, H)(6, E)(

    8, F)(

    4, B)(

    1

    G (5,E)