Re: Infinity

From: Ingvar (ingvar_at_hexapodia.net)
Date: 01/10/05


Date: 10 Jan 2005 10:13:34 +0000

Rahul Jain <rjain@nyct.net> writes:

> Ingvar <ingvar@hexapodia.net> writes:
>
> > Rahul Jain <rjain@nyct.net> writes:
> >
> >> And you would change all your math to use floating point (something
> >> which your fellow advocate does not understand at all) instead of the
> >> far faster integer math just because of this single need... and in one
> >> of the most speed-critical code paths in all of computing?
> >
> > In general, no. I'd probably use something that was sufficiently
> > outside normal expected values to represent "infinity" (if we're
> > using unsigned 32-bit arithmetic and expect normal path costs to be in
> > the range of 30-40, perhaps using 2^31 as an "infinity" is safe
> > enough). Thus, should teh rest of the routing mesh be sufficiently
> > brokwen that we reach a *real* path cost of multiple orders of
> > magnitude larger than normal, we'd start considering our
> > previously-uncosidered route due to the sheer cost of teh other paths.
>
> Hmm... that would be a rather strange situation indeed, and I'm not sure
> that you'd want to use a route that was explicitly asked to not be used
> in that case. There may be security/trust issues involved.

Backup routes would be a typical case. Though they're usually
implemented with interface watchdogs (interface A goes down, this
brings up interface B; as long as A is available, we don't want
*anything to go across B), so it may not apply.

> > And, these days, I am not actually sure FP math is much slower than
> > integer math.
>
> If 7 times is "not much", ok.

Oh? Fair enough, I thought the difference was smaller, these days.

> > The expensive thing is doing route lookups and that
> > doesn't involve running a routing protocol, it just involves looking
> > at a ready-prepared FIB (it's usually a merge of the results from
> > several routing protocols), so we're only doing routing calculations
> > in the "slow path" anyway.
>
> Hmm... but you'd need to compute routing costs via all routes for each
> different destination, right? Wouldn't it be different for different
> destinations and possibly for different ports for different
> destinations? (Say, if you wanted to keep, latency-sensitive
> communications to a specific network on a high-cost-per-byte link.)

It depends on the exact method and protocol used. For a link-state
protocol, each node will be doing a spanning-tree search to find the
next hop for all destinations. For a distance-vector protocol, you
only have to compare what you get from your immediate neighbours and
send on information based on the best route you have received.

> > Using an "infinity" value isn't about
> > speeding up the run-time, it's to simplify implementation.
>
> Wouldn't something like (throw 'compute-cost nil) be more sensible?
>
> (let ((best-cost t)
> (best-route nil))
> (dolist (route routes)
> (let ((cost (catch 'compute-cost
> (compute-cost dest route))))
> (when (and cost
> (or (not best-route) (< cost best-cost)))
> (setq best-cost cost
> best-route route)))))
>
> Not sure how that's particularly complex to write.

Now generalise that to a wire protocol... You'd need either
type-tagged values or designate a numeric value as your "nil".

> > The unfortunate protocol I was alluding to, where this horizon is on
> > the small side is (of course) RIP, where "infinity" is 15, making it
> > hard using path cost to affect route selection, even in not-very-large
> > networks.
>
> Fun. Good thing we double RIP in civilized societies. ;)

Aye, though the new RIP isn't (much) better than the old RIP (it has
explicit netmasks and this is a Good, though it still has an amazingly
narrow horizon).

//Ingvar

-- 
Coffee: Nectar of gods / Aesir-mead of sysadmins / Elixir of life


Relevant Pages

  • Re: Infinity
    ... >> far faster integer math just because of this single need... ... should teh rest of the routing mesh be sufficiently ... > previously-uncosidered route due to the sheer cost of teh other paths. ... destinations and possibly for different ports for different ...
    (comp.lang.lisp)
  • Re: How to detect availability
    ... >> about Internet connection and R1 can't receive default route via routing ... >> protocol from my ISP, since some users that use R1 as default gateway are ...
    (comp.dcom.sys.cisco)
  • 500 Networking Interview questions for routers , firewall , VPN and lot
    ... Can you explain IP protocol? ... On what layers do router, switched, bridges and hubs operate? ... Can you explain how in detail how routing table looks like? ... How can you see route tables on the router? ...
    (microsoft.public.windowsxp.network_web)
  • 500 Networking Interview questions for routers , firewall , VPN and lot
    ... Can you explain IP protocol? ... On what layers do router, switched, bridges and hubs operate? ... Can you explain how in detail how routing table looks like? ... How can you see route tables on the router? ...
    (microsoft.public.pocketpc.wireless)
  • 500 Networking Interview questions for routers , firewall , VPN and lot
    ... Can you explain IP protocol? ... On what layers do router, switched, bridges and hubs operate? ... Can you explain how in detail how routing table looks like? ... How can you see route tables on the router? ...
    (microsoft.public.win2000.networking)