Operating Systems CMPSCI 377 Networks - PowerPoint PPT Presentation

1 / 45
About This Presentation
Title:

Operating Systems CMPSCI 377 Networks

Description:

Raw, TCP, simple socket, RPC, RMI , etc. ... TCP most stuff. Sends reliable ... Create socket as before. Convert hostname to IP address with getaddrinfo ... – PowerPoint PPT presentation

Number of Views:39
Avg rating:3.0/5.0
Slides: 46
Provided by: prismsC
Category:

less

Transcript and Presenter's Notes

Title: Operating Systems CMPSCI 377 Networks


1
Operating SystemsCMPSCI 377Networks
  • Emery Berger and Mark Corner
  • University of Massachusetts Amherst

2
Networks and OS
  • Networks and OS are strongly linked
  • Want to know about networking guts?
  • Take 453
  • Concentrate on OS abstractions
  • Multiple layers of abstraction accessible
  • Pick the simplest one
  • Pick the one with the functionality you need
  • Raw, TCP, simple socket, RPC, RMI , etc.

3
Hardware Reality
  • Many kinds of networks
  • Ethernet, FDDI, Cable, DSL, ATM
  • Only delivery locally
  • Multiple hops to get to destination
  • Destination named by MAC address
  • Small Messages
  • Machine to Machine communication
  • Unordered, unreliable, insecure

4
Abstractions Provided by OS
  • Network/device independence
  • Routing to final destination (not the OS)
  • Destinations have readable names
  • Large messages
  • Process-Process communication
  • Ordered, reliable
  • Streams of bytes or even function calls
  • Security
  • More (distributed file systems, shared mem)

5
Communication Protocols
  • Protocol agreed-upon rules for communication
  • Protocol stack layers that comprise networking
    software
  • Each layer N provides service to layer N1

6
Abstraction and Protocol Layers
NFS
HTTP
Ssh
SMTP
RPC
TCP
UDP
IP
ATM
Ethernet
7
UDP
  • User Datagram Protocol
  • Not much of an abstraction
  • Lossy, unordered, individual messages
  • Why use this?

8
TCP
  • Transmission Control Protocol
  • Lowest layer typically used by systems
  • Provides
  • Reliability
  • Ordering
  • Byte Stream
  • no message boundaries!
  • Remember reality
  • Losses, reordering, individual messages

9
Process to Process
  • Process to process communications
  • Reality is machine to net to net to machine
  • Machines have addresses
  • Typically IP addresses
  • Port
  • endpoint sub address
  • Think apartment building is IP
  • Apartment number is port number
  • How do I know the right port number?

10
Sockets
  • Standard API for network programming
  • Duplex communication (2-way)
  • OS Abstraction for a connection
  • Can configure sockets to use UDP or TCP
  • UDP best for lossy communication
  • Pings, video, audio, other multimedia
  • Sends datagrams (packets)
  • TCP most stuff
  • Sends reliable stream of bytes

11
Socket communication
  • Sockets (in TCP) send stream of bytes
  • Multiple sends may be combinedinto one received
    message
  • To send multiple application-level messages, must
    have application level protocol
  • E.g., 4-bytes message type, 4-bytes message
    length, plus message

12
Client-side using sockets
  • Creates socket
  • int fd socket (AF_INET, SOCK_STREAM, 0)
  • Converts hostname to IP address
  • getaddrinfo (name, portStr, NULL, portNum)
  • Connects to host
  • connect (fd, addr, len) // from getaddrinfo
  • Once connected, can send or recv
  • send (fd, data, amount, 0)
  • recv (fd, buf, len, 0)

13
Server-side using sockets
  • As before
  • Create socket as before
  • Convert hostname to IP address with getaddrinfo
  • getaddrinfo (name, portStr, hint, addrinfo)
  • Binds socket to address
  • bind (fd, addr, len) // from getaddrinfo
  • Listens for connection
  • listen (fd, 1) // number of waiting msgs
  • Accepts connection ) new socket
  • int newfd accept (fd, addr, len)
  • Why does this return a socket number?

14
Exercise
  • Lamest web server ever
  • Wait for connections on localhost port 80
  • Read message until first newline (\n)
  • Send lthtmlgtltbodygtHello worldlt/bodygtlt/htmlgt
  • Use
  • int fd socket (AF_INET, SOCK_STREAM, 0)
  • getaddrinfo (name, portStr, hint, addrinfo)
  • bind (fd, addr, addrlen)
  • int v listen (fd, 1)
  • int newfd accept (fd, addr, len)

15
Systems Patterns
  • Two dominant forms of building systems
  • Client-Server (ie. web server and client)
  • Peer-to-peer (ie. BitTorrent)
  • Not completely distinct
  • Google is which?
  • More generally Distributed Systems

16
Distributed Systems
  • Physically separate processors connected by one
    or more communication links
  • no shared clock or memory
  • Most systems today distributed in some way
  • email, file servers, printers, remote backup,
    web..

P2
P1
P4
P3
17
Parallel vs. Distributed Systems
  • Tightly coupled parallel processing
  • Processors share clock, memory, run one OS
  • Frequent communication
  • Loosely coupled distributed computing
  • Each processor has own memory, runs independent
    OS
  • Infrequent communication

18
Advantages
  • Resource sharing
  • Computational speedup
  • Reliability
  • Communication
  • Close to some physical resource

19
Advantages
  • Resource sharing
  • Resources need not be replicated
  • Shared files
  • Expensive (scarce) resources can be shared
  • Poster-size color laser printers
  • Present same environment to user
  • Keeping files on file server

20
Advantages, continued
  • Computational speedup
  • n processors n times computational power
  • SETI_at_home
  • Problems must be decomposable
  • Trivial embarrassingly parallel
  • Coordination communication required between
    cooperating processes
  • Synchronization
  • Exchange of results

21
Advantages, continued
  • Reliability
  • Replication of resources provides fault tolerance
  • One node crashes, user works on another one
  • Performance degradation but system available
  • Must avoid single point of failure
  • Single, centralized component of system
  • Example central file servers

22
Advantages, continued
  • Communication
  • Users/processes on different systems can
    communicate
  • Mail, transaction processing systems like
    airlines banks, www

23
Abstractions for Building
  • RPC Remote Procedure Call
  • Lots of systems built on this
  • Children RMI, CORBA, DCOM
  • Programmer doesnt see socket
  • Sees blocking function call
  • Difficult to get right when things fail
  • Lockups, etc.

24
AJAX
  • Asynchronous JavaScript and XML
  • Ie. google maps
  • Move data asynchronously
  • Ask for data, when it shows up, great.
  • Interact with data locally
  • Multiple data sources, display is fast

25
The End
26
Networks
  • Goal Efficient, correct, robust message passing
    between two separate nodes
  • Local area network (LAN) nodes in single
    building, fast reliable (Ethernet)
  • Media twisted-pair, coax, fiber
  • Bandwidth 10-1,000MB/s
  • Wide area network (WAN) nodes across large
    geographic area (Internet)
  • Media fiber, microwave links, satellite channels
  • Bandwidth 1.544MB/s (T1), 45 MB/s (T3)

27
Principles of Net Communication
  • Data broken into packets ( 1Kb)
  • Basic unit of transfer
  • Computers routers control packet flow
  • Road analogy
  • Packets cars
  • Network roads
  • Computer traffic lights (intersection)
  • Too many packets on shared link/node traffic jam

28
Traditional Layers
  • Application layer applications that use the net
  • Presentation layer data format
    conversion(big/little endian)
  • Session layer implements communication
    strategy(e.g., RPC)
  • Transport layer reliable end-to-end
    communication
  • Network layer routing congestion control
  • Data link control layer reliable point-to-point
    communication over unreliable channel
  • Physical layer electrical/optical signaling
    across wire

29
TCP/IP Protocol Stack
  • Internet standard protocol stack
  • TCP reliable protocol packets received in
    order
  • UDP (user datagram protocol) unreliable
  • No guarantee of delivery

30
Packet Format
  • All info needed to recreate original message
  • Packets may arrive out of order
  • need sequence number
  • Data segment contains headers for higher protocol
    layers application data

31
Network Topologies
  • Connection of nodes impacts
  • Maximum average communication time
  • Fault tolerance
  • Expense
  • Two basic topologies
  • Bus (for LANs)
  • Point-to-point

32
Bus Network Topologies
  • Bus nodes connect to common network
  • Linear bus single shared link
  • Nodes connect directly to each other via bus
  • Inexpensive (linear in of nodes)
  • Tolerant of node failures
  • Ethernet LAN

33
Bus Network Topologies
  • Ring bus single shared circular link
  • Same technology tradeoffs as linear bus

34
Point-to-Point Network Topologies
  • Fully-connected
  • Each message takes one hop
  • Node failure no effect on communication with
    others
  • Expensive impractical for WANs

35
Point-to-Point Network Topologies
  • Fully-connected
  • Each message takes one hop
  • Node failure no effect on communication with
    others
  • Expensive impractical for WANs

36
Point-to-Point Network Topologies
  • Fully-connected
  • Each message takes one hop
  • Node failure no effect on communication with
    others
  • Expensive impractical for WANs

37
Point-to-Point Network Topologies
  • Fully-connected
  • Each message takes one hop
  • Node failure no effect on communication with
    others
  • Expensive impractical for WANs

38
Point-to-Point Network Topologies
2
3
1
4
  • Partially connected
  • Links between some, but not all nodes
  • Less expensive, less tolerant to failures
  • Single node failure can partition network
  • Several hops requires routing

39
Point-to-Point Network Topologies
I want to goto Node 4!
2
3
1
4
  • Partially connected
  • Links between some, but not all nodes
  • Less expensive, less tolerant to failures
  • Single node failure can partition network
  • Several hops requires routing

40
Point-to-Point Network Topologies
I want to goto Node 4!
2
3
1
4
  • Partially connected
  • Links between some, but not all nodes
  • Less expensive, less tolerant to failures
  • Single node failure can partition network
  • Several hops requires routing

41
Point-to-Point Network Topologies
  • Tree structure network hierarchy
  • Messages fast between direct descendants
  • Max message cost?
  • Not failure tolerant
  • Any interior node fails network partitioned

42
Point-to-Point Network Topologies
  • Star network all nodes connect to central node
  • Each message takes how many hops?
  • Not failure tolerant
  • Inexpensive sometimes used for LANs

43
Point-to-Point Network Topologies
  • One-directional ring
  • Given n nodes, max hops?
  • Inexpensive
  • Fault-tolerant?

44
Point-to-Point Network Topologies
  • Bi-directional ring
  • Given n nodes, max hops?
  • Inexpensive
  • Fault-tolerant? One node? Two?

45
Point-to-Point Network Topologies
  • Doubly-connected ring nodes connected to
    neighbors one more distant
  • Given n nodes, max hops?
  • Fault-tolerant?
  • More expensive
Write a Comment
User Comments (0)
About PowerShow.com