cop 5611 operating systems spring 2010

46
COP 5611 Operating Systems Spring 2010 Dan C. Marinescu Office: HEC 439 B Office hours: M-Wd 2:00-3:00 PM

Upload: sarah

Post on 23-Feb-2016

55 views

Category:

Documents


0 download

DESCRIPTION

COP 5611 Operating Systems Spring 2010. Dan C. Marinescu Office: HEC 439 B Office hours: M-Wd 2:00-3:00 PM. Lecture 10. Reading Assignment: Chapter 7 from the online textbook A progress report for the project is due on every Monday. Last time : Network properties Today: Layering - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COP 5611 Operating Systems Spring 2010

COP 5611 Operating Systems Spring 2010

Dan C. MarinescuOffice: HEC 439 BOffice hours: M-Wd 2:00-3:00 PM

Page 2: COP 5611 Operating Systems Spring 2010

222222

Lecture 10

Reading Assignment: Chapter 7 from the online textbook A progress report for the project is due on every Monday. Last time:

Network properties Today:

Layering Link layer Network layer

Next time Routing

Page 3: COP 5611 Operating Systems Spring 2010

3

Networks encounter a vast range ofData ratesPropagation, transmission, queuing, and processing delays.LoadsNumbers of users

Networks traverse hostile environmentsNoise damages dataLinks stop working

Best-effort networks haveVariable delaysVariable transmission ratesDiscarded packetsDuplicate packetsMaximum packet lengthReordered delivery

Page 4: COP 5611 Operating Systems Spring 2010

4

A B

time

X overloaded

resend request,

send request,

receive response,

send request,

timer expires,

set new timer

receive response,

X

X

set timer

reset timer

set timer

reset timer

forwarderdiscardsrequestpacket.

request 1

response 1

request 2

request 2’

response 2’

Recovery of lost packets

Page 5: COP 5611 Operating Systems Spring 2010

5

A B

X overloaded forwarder

send request,

duplicate arrives at BB sends response 3’

timer expires,resend request,

Xreceive response,

set new timer

set timer

reset timer

discards response 3

request 3

request 3’

response 3’

Duplicate requests

Page 6: COP 5611 Operating Systems Spring 2010

6

A B

packet containing responsetimer expires,resend

send request,

duplicate arrives at BB sends response 4’

receive

response

receiveresponse,

reset timerX

duplicate

gets delayed

set timerrequest 4

response 4

request 4’

response 4’

Delays and recovery lead to duplicate response

Page 7: COP 5611 Operating Systems Spring 2010

7

Layering

Simplify the design Example- RPC

Page 8: COP 5611 Operating Systems Spring 2010

8

result FI RE (#, target, action) procedure FIRE (nmiss, where, react)

Client stub Service stub

proc: FIREargs: 3type: integervalue: 2type: stringvalue: “Lucifer”type: procedurevalue: EVADE

Preparerequestmessage.Send toservice

Receiverequestmessage.Callrequestedprocedure.Prepareresponsemessage.Send to client.

response:

acknowledgmenttype: stringvalue: “destroyed”

request:

Wait forresponse.

return result...

Client-server communication based on RPC

Page 9: COP 5611 Operating Systems Spring 2010

9

Main program called procedureapplication protocol

RPC client stub presentation protocol RPC service stub

Page 10: COP 5611 Operating Systems Spring 2010

10

Client network Service networktransport protocol package package

fire

send_ receive_

(return) fire(return)

Main program called procedureapplication protocol

RPC client stub presentation protocol RPC service stub

message messagereceive_message

send_message

Page 11: COP 5611 Operating Systems Spring 2010

Multiple protocols may be supported at each layer

11

Layer One

Layer Two

Layer Three

A B C D

X Y Z

J K L

Page 12: COP 5611 Operating Systems Spring 2010

12

Multiplexing and Demultiplexing

P1 P2 P3

P4

P1 P2

P4

Sending side Receiving side

P3

Page 13: COP 5611 Operating Systems Spring 2010

Network layers for store and forward networks Every module has three interfaces:

To the layers above To the layers below To the peer layer on another system

Each layer hides the operation of the layer below from the layer above and provides its own interpretation of the important features of the layers below.

A minimum of three layers are necessary: Link layer move data from one point to another. Includes Network layer forward data through intermediate node towards the

destination End-to-end-layer provides all the functions required by the application

including Encapsulation: each layer treats information received from the

layers above as raw data and adds control information (headers and trailers) understood only by its peer.

13

Page 14: COP 5611 Operating Systems Spring 2010

14

LinkLayer link

protocollink

protocol

link 1 link 2

LI NK_SEND (pkt, link2)

LinkLayer

LinkLayer

A B C

DATA

DATA LHLT

NETW ORK_HANDLE

Link layer

Page 15: COP 5611 Operating Systems Spring 2010

15

LinkLayer

linkprotocol

link 2

lI NK_SE ND (packet, link2)

LinkLayer

LinkLayer

NetworkLayer

NETW ORK_ SEND (segment, “IP”, nap_1197)

network

protocolNetworkLayer

LINK_SEND (packet, link5)

link5

DATA

DATANT NH

DATANT NH LHLT

NETWORK_HANDLE

Network layer

Page 16: COP 5611 Operating Systems Spring 2010

End-to-end layer

16

LinkLayer

NetworkLayer

FI RE (7, “Lucifer”, evade)

end-to-end

protocolEnd-to-End

Layer

DATA

DATANT NH LHLT

LinkLayer

LinkLayer

LinkLayer

NetworkLayer

NetworkLayer

End-to-EndLayer

ET EH

DATAET EH

(RPC) (RPC)

DATANT NHET EH

FI RE (7, “Lucifer”, evade)

Page 17: COP 5611 Operating Systems Spring 2010

17

Layering in different network architectures

OSI –has 7 layers The upper four layers are:

Application Presentation translate data formats and emulate the semnatics of RPC Transport deal with lost, duplicate, out of order, segments Session deals with connectivity

Internet is based on a model including Application Transport – transports segments Network – transports packets Data Link – transports frames

Applications are very diverse and it makes no sense for a lower layer to implement functions required by higher layers.

The end-to-end argument application knows best

Page 18: COP 5611 Operating Systems Spring 2010

Example of an end-to end argument

Should we have a checksum implemented at the link layer or should leave it for the application protocol e.g., a file transfer protocol?

If we implement it at the link layer Advantage: detect earlier an error Disadvantage: the data may still be affected by errors when buffered at

the upper layers.

18

Page 19: COP 5611 Operating Systems Spring 2010

Application, Transport, Network, and Data Link Layer Protocols

Application Layer

Transport Layer

Network Layer

HTTP FTP TELNET

TCP UDP

IP

NFS RPC DNS SNTP

Data Link Layer

Ethernet WirelessSatellite

Page 20: COP 5611 Operating Systems Spring 2010

20

Teleconferencing

Email

TelnetApplication Layer

Transport Layer

Network Layer

Physical and Data Link Layers

LANsWireless

Direct Broadcast Sateliite

ATMDial-up

Modems

VideoconferencingWWW

FTP

IP

CableFrame Relay

RealAudio

TCPUDP

Hourglass communication model

Page 21: COP 5611 Operating Systems Spring 2010

21

Network composition

Network composition: Mapped composition A network layer is built directly on another

network layer by mapping directly higer-layer network addresses to lower-layer network addresses. Example:

Internetworking interconnect several networks together, e.g., the Internet

Recursive composition a network layer rests on a link layer that it is itself a complete network. Examples:

Overlay networks. E.g., Gnutella

Page 22: COP 5611 Operating Systems Spring 2010

22

Gnutella (network layer)

InternetTransport Protocol (end-to-end layer)

Internet Protocol (network layer)

dial-up dialed connection (end-to-end layer)telephone switch (network layer)

physical wire (link layer)

File Transfer Program (end-to-end layer)File transfer system

(linklayer)

telephone network(link

layer)

Network composition. The overlay network Gnutella uses for its link layer an end-to-end transport protocol of the Internet. In turn, the Internet uses for one of its links an end-to-end transport protocol of a dial-up phone system

Page 23: COP 5611 Operating Systems Spring 2010

23

More about the link layer

Function: push bits from one place to another In this architecture the link layer combines:

MAC (medium access control layer) The physical layer

Analog worlds Capacity of a communication channel Capacity of a noisy communication channel

C= B x log (1+ signal/noise) B is the bandwidth in Hz signal/noise – ratio of signal power to noise power Signals attenuation Signals are distorted over long distances

Page 24: COP 5611 Operating Systems Spring 2010

24

time

V1 1 1 1 10 0 0 0

Serial transmission

Page 25: COP 5611 Operating Systems Spring 2010

25

dataready

acknowledgeA B

How to push bits from A to B which do not share the same clock? First raise the READY line

Page 26: COP 5611 Operating Systems Spring 2010

26

A B

Signal attenuation and shape distortion

Page 27: COP 5611 Operating Systems Spring 2010

Error detection and error correction

Encode data with an error detection code. Use error correction if necessary.

27

Page 28: COP 5611 Operating Systems Spring 2010

28

Framing

A pattern of bits serve as a frame delimiter – e.g., seven 1’s Bit stuffing:

The sender: add a 0 whenever it encounters a pattern of six 1’s in data The receiver: remove a 0 following a pattern of six 1’s in data

Add a frame header Add a frame trailer

Page 29: COP 5611 Operating Systems Spring 2010

29

procedure FRAME _ TO_ BIT ( frame_data, length)ones_in_a_row = 0for i from 1 to length do // First send frame contents

SEND _BIT ( frame_data[ i]);if frame_data[ i] = 1 then

ones_in_a_row ones_in_a_row + 1;if ones_in_a_row = 6 then

SEND _BIT (0); // Stuff a zero so that data doesn’t ones_in_a_row 0; // look like a framing marker else

ones_in_a_row 0;for i from 1 to 7 do // Now send framing marker.

SEND _BIT (1)

Sender bit stuffing procedure

Page 30: COP 5611 Operating Systems Spring 2010

30

procedure BIT _ TO_FRAME (rcvd_bit)ones_in_a_row integer initially 0if ones_in_a_row < 6 then

bits_in_frame bits_in_frame + 1frame_data[bits_in_frame] rcvd_bit

if rcvd_bit = 1 then ones_in_a_row ones_in_a_row + 1else ones_in_a_row 0

else // This may be a seventh one-bit in a row, check it out.if rcvd_bit = 0 then

ones_in_a_row 0 // Stuffed bit, don't use it.else // This is the end-of-frame marker

LINK _RECEIVE ( frame_data, ( bits_in_frame - 6), link_id)bits_in_frame 0ones_in_a_row 0

Receiver bit stuffing procedure

Page 31: COP 5611 Operating Systems Spring 2010

31

Network protocol

Standard Highrobustnessprotocolprotocol

Network Layer

Link LayerExperimentalprotocol

A network protocol may use multiple data link protocols

Page 32: COP 5611 Operating Systems Spring 2010

32

Network Layer

Link Layer

InternetProtocol

AppletalkProtocol

PathVector

ExchangeProtocol

AddressResolution

Protocol

Standard Highrobustness

protocolprotocolExperimental

protocol

Multiple transport and data link protocols

Page 33: COP 5611 Operating Systems Spring 2010

33

structure frame structure checked_contents

bit_string net_protocol // multiplexing parameterbit_string payload // payload data

bit_string checksum

procedure LINK _SEND (data_buffer, link_identifier, link_protocol, network_protocol) frame instance outgoing_frameoutgoing_frame.checked_contents.payload data_bufferoutgoing_frame.checked_contents.net_protocol data_buffer.network_protocolframe_length LENGTH (data_buffer) + header_lengthoutgoing_frame.checksum CHECKSUM ( frame.checked_contents, frame_length)sendproc link_protocol[ that_link.protocol] // Select link protocol.sendproc (outgoing_frame, frame_length, link_identifier) // Send frame.

Sending a frame

Page 34: COP 5611 Operating Systems Spring 2010

34

procedure LINK _RECEIVE (received_frame, length, link_id) frame instance received_frame if CHECKSUM (received_frame.checked_contents, length) =

received_frame.checksum then // Pass good packets up to next layer.

good_frame_count good_frame_count + 1;GIVE _TO_NETWORK _HANDLER (received_frame.checked_contents.payload,

received_frame.checked_contents.net_protocol);else bad_frame_count bad_frame_count + 1 // Just count damaged frame.

// Each network layer protocol handler must call SET_HANDLER before the first packet // for that protocol arrives…

procedure SET _HANDLER (handler_procedure, handler_protocol) net_handler[handler_protocol] handler_procedure

procedure GIVE _TO_NETWORK _HANDLER (received_packet, network_protocol) handler net_handler[network_protocol]if (handler ° NULL) call handler(received_packet, network_protocol)else unexpected_protocol_count unexpected_protocol_count + 1

Receiving a frame

Page 35: COP 5611 Operating Systems Spring 2010

Link properties

We distinguish several types of links: Point-to-point Broadcast links

Each link imposes a maximum transmission unit (MTU) the largest frame size which affects Timing, un upper bound on link commitment time Error, the longer the frame the larger the probability of error for a given

error rate on the link Buffer space at each end

35

Page 36: COP 5611 Operating Systems Spring 2010

The network layer

A network can be viewed as consisting of Network core – carries out segments from one communicating entity to

another Network periphery – hosting the communicating entities at attachment

points Addressing – each communicating entity must have a unique

address.

36

Page 37: COP 5611 Operating Systems Spring 2010

37

Network

0107

24

16

11

39

33

35

40

41

42 network

network

pointattachment

address

Page 38: COP 5611 Operating Systems Spring 2010

38

Internet Core and Edge

Radio tower

Local ISP

Regional ISP

National Service Provider

Local ISP

Regional ISP

National Service Provider

NAPNAP

National Service Provider

NAP

Server

Disk array

Local ISP

Database

Internet core

ModemDialup System

Local ISP

Local ISP

Ethernet

EthernetSatellite

Satellite dish

Edge RouterEdge Router

Border Router

Border Router

Edge Router

Edge Router

PDA

Page 39: COP 5611 Operating Systems Spring 2010

39

Router

SwitchingFabric

Input PortLT - Line

TerminationData Link Protocol

LookupForwarding

Queuing

Output Port

Queuing Data Link Protocol LT

Routing Processor

Output PortInput Port

Input Port Output Port

Page 40: COP 5611 Operating Systems Spring 2010

40

Shaper

Policer

Classifier

Outputlink

Inputflows

Dispatcherand Buffer

Acceptance

Router supporting QoS (Quality of Service)

Page 41: COP 5611 Operating Systems Spring 2010

Network model

The network layer transports packets The network core consists of routers which forward packets using

routing tables The input for network layer on a host at the periphery of the network

is a segment in a segment buffer at the transport layer. The output is a link buffer

41

Page 42: COP 5611 Operating Systems Spring 2010

42

structure packetbit_string source bit_string destination bit_string end_protocol bit_string payload

procedure NETWORK _ SEND (segment_buffer, destination, network_protocol, end_protocol)

packet instance outgoing_packetoutgoing_packet.payload segment_bufferoutgoing_packet.end_protocol end_protocoloutgoing_packet.source MY_ NETWORK _ADDRESSoutgoing_packet.destination destinationNETWORK _HANDLE (outgoing_packet, net_protocol)

Page 43: COP 5611 Operating Systems Spring 2010

43

procedure NETWORK _ HANDLE ( net_packet, net_protocol)packet instance net_packetif net_packet.destination ° MY_NETWORK _ADDRESS then

next_hop LOOKUP (net_packet.destination, forwarding_table)LINK _ SEND (net_packet, next_hop, link_protocol, net_protocol)

elseGIVE _TO_END _LAYER ( net_packet.payload,

net_packet.end_protocol, net_packet.source)

Page 44: COP 5611 Operating Systems Spring 2010

44

frame check frameDATAendprotocol

DATASegment presented tothe network layer

Packet presented tothe link layer

Frameappearingon the link

source &destination sum

networkprotocol

DATAendprotocol

source &destination

1111111 97142 1111111“Fire”RPCExample 41 —> 24 55316IP

mark mark

Page 45: COP 5611 Operating Systems Spring 2010

All hosts must have logical addresses

All devices have a physical address of the interface Must obtain a logical address

45

Page 46: COP 5611 Operating Systems Spring 2010

Dynamic IP address assignment -DHCP

DHCP responseunicast frame

Destination address: the physical address

of host interface

DHCP request broadcast frame

Local Area Network

DHCPserver

Laptop

DHCP relay DHCP responseUDP datagram for the

DHCP relay

DHCP requestUDP datagram for the

DHCP serverInternet