Title: Lecture 21: Networking
1Lecture 21Networking
- Prof. Kenneth M. Mackenzie
- Computer Systems and Networks
- CS2200, Spring 2003
Includes slides from Bill Leahy
2Review Example Thread Package
3Review how to wait
- (4. blocking) Proper Implementation
- scheduler data structures protected by a
spin-lock - blocking mutex implementation bootstraps on
that spin-lock
void blocking_mutex_lock(mutex_t mutex)
spin_mutex_lock(theschedulermutex) if
(mutex-gtstate 1) enqueue(running,
mutex-gtblocklist) scheduler() /
unlocks theschedulermutex / else
mutex-gtstate 1 spin_mutex_unlock(the
schedulermutex)
4Review when to waitCondition Variable
This is your lock on your data structure
pthread_mutex_t mutex pthread_cond_t cond
pthread_mutex_lock(mutex) while
(my_elaborate_condition()) pthread_cond_wait(
cond, mutex) / do stuff that depended on
condition / pthread_mutex_unlock(mutex)
This is the pcblist
block this thread call the scheduler
5Review example usagedequeue code with
cond_wait()
static void queue_dequeue(queue_t queue)
queueitem_t queueitem void item
pthread_mutex_lock(queue-gtmutex) while
(queue-gthead NULL) pthread_cond_wait(queue
-gtempty, queue-gtmutex) queueitem
queue-gthead queue-gthead queueitem-gtlink
if (queue-gthead NULL) queue-gttail NULL
pthread_mutex_unlock(queue-gtmutex) item
queueitem-gtitem queueitem_free(queueitem)
return(item)
6Overview
- Today
- A Brief History
- Basic Concepts
- Network Hardware
- Ethernet
- Demo simple protocol wires
- Network Basics
- Basic problem move bits from point a to point b
- Performance metrics
- Extended Example Ethernet
7A Brief History
- 1876 Telephone Invented
- (Analog technology)
- 1942 Mainframes Developed
- Use continues today
- Initially batch oriented environment
- Evolution to Timesharing
- i.e. Data terminals connected to mainframes
- Early 60's Voice telephony switches to digital
8A Brief History
- 1960 ATT Introduced Dataphone
- First commercial modem
- Modem Modulator/Demodulator
- Convert between digital and analog signals
- (Essentially same technology used today)
9A Brief History
- 1965 DoD Advanced Research Projects Agency (ARPA)
begins work on ARPANET - 1968/9 Carterphone decision allowed devices which
were beneficial and not harmful to the network to
be connected to the Public Switched Telephone
Network (PSTN). - Paved the way for computers to communicate using
the telephone switching infrastructure.
10A Brief History
- 1969 ARPANET connects 4 computers
- Stanford Research Institute, UCLA, UC Santa
Barbara, and the University of Utah - 1971 The ARPANET grows to 23 hosts connecting
universities and government research centers
around the country. - 1971 Intel introduces the first microprocessor -
the Intel 4004.
11A Brief History
- 1971 The Kenbak-1, the first microcomputer, is
introduced in Scientific American, selling a
total of 40 units in 2 years. - Used 130 IC's with a 256 byte memory and 8-bit
words, processed 1000 instructions per second,
and cost 750.
12A Brief History
- 1972 Intel launches the 8-bit 8008 - the first
microprocessor which could handle both upper and
lowercase characters. - 1972 Xerox develops the Xerox Alto - the first
computer to use a Graphic User Interface.
The Alto consists of four major parts the
graphics display, the keyboard, the graphics
mouse, and the disk storage/processor box. Each
Alto is housed in a beautifully formed, textured
beige metal cabinet that hints at its 32,000
price tag (1979US money). With the exception of
the disk storage/processor box, everything is
designed to sit on a desk or tabletop
13A Brief History
- 1973 Robert Metcalfe invents the Ethernet
networking system at the Xerox Palo Alto Research
Center.
14A Brief History
- 1973 The ARPANET goes international
- 1974 Intel introduces the 8080 microprocessor
- 5 times faster than the 8008.
- And the heart of the future Altair 8800.
15A Brief History
- 1975 MITS markets the Altair 8800 - the first
mass-market microcomputer, launching the Personal
Computer Revolution. - 1975 Internet operations transferred to the
Defense Communications Agency - 1975 Bill Gates and Paul Allen form the Microsoft
company to create software for the new Altair
8800.
16A Brief History
- 1976 Apple Computer is formed by Steve Jobs,
Steve Wozniak, and Ron Wayne, and launches the
Apple Computer. - 1977 Tandy Radio Shack ships its first personal
computer - the TRS-80. It sells over 10,000
units, tripling expectations. - 1977 Apple Computer launches the Apple II, which
sets new standards for sophisticated personal
computer systems.
17A Brief History
- 1978 The C programming language is completed at
ATT Bell Laboratories, offering a new level of
programming. - 1978 Apple and Tandy ship PCs with 5.25" floppy
disks, replacing cassette tape as the standard
storage medium for PCs. - 1978 Hayes Microcomputer Products releases the
first mass-market modem, transmitting at 300 bps
(0.3K).
18A Brief History
- 1978 Intel ships the Intel 8086 microprocessor,
with 29,000 transistors, and running at 4.77
megahertz. - 1979 Personal Software creates VisiCalc for the
Apple II, the first electronic spreadsheet
program, selling over 100,000 copies. - 1979 Intel develops the 8088 microprocessor,
which would later become the heart of the IBM PC.
19A Brief History
- 1979 Motorola develops the Motorola 68000
microprocessor, offering a new level of
processing power. - 1980 Seagate Technology introduces the first
microcomputer hard disk, capable of holding 5
megabytes of data. - 1980 Philips introduces the first optical laser
disk, with many times the storage capacity of
floppy or hard disks.
20A Brief History
- 1980 Xerox creates Smalltalk - the first
object-oriented programming language. - 1980 John Shoch at Xerox creates the first worm
program, with the capacity to travel through
networks. - 1981 Ungermann-Bass ships the first commercial
Ethernet network interface card.
21A Brief History
- 1981 Xerox introduces the Xerox Star 8010, the
first commercial Graphic User Interface computer,
for 16,000-17,000. - 1981 Microsoft supplies IBM with PC-DOS (which it
would also sell as MS-DOS), the OS that would
power the IBM PC. - 1981 IBM brings to market the IBM PC, immediately
establishing a new standard for the world of
personal computers.
22A Brief History
- 1981 ARPANET has 213 hosts. A new host is added
approximately once every 20 days. - 1982 The term 'Internet' is used for the first
time. - 1983 TCP/IP becomes the universal language of the
Internet
23http//research.lumeta.com/ches/map/
24Networking Basics
25Network Culture(s)
- 3 cultures for 3 classes of networks
- SAN performance, latency and bandwidth
- LAN workstations, cost
- WAN telecommunications, phone call revenue
- Connection of 2 or more networks Internetworking
- Will attempt a single terminology
26Interconnections (Networks)
- Examples
- System Area Networks (SP2) 100s nodes 25
meters per link - Local Area Networks (Ethernet) 100s nodes
1000 meters - Wide Area Network (ATM) 1000s nodes 5,000,000
meters
a.k.a. end systems, hosts
a.k.a. network, communication subnet
Interconnection Network
27Example 1 (of 2)FTP over WAN
bus
NI
M
P
D
mountains
swamp
- Disk-to-disk transfer
- 1. universality
- 2. reliability
- 3. performance (bandwidth)
- Distance may be great
- multiple trips through memory, processor may be
fine - performance issue is pipelining packets through
the system
28Example 2 (of 2)Parallel Program on a SAN
bus
switch
0.5 meter
0.5 meter
NI
M
P
D
- Distance small and known
- mem-to-mem or even reg-to-reg
- switch may use ECC reliability
- Application may be limited by network latency as
well as bandwidth
Jacobi method Aij ave. of neighbors
from previous iter. (HW8)
29Example Major Networks
- Ethernet and Ethernet
- 10/100/1000... (10000Mb)
- 1500B packets, 100m
- originally shared bus, now switched star
- ATM
- 155/620Mb... (10000Mb)
- OC-3/-12... (-192)
- 53B cells, arbitrary dist.
- circuit-switched
- Myrinet
- cluster interconnect
- 1200Mb
- Fibre Channel
- I/O interconnect
- 1000/2000Mb
- Infiniband
- I/O and cluster interconnect
- 2.5/10Gb
30ABCs of Networks
- Starting Point Send bits between 2 computers
- Queue (FIFO) on each end
- Information sent called a message
- Can send both ways (Full Duplex)
- Rules for communication? protocol
- Inside a computer
- Loads/Stores Request (Address) Response (Data)
- Need Request Response signaling
31Trivial Examplesupport read of remote memory
- What is the format of mesage?
- Fixed? Number bytes?
Request/ Response
Address/Data
1 bit
32 bits
0 Please send data from Address 1 Packet
contains data corresponding to request
- Header/Trailer information to deliver a message
- Payload data in message (1 word above)
32Extensions
- What if more than 2 computers want to
communicate? - Need computer address field (destination) in
packet - What if packet is garbled in transit?
- Add error detection field in packet (e.g., CRC)
- What if packet is lost?
- More elaborate protocols to detect loss
(e.g., NAK, ARQ, time outs) - What if multiple processes/machine?
- Queue per process to provide protection
- Simple questions such as these lead to elaborate
protocols and packet formats gt complexity - note complexity often gt slow
33A Simple Example Revisted
- What is the format of packet?
- Fixed? Number bytes?
Address/Data
CRC
Code
2 bits
32 bits
4 bits
00 RequestPlease send data from Address 01
ReplyPacket contains data corresponding to
request 10 Acknowledge request 11 Acknowledge
reply
34Simple Example SoftwareHW kernel-controlled,
memory-mapped
- Send steps
- 1 Application copies data to OS buffer, then
does a system call - 2 OS computes checksum, copies data/checksum to
NI hardware - 3 OS sets timeout timer, tells NI to start
- SW Receive steps
- 1 OS copies data from hardware to OS buffer,
performs checksum - 2 If checksum matches send ACK if not, OS
deletes message (sender resends when timer
expires) - 3 If OK, notify application application copies
data from OS buffer - Sequence of steps protocol
- Example similar to UDP/IP protocol in UNIX
35Protocols
- Sequence of steps performed by software to send
and receive messages. - Issues
- Lost messages
- Duplicate messages
- Queue full
- Endianess
- etc.
- More next time...
36Performancevocabulary fun
- Bandwidth
- Time of Flight
- Transmission Time
- Transport Latency
- Sender Overhead
- Receiver Overhead
37Network Performance Measures
- Overhead latency of interface vs.
- Latency latency of network
38Universal Performance Metrics
Sender
(processor busy)
Transmission time (size bandwidth)
Time of Flight
Receiver Overhead
Receiver
(processor busy)
Transport Latency
Total Latency
Total Latency Sender Overhead Time of Flight
Message Size BW
Receiver Overhead
Includes header/trailer in BW calculation?
39Example Performance Measures
- Interconnect MPP LAN WAN
- Example CM-5 Ethernet ATM
- Bisection BW N x 5 MB/s 1.125 MB/s N x 10 MB/s
- Int./Link BW 20 MB/s 1.125 MB/s 10 MB/s
- Transport Latency 5 µsec 15 µsec 50 to 10,000 µs
- HW Overhead to/from 0.5/0.5 µs 6/6 µs 6/6 µs
- SW Overhead to/from 1.6/12.4 µs 200/241
µs 207/360 µs (TCP/IP on LAN/WAN)
Software overhead dominates in LAN, WAN
40There is an old network saying Bandwidth
problems can be cured with money. Latency
problems are harder because the speed of light is
fixed--you cant bribe God.
41Connecting Computers
42Connecting Computers
- 1. Network Interface
- 2. Media
- 3. Connecting more than two computers
- Routing
- Network topologies
- 4. Internetworking connecting across multiple
protocols
43Where to place NI card
CPU
Network
Network
ideal high bandwidth, low latency, standard
interface
L2
Memory Bus
I/O bus
Memory
Bus Adaptor
- Where to connect network to computer?
- Cache consistent to avoid flushes? (gt memory
bus) - Latency and bandwidth? (gt memory bus)
- Standard interface card? (gt I/O bus)
- MPP gt memory bus LAN, WAN gt I/O bus
- Future?
44Hierarchy of Media
- Twisted Pair
- Coaxial Cable
- Fiber Optics
45Media
- Twisted Pair
- 10 Mb/Sec 2 km 0.23/m 15
- 1000 Mb/sec 0.2 km 0.23/m 500
- Coaxial Cable
- 10 Mb/sec 1 km 1.64 25
- Multimode Fiber
- 1000 Mb/sec 2 km 1.03 500
- Single-Mode Fiber
- 10000 Mb/sec 100 km 1.64 10000
46Connecting Multiple Computers
- Shared Media vs. Switched pairs communicate at
same time point-to-point connections - Aggregate BW in switched network is many times
shared - point-to-point faster since no arbitration,
simpler interface - Arbitration in Shared network?
- Central arbiter for LAN?
- Listen to check if being used (Carrier Sensing)
- Listen to check if collision (Collision
Detection) - Random resend to avoid repeated collisions not
fair arbitration - OK if low utilization
(A. K. A. data switching interchanges,
multistage interconnection networks, interface
message processors)
47Connection-Based vs. Connectionless
- Telephone operator sets up connection between
the caller and the receiver - Once the connection is established, conversation
can continue for hours - Share transmission lines over long distances by
using switches to multiplex several conversations
on the same lines - Time division multiplexing divide B/W
transmission line into a fixed number of slots,
with each slot assigned to a conversation - Problem lines busy based on number of
conversations, not amount of information sent - Advantage reserved bandwidth
48Connection-Based vs. Connectionless
- Connectionless every package of information must
have an address gt packets - Each package is routed to its destination by
looking at its address - Analogy, the postal system (sending a letter)
- also called Statistical multiplexing
- Note Split phase buses are sending packets
49Routing Messages
- Shared Media
- Broadcast to everyone!
- Switched Media needs real routing. Options
- Source-based routing message specifies path to
the destination (changes of direction) - Virtual Circuit circuit established from source
to destination, message picks the circuit to
follow - Destination-based routing message specifies
destination, switch must pick the path - deterministic always follow same path
- adaptive pick different paths to avoid
congestion, failures - Randomized routing pick between several good
paths to balance network load
50Deterministic Routing Examples
- mesh dimension-order routing
- (x1, y1) -gt (x2, y2)
- first ?x x2 - x1,
- then ?y y2 - y1,
- hypercube edge-cube routing
- X xox1x2 . . .xn -gt Y yoy1y2 . . .yn
- R X xor Y
- Traverse dimensions of differing address in order
- tree common ancestor
- Deadlock?
51Routing Policies
- Store and Forward
- Wormhole
- http//www.johnlockhart.com/research/janet/
52Store and Forward vs. Cut-Through
- Store-and-forward policy each switch waits for
the full packet to arrive in switch before
sending to the next switch (good for WAN) - Cut-through routing or worm hole routing switch
examines the header, decides where to send the
message, and then starts forwarding it
immediately - In worm hole routing, when head of message is
blocked, message stays strung out over the
network, potentially blocking other messages
(needs only buffer the piece of the packet that
is sent between switches). - Cut through routing lets the tail continue when
head is blocked, accordioning the whole message
into a single switch. (Requires a buffer large
enough to hold the largest packet).
53Cut-Through vs. Store and Forward
- Advantage
- Latency reduces from function ofnumber of
intermediate switches X by the size of the packet
to time for 1st part of the packet to
negotiate the switches the packet size
interconnect BW
54Congestion Control
- Packet switched networks do not reserve
bandwidth this leads to contention (connection
based limits input) - Solution prevent packets from entering until
contention is reduced (e.g., freeway on-ramp
metering lights) - Options
- Packet discarding If packet arrives at switch
and no room in buffer, packet is discarded (e.g.,
UDP) - Flow control between pairs of receivers and
senders use feedback to tell sender when
allowed to send next packet - Back-pressure separate wires to tell to stop
- Window give original sender right to send N
packets before getting permission to send more
overlapslatency of interconnection with overhead
to send receive packet (e.g., TCP), adjustable
window - Choke packets aka rate-based Each packet
received by busy switch in warning state sent
back to the source via choke packet. Source
reduces traffic to that destination by a fixed
(e.g., ATM)
55Protocol Family Concept
Message
Message
Message
56Protocol Family Concept
- Key to protocol families is that communication
occurs logically at the same level of the
protocol, called peer-to-peer, - but is implemented via services at the next lower
level - Encapsulation carry higher level information
within lower level envelope - Fragmentation break packet into multiple smaller
packets and reassemble - Danger is each level increases latency if
implemented as hierarchy (e.g., multiple check
sums)
57TCP/IP packet, Ethernet packet, protocols
- Application sends message
- TCP breaks into 64KB segments, adds 20B header
- IP adds 20B header, sends to network
- If Ethernet, broken into 1500B packets with
headers, trailers (24B)
- All Headers, trailers have length field,
destination, ...
58The Ethernet
A drawing of the first Ethernet system by Bob
Metcalfe.
59Ethernet Evolution
- X_Base_Y
- X stands for the available media bandwidth
- Base stands for base band signaling on the medium
- Y stands for the maximum distance a station can
be from the vampire tap (i.e. Length of Attach
Unit Interface)
60Ethernet Evolution
- 10_base_5 (1979-1985)
- 10 Mbits/Sec with base band signaling with a
maximum station distance of 500 meters - Thick shielded copper conductor used as the medium
MAU-Medium Access Unit
61- 10_base_2 (1985-1993)
- Thin net, cheaper net
- Distance to the station shrinks to 200 meters
- No more vampire taps
- BNC connector to connect the stations to the
Attach Unit Interface (AUI) cables, the AUI
cables to the medium - The medium is daisy-chained via the stations
using the BNC connectors
Bayonet Neil-Concelman, or sometimes British
Naval Connector
62- 10_base_T (1993-1995)
- Attach Unit Interface (AUI) is a twisted pair of
copper wires - AUIs from the stations come to a hub which is a
multiplexor/transceiver - Did away with the BNC connectors which were a
source of connector problems - Use phone jack technology (RJ45 connectors) to
connect AUI cables to the hub - Hubs are connected to other hubs using the same
connectors (RJ45)
63- 10_base_T (1993-1995) continued
- All the hubs together form the entire medium
- All the stations in the same collision domain
- Hub is also usually called a repeater
64More Ethernet
- 10BROAD36 - 10BROAD36 is a seldom used Ethernet
specification which uses a physical medium
similar to cable television, with CATV-type
cables, taps, connectors, and amplifiers. - 1BASE5 - 1BASE5 is a specification of Ethernet
that runs at 1 Mb/s over twisted pair wiring.
This physical topology uses centralized hubs to
connect the network devices. - FOIRL - Fiber Optic Inter-Repeater Link - This
specification of the 802.3 standard defines a
standard means of connecting Ethernet repeaters
via optical fiber.
65More Ethernet
- 10BASE-F - 10BASE-F is a set of optical fiber
medium specifications which define connectivity
between devices. - 100BASE-T - 100BASE-T is a series of
specifications that provides 100 megabit speeds
over copper or fiber. These topologies are often
referred to as Fast Ethernet. - Gigabit Ethernet - Gigabit Ethernet provides
speeds of 1000 Mb/s over copper and fiber.
66Where will it end???
67Broadband vs. Baseband
- A baseband network has a single channel that is
used for communication between stations. Ethernet
specifications which use BASE in the name refer
to baseband networks. - A broadband network is much like cable
television, where different services communicate
across different frequencies on the same cable. - Broadband communications would allow a Ethernet
network to share the same physical cable as voice
or video services. 10BROAD36 is an example of
broadband networking.
68Current Technology
- Most modern Ethernet networks use twisted pair
copper cabling or fiber to attach devices to the
network. The 10BASE-T, 100BASE-T, and Gigabit
Ethernet topologies are well suited for the
modern cabling and fiber infrastructures.
69Still Hungry?
- http//www.faqs.org/faqs/LANs/ethernet-faq/
70Ethernet
- The various Ethernet specifications include a
maximum distance - What do we do if we want to go further?
- Repeater
- Hardware device used to extend a LAN
- Amplifies all signals on one segment of a LAN and
transmits them to another - Passes on whatever it receives (GIGO)
- Knows nothing of packets, addresses
- Any limit?
71Repeaters
R1
R2
R3
72Repeaters
R1
R2
R3
73Bridges
- We want to improve performance over that provided
by a simple repeater - Add functionality (i.e. more hardware)
- Bridge can detect if a frame is valid and then
(and only then) pass it to next segment - Bridge does not forward interference or other
problems - Computers connected over a bridged LAN don't know
that they are communicating over a bridge
74Bridges
- Typical bridge consists of conventional CPU,
memory and two NIC's. - Does more than just pass information from one
segment to another - A bridge can be constructed to
- Only pass valid frame if necessary
- Learn what is connected to network "on the fly"
75Bridges
- Event Segment 1 List Segment 2 List
- Bridge boots - -
- U send to V U -
- V sends to U U, V -
- Z broadcasts U, V Z
- Y sends to V U, V Z, Y
- Y sends to X U, V Z, Y
- X sends to W U, V Z, Y, X
- W sends to Z U, V, W Z, Y, X
76Bridges
- A bridge will connect to distinct segments
(usually referring to a physical length of wire)
and transmit traffic between them. - This allows you to extend the maximum size of the
network while still not breaking the maximum wire
length, attached device count, or number of
repeaters for a network segment.
77Switch
A
B
C
D
78Virtual LANs
- VLANs may span bridges
- Nodes 1 and 5 same VLAN 2, 6, 7 same VLAN
- All nodes on the same VLAN hear broadcasts from
any node on that VLAN - VLAN limits the traffic flow among bridges
- A hierarchical network with only bridges results
in a switched ethernet with no collisions!
79http//www.cisco.com/univercd/cc/td/doc/product/so
ftware/ios113ed/113ed_cr/switch_c/xcvlan.htm
80Network Interface Card
- NIC
- Sits on the host station
- Allows a host to connect to a hub or a bridge
- If connected to a hub, then NIC has to use
half-duplex mode of communication (i.e. it can
only send or receive at a time) - If connected to a bridge, then NIC (if it is
smart) can use either half/full duplex mode - Bridges learn Media Access Control (MAC) address
and the speed of the NIC it is talking to.
81Routers
- Work much like bridges
- Pay attention to the upper network layer
protocols - (OSI layer 3) rather than physical layer (OSI
layer 1) protocols. - Will decide whether to forward a packet by
looking at the protocol level addresses (for
instance, TCP/IP addresses) rather than the MAC
address.
82Routers
- Because routers work at layer 3 of the OSI stack,
it is possible for them to transfer packets
between different media types (i.e., leased
lines, Ethernet, token ring, X.25, Frame Relay
and FDDI). Many routers can also function as
bridges.
83Routers
- Repeaters and Bridges understand only Media
Access Control (MAC) addresses - Traffic flow between nodes entirely based on MAC
addresses - Packet from a host station ltmac-addr, payloadgt
- Routers understand IP addresses
- Special board that sits inside a bridge
- IP layer on all nodes send packets destined
outside the LAN to the router - Router sees a packet as ltip-hdr, payloadgt
- uses the ip-hdr to route the packet on to internet