270 likes | 457 Views
CSS432 Foundation Textbook Ch1. Professor: Munehiro Fukuda. …. limitations. length. #nodes. Building Blocks. Nodes: PC, special-purpose hardware… hosts switches Links: coax cable, optical fiber… point-to-point multiple access. Clouds - Networks.
E N D
CSS432 FoundationTextbook Ch1 Professor: Munehiro Fukuda CSS 432
… limitations length #nodes Building Blocks • Nodes: PC, special-purpose hardware… • hosts • switches • Links: coax cable, optical fiber… • point-to-point • multiple access CSS 432
Clouds - Networks • A network can be defined recursively as... • A set of independent clouds (networks) interconnected to forma an internetwork • Internet • A set of nodes, each connected to one or more p2p link • Switched network • Circuit switch • Packet switch Router/gateway: forwarding message Switch: forwarding message CSS 432
Strategies • Circuit switching: carry bit streams • original telephone network • Packet switching: store-and-forward messages • Internet CSS 432
Addressing and Routing • Address: byte-string that identifies a node • usually unique • Routing: process of forwarding messages to the destination node based on its address • Forwarding: local, static, and implemented by h/w • Routing: dynamic, complex, and implemented by s/w • Types of addresses • unicast: node-specific • broadcast: all nodes on the network • multicast: some subset of nodes on the network CSS 432
L1 R1 L2 R2 Switch 1 Switch 2 L3 R3 Multiplexing • Synchronous Time-Division Multiplexing (STDM) • Frequency-Division Multiplexing (FDM) • Two limitations: • If a host has no data to send, the corresponding time slot or frequency becomes idle. • The maximum number of flows, (#time slots and #different frequencies) are fixed. CSS 432
Statistical Multiplexing • On-demand time-division • Schedule link on a per-packet basis • Packets from different sources interleaved on link • Buffer packets that are contending for the link • Buffer (queue) overflow is called congestion … CSS 432
Host Host Application Host Channel Application Host Host Inter-Process Communication • Turn host-to-host connectivity into process-to-process communication. • Fill gap between what applications expect and what the underlying technology provides. CSS 432
IPC Abstractions • Stream-Based • Examples • On-demand video • Video conferencing • Requirements • One/two-way traffic • Bulk data transfer: 60Mbps • Some data may be dropped off. • FIFO order • Security • Request/Reply • Examples • FTP • Web (HTTP) • NFS • Requirements • At most one message delivery • FIFO order • Security CSS 432
What Goes Wrong in the Network? • Bit-level errors (electrical interference) • Packet-level errors (congestion) • Link and node failures • Messages are delayed • Messages are deliver out-of-order • Third parties eavesdrop CSS 432
Layering • Use abstractions to hide complexity • Abstraction naturally lead to layering • Alternative abstractions at each layer Application programs Request/reply Message stream channel channel Host-to-host connectivity Hardware CSS 432
Request/reply Message stream channel channel Layering • Use abstractions to hide complexity • Abstraction naturally lead to layering • Alternative abstractions at each layer Application programs Process-to-process channels Host-to-host connectivity Hardware CSS 432
Host 1 Host2 Service High-level High-level interface object object Protocol Protocol Peer-to-peer interface Protocols and Interfaces • Protocol: Building each layer of a network architecture • Each layer’s protocol has two different interfaces • service interface:operations on this protocol • peer-to-peer interface: messages exchanged with peer CSS 432
Host 2 Host 1 Digital Video File Digital Video File library library application application application application application application RRP MSP RRP MSP RRP: Request/Reply Protocol MSP: Message Stream Protocol HPP: Host-to-Host Protocol HHP HHP Protocol Machinery • Protocol Graph • most peer-to-peer communication is indirect • peer-to-peer is direct only at hardware level • Applications employ the protocol stack RRP/HHP CSS 432
Host 1 Host 2 Application Application program program Data Data RRP RRP RRP Data RRP Data HHP HHP HHP RRP Data Machinery (cont) • Encapsulation (header + body or payload) • Multiplexing and Demultiplexing (a demux key in each header) CSS 432
End host End host Application Application Presentation Presentation Session Session Transport Transport Network Network Network Network Data link Data link Data link Data link Physical Physical Physical Physical One or more nodes within the network OSI Architecture CSS 432
FTP HTTP NV TFTP Netscape, IE, Mosaic, etc. UDP TCP IP … NET NET NET 2 1 n Focal point for the architecture Internet Architecture • Defined by Internet Engineering Task Force (IETF) • Hourglass Design • Application vs Application Protocol (FTP, HTTP) Reliable byte-stream channel Unreliable datagram delivery Internet Protocol Ethernet, FDDI, etc. CSS 432
Socket API • Creating a socket int socket(int domain, int type, int protocol) • domain =PF_INET, PF_UNIX • type = SOCK_STREAM, SOCK_DGRAM • Passive Open (on server) int bind(int socket, struct sockaddr *addr, int addr_len) int listen(int socket, int backlog) int accept(int socket, struct sockaddr *addr, int addr_len) CSS 432
Sockets (cont) • Active Open (on client) int connect(int socket, struct sockaddr *addr, int addr_len) • Sending/Receiving Messages int send(int socket, char *msg, int mlen, int flags) int recv(int socket, char *buf, int blen, int flags) Or int write( int socket, char *msg, int mlen ) int read( int socket, char *buf, int blen ); CSS 432
socket() socket() socket() bind() listen() connect() connect() accept() write() write() buf2, buf1 buf2, buf1 read() read() Sockets (Code Example) int sd, newSd; sd = socket(AF_INET, SOCK_STREAM, 0); int sd = socket(AF_INET, SOCK_STREAM, 0); sockaddr_in server; bzero( (char *)&server, sizeof( server ) ); server.sin_family =AF_INET; server.sin_addr.s_addr = htonl( INADDR_ANY ) server.sin_port = htons( 12345 ); bind( sd, (sockaddr *)&server, sizeof( server ) ); struct hostent *host = gethostbyname( arg[0] ); sockaddr_in server; bzero( (char *)&server, sizeof( server ) ); server.sin_family = AF_INET; server.s_addr = inet_addr( inet_ntoa( *(struct in_addr*)*host->h_addr_list ) ); server.sin_port = htons( 12345 ); listen( sd, 5 ); connect( sd, (sockaddr *)&server, sizeof( server ) ); sockaddr_in client; socklen_t len=sizeof(client); while( true ) { newSd = accept(sd, (sockaddr *)&client, &len); write( sd, buf1, sizeof( buf ) ); write( sd, buf2, sizeof( buf ) ); if ( fork( ) == 0 ) { close( sd ); read( newSd, buf1, sizeof( buf1 ) ); read( newSd, buf2, sizeof( buf2 ) ); } close( newSd ); } close( newsd); exit( 0 ); CSS 432
Protocol Implementation Issues • Process Model • Process per protocol • Process per message • avoid context switches • Buffer Model • Copy from Application buffer to network buffer • Zero copy / pin-down communication • avoid data copies CSS 432
(a) (b) Process Model Applications Presentation Process 1 Static piece of code Session Process 2 Static piece of code Transport Process 3 Static piece of code Network • Process-per-Protocol • Simple message passing mechanisms between processes • A context switch required at each layer • Process-per-Message • For sending, functions are called down from top to bottom. • For receiving, functions are called up from bottom to top. CSS 432
copied passed bypassed message message passed copied message message message Buffer Model Pin downed communication Zero copy communication Conventional buffer transfer message message message • Avoid data copies • Avoid OS interventions CSS 432
Performance Metrics • Bandwidth (throughput) • data transmitted per time unit • link versus end-to-end • notation • Mbps = 106 bits per second • Gbps = 109 bits per second • Latency (delay) • time to send message from point A to point B • one-way versus round-trip time (RTT) • components Latency = Propagation + Transmit + Queue Propagation = Distance / SpeedOfLight Transmit = Size / Bandwidth • Even in the same distance, latency varies depending on the size of message. CSS 432
Ideal versus Actual Bandwidth • RTT dominates • Throughput = TransferSize / TransferTime • TransferTime = RTT + 1/Bandwidth x TransferSize • RTT: • a request message sent out and data received back • Example: • 1-MB file across a 1-Gbps network with RTT=100ms. • 1MB / 1Gbps = 8Mb / 1000Mbps = 8msec • TransferTime = 100 + 8 = 108msec • Throughput = 1MB / 108msec = 74.1 Mbps CSS 432
Delay x Bandwidth Product • Amount of data “in flight” or “in the pipe” • Example: 100ms x 45Mbps = 560KB • Receiver must prepare a buffer whose size is at least 2 x Delay x Bandwidth CSS 432
Reviews • Components: hosts, links, switches, routers and networks • Switching (circuit and packet) and multiplexing (STDM, FDM, and statistical) • OSI and Internet architectures • Socket • Performance metrics: Bandwidth and latency • Exercises in Chapter 1 • Ex. 5 (RTT) • Ex. 12 and 31 (STDM and FDM) • Ex. 18 (Latency) • Ex. 32 (Packet Sequence) CSS 432