Presentation is loading. Please wait.

Presentation is loading. Please wait.

Network Protocols Sarah Diesburg Operating Systems CS 3430.

Similar presentations


Presentation on theme: "Network Protocols Sarah Diesburg Operating Systems CS 3430."— Presentation transcript:

1 Network Protocols Sarah Diesburg Operating Systems CS 3430

2 Distributed Systems Allow physically separate computers to work together + Easier and cheaper to mass-produce simple computers  Off-the-shelf components + A company can incrementally increase the computing power

3 Promises of Distributed Systems Higher availability  If one machine goes down, use another Better reliability  A user is able to store data in multiple locations More security  Each simple component is easier to make secure

4 Reality of Distributed Systems Worse availability  A system may depend on many or all machines being up Worse reliability  One can lose data if any machine crashes Worse security  Security is as strong as the weakest component Coordination is difficult because machines can only use the network medium

5 Network Technologies Definitions  Network: physical connection that allows two computers to communicate  Packet: a unit of transfer A sequence of bits carried over the network  Protocol: An agreement between two parties as to how information is to be transmitted

6 Broadcast Networks A broadcast network uses a shared communication medium  e.g. wireless, Ethernet, cellular phone network  The sender needs to specify the destination in the packet header So the receiver knows which packet to receive  If a machine were not the intended destination Discard the packet

7 Arbitration Concerns the way to share a given resource In Aloha network (1970s)  Packets were sent through radios on Hawaiian Islands

8 Aloha Network  Arbitration: blind broadcast, with a checksum at the end of a packet  Packets might become garbled in the case of simultaneous transmissions

9 Aloha Network  Arbitration: blind broadcast, with a checksum at the end of a packet  Packets might become garbled in the case of simultaneous transmissions

10 Aloha Network  Arbitration: blind broadcast, with a checksum at the end of a packet  Packets might become garbled in the case of simultaneous transmissions

11 Blind Broadcast Receiver: If a packet is garbled discard else sends an acknowledgement Sender: If the acknowledgement does not arrive resend the packet

12 Ethernet (introduced in the early ‘80s) By Xerox First practical local area network  Uses wire (as opposed to radio)  Broadcast network  Key advance: a new way for arbitration

13 Ethernet’s Arbitration Techniques Carrier sensing: Ethernet does not send unless the network is idle Collision detection: sender checks if packet is trampled  If so, abort, wait, and retry Adaptive randomized waiting: a sender picks a bigger wait time (plus some random duration) after a collision

14 The Internet A generalization of interconnected local area networks Uses machines to interconnect various networks  Routers, gateways, bridges, repeaters  Act like switches  Packets are copied as they transmitted across different networks LAN 1 LAN 2

15 Routing Concerns how a packet can reach its destination Typically, a packet has to go through multiple hops before getting to a destination  Each hop is a router, which directs a packet to the next hop  Routing is achieved through routing tables

16 Routing Table Updates 1. Each routing entry contains a cost  2. Neighbors periodically exchange routing table entries 3. If the neighbor has a cheaper route, use that one instead

17 Point-to-Point Networks Instead of sharing a common network medium, all nodes in the network can be connected directly to a router/switch

18 Point-to-Point Networks + Higher link performance (no collisions) + Greater aggregate bandwidth than a single link

19 Point-to-Point Networks + Network capacity can be upgraded incrementally + Lower latency (no arbitration)

20 Issues in Point-to-Point Networks Congestion occurs when everyone sends to the same output link on a switch buffers Crossbar

21 Networking: Physical Reality vs. Abstraction Physical reality: packetsAbstraction: messages Limited sizeArbitrary size UnorderedOrdered UnreliableReliable Machine-to-machineProcess-to-process Only on local area networkRouted anywhere AsynchronousSynchronous InsecureSecure

22 Arbitrary-Size Messages Can be built on top of limited-size ones  By splitting a message into fix-sized packets Checksum can be computed on each fragment or the whole message

23 Internet Protocol (IP) Provides unreliable, unordered, machine-to- machine transmission of arbitrary-size messages

24 Process-to-Process Communications Built on top of machine-to-machine communications through the use of port addresses Each message contains the destination port to talk to the correct process

25 Unreliable Data Protocol (UDP) Provides unreliable, unordered, user-to-user communication Built on the top of IP

26 Ordered Messages Built on top of unordered ones Use sequence numbers to indicate the order of arrival  Specific to a connection If packet 3 arrives before packet 2, wait for packet 2. Always deliver packets in order, to user applications

27 Reliable Message Delivery Built on top of unreliable delivery Problem: Network infrastructure can garble messages  Packets can be dropped if network buffers are full

28 Solution Checksum each message At a receiver, discard messages with mismatching checksums A receiver acknowledges if a packet is received properly A sender resends the same message after not hearing the acknowledgment for some time (a timeout period)

29 A Minor Problem A sender may send twice, if the first acknowledge is lost The receiver needs to discard duplicate packets

30 Implications A sender needs to buffer messages that are not yet acknowledged The receiver must track messages that could be duplicates

31 Transmission Control Protocol (TCP) Provides a reliable byte stream between two processes on different machines over the Internet sequence number: 1 checksum: fa73cd10

32 Transmission Control Protocol Fragments the byte stream into packets and hands them to IP

33 TCP Message Categories Sender  Sent and acknowledged  Sent and not acknowledged  Not yet sent Receiver  Forwarded to application  Received and buffered  Not yet received

34 More on the Sequence Number Need a way to recycle sequence numbers  Each TCP packet has a time-to-live field If the packet is not delivered in X seconds  The packet is dropped  Sequence numbers can be reused  An epoch number used to identify which set of sequence numbers is being used Incremented at each boot Stored on disk

35 Congestion Implications of timeout period at a sender  Too long  unnecessary waiting  Too short  a message is transmitted when an acknowledgement is in transit Network congestion  delayed acknowledgement  timeout  data retransmission  more congestion

36 TCP Solution Slow start: TCP starts by sending a small amount of data  If no timeout, more data is sent  If timeout, TCP reduces the amount of data being sent

37 Distributed Transaction Multiple machines agree to do something atomically, but not necessarily at exactly the same time Mechanism: two-phase commit

38 Two-Phase Commit Account XAccount Y Phase 1: ask if each can commit 1. Begin transaction Ask Y for $1 Enough cash 2. Write “Y = Y - $1” Ready to commit Phase 2: commit 3. Write “X = X + $1” 4. Commit Ask Y to commit 5. Commit

39 Scenarios If X crashes between 1 and 2  Y will wake up and do nothing  X will timeout and abort the transaction If X crashes before step 4  X will wake up and abort the transaction If X crashes between 4 and 5  Y will timeout and ask X for the transaction

40 Scenarios If Y crashes between 2 and 5  Y will wake up and check the log  When X sends Y the commit message, Y will commit  Y can also timeout and ask X the current status


Download ppt "Network Protocols Sarah Diesburg Operating Systems CS 3430."

Similar presentations


Ads by Google