1 / 26

CSS432 Foundation Textbook Ch1

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.

masao
Download Presentation

CSS432 Foundation Textbook Ch1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSS432 FoundationTextbook Ch1 Professor: Munehiro Fukuda CSS 432

  2. limitations length #nodes Building Blocks • Nodes: PC, special-purpose hardware… • hosts • switches • Links: coax cable, optical fiber… • point-to-point • multiple access CSS 432

  3. 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

  4. Strategies • Circuit switching: carry bit streams • original telephone network • Packet switching: store-and-forward messages • Internet CSS 432

  5. 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

  6. 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

  7. 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

  8. 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

  9. IPC Abstractions • Connectionless • Examples • On-demand video • Video conferencing • Requirements • One/two-way traffic • Bulk data transfer: 60Mbps • Some data may be dropped off. • FIFO order in most cases • Security • Connection-Oriented • Examples • FTP • Web (HTTP) • NFS • Requirements • At most one message delivery • FIFO order • Security CSS 432

  10. 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

  11. Layering • Use abstractions to hide complexity • Abstraction naturally lead to layering • Alternative abstractions at each layer Application programs Connection-Oriented Connectionless channel channel Host-to-host connectivity Hardware CSS 432

  12. 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 (only direct at H/W level) CSS 432

  13. 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

  14. 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

  15. Active Open (Client) Connectionless: UDP (SOCK_DGRAM) sendto( sd, buf, sizeof( buf ), flag, struct sockaddr *name, socklen_t namelen ); recvfrom( sd, buf, sizeof( buf ), flag, struct sockaddr *addr, socketlen_t, *addrlen ); Connection-oriented: TCP (SOCK_STREAM) connect( int sd, struct sockaddr *name, socklen_t namelen ) write( sd, buf, sizeof( buf ) ); writev( sd, struct iovec *iov, int iovcnt ); read( sd, buf, sizeof( buf ) ); Passive Open (Server) Connectionless: UDP (SOCK_DGRAM) bind( int sd, struct sockaddr *name, socklen_t namelen ); recvfrom( sd, buf, sizeof( buf ), flag, struct sockaddr *addr, socketlen_t, *addrlen ); sendto( sd, buf, sizeof( buf ), flag, struct sockaddr *name, socklen_t namelen ); Connection-oriented: TCP (SOCK_STREAM) bind( int sd, struct sockaddr *name, socklen_t namelen ); listen( sd, 5 ); accept( sd, struct sockaddr *addr, socket_t *addrlen ); read( sd, buf, sizeof( buf ) ); readv( std, struct iovec *iov, int iovcnt) write( sd, buf, sizeof( buf ) ); Socket API • Creating a socket: int socket(int domain, int type, int protocol) • domain =PF_INET, PF_UNIX • type = SOCK_STREAM, SOCK_DGRAM packets Connection request Stream data HW1 uses these. CSS 432

  16. 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

  17. Active Open (Client) connect( int sd, struct sockaddr *name, socklen_t namelen ) Passive Open (Server) bind( int sd, struct sockaddr *name, socklen_t namelen ); listen( sd, 5 ); accept( sd, struct sockaddr *addr, socket_t *addrlen ); file Socket data structure Socket data structure Socket data structure type type type protocol protocol protocol so_pcb so_pcb so_pcb 0 0 so_rcv so_rcv so_rcv 1 1 so_snd so_snd so_snd 2 2 3 3 4 4 File structure table User file descriptor table User file descriptor table File structure table l_addr l_port f_addr f_port socket inpcb: Internet protocol control block Socket Implementation • Creating a socket: int socket(int domain, int type, int protocol) • domain =PF_INET, PF_UNIX • type = SOCK_STREAM, SOCK_DGRAM inode Client process Server process int fd = open( “fileA”, O_RDONLY, 0 ); packet copied copied packet packet packet packet packet l_addr l_port inpcb: Internet protocol control block f_addr f_port CSS 432 socket

  18. write/read Send and receive a message in buf writev/readv Gather and scatter messages in a single pair of writev/readv Blocking write/read Write( ) is blocked until a message is sent. Read( ) is blocked until a message is received Non-blocking Write( ) returns without confirming a message send Read( ) returns null without waiting for a message. TCP Communication default Memory buffers Buffer descriptor list 100 1400 1500 CSS 432 1500

  19. Non-Blocking CommunicationC/C++ Example • Polling • Periodically check if a socket is ready to read data: • Example: sd = socket( AF_INET, SOCKET_STREAM, 0); set_fl(sd, O_NONBLOCK); // set the socket as non-blocking struct pollfd pfd; pfd.fd = sd; poll( &pfd, 1, timeout ) // poll the socket status • Interrupt • Notified from the system when a socket is ready to read data; • Example: sd = socket(AF_INET, SOCKET_STREAM, 0); signal(SIGIO, sigio_func); // set a future interrupt to call sigio_func( ) fcntl(sd, F_SETOWN, getpid( )); // ask OS to deliver this fd interrupt to me fcntl(sd, F_SETFL, FASYNC); // set this fd asynchronous int sigio_func( ) { // invoked upon an interrupt } CSS 432

  20. 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

  21. (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

  22. 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

  23. 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

  24. 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

  25. 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

  26. 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. 3 (RTT) • Ex. 10 and 29 (STDM and FDM) • Ex. 16 (Latency) • Ex. 30 (Packet Sequence) CSS 432

More Related