cop 5611 operating systems spring 2010

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

Upload: tamas

Post on 07-Feb-2016

31 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 9. Reading Assignment: Chapter 7 from the online textbook HW1 due today. Remember: A progress report for the project is due on every Monday till week 12. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COP 5611 Operating Systems Spring 2010

COP 5611 Operating Systems Spring 2010

Dan C. Marinescu

Office: HEC 439 B

Office hours: M-Wd 2:00-3:00 PM

Page 2: COP 5611 Operating Systems Spring 2010

222222

Lecture 9

Reading Assignment: Chapter 7 from the online textbook HW1 due today. Remember: A progress report for the project is due on every

Monday till week 12. Last time: Thread coordination and scheduling

Multi-level memories I/O bottleneck

Today: Network properties Layering Data link layer

Next time Network layer

Page 3: COP 5611 Operating Systems Spring 2010

3

Properties of Networks

Physical limitations: Speed of light finite communication latency Hostile environments Limited channel capacity limited bandwidth

Channels are shared - multiplexed Why:

Support any-to-any communication Share costs

How Isochronous multiplexing – scheduled access

TDM FDM

Asynchronous multiplexing

Page 4: COP 5611 Operating Systems Spring 2010

4

BostonSwitch

Los AngelesSwitch

multiplexed link

shared switches

B1

B2

B3

L1

L2

L3

L4

Communication channels are multiplexed

Page 5: COP 5611 Operating Systems Spring 2010

5

Time5,624 bit times

8-bit frame 8-bit frame 8-bit frame

Data flow on an isochronous link

Page 6: COP 5611 Operating Systems Spring 2010

6

Personal Computer service

multiplexedlink

data crosses thislink in bursts andcan tolerate variable delay

A

B

C

D

A data communication network

Page 7: COP 5611 Operating Systems Spring 2010

7

Time

Guidance 4000 bits 750 bits

B D

information

frame

Asynchronously multiplexed link

Page 8: COP 5611 Operating Systems Spring 2010

8

Communication

Continuous versus bursty The old phone network versus data networks Human versus computer communication

Connection-oriented versus connectionless communication Packet-forwarding networks

Routing problem Delays

Page 9: COP 5611 Operating Systems Spring 2010

9

(gradual)1 variable delay2 discards data3 rate adaptation

(hard-edged) either accepts or blocks call

good match

wastes capacity

good match

variable latency upsets

application

Continuous stream

(e.g., interactive voice)

Bursts of data (most

computer-to-computer data)

Response to load

variations

isochronous (e.g., telephone

network)

asynchronous (e.g., Internet)

NetworkType

Application characteristics

Page 10: COP 5611 Operating Systems Spring 2010

10

PacketSwitch Packet

Switch

PacketSwitch

PacketSwitch

Service at network

Workstation 1

2 3at networkattachment

attachmentpoint B

A

B

point A

packet

B

Packet forwarding (store and forward) networks

Page 11: COP 5611 Operating Systems Spring 2010

11

Problems in packet forwarding networks

Delay Propagation delay Transmission delay Processing delay Queuing delay

Resources are finite and a worst case design is not feasible heavy tail distributions of resource needs

Buffer overflow and discarded packets Adaptive rate modulated by information regarding network congestion Timers and packet retransmission Duplicate packets

Page 12: COP 5611 Operating Systems Spring 2010

12

average

Utilization, r0 100%

1

11 –------------

tolerable delay

rmax

queuingdelay

maximum

Queuing delays versus utilization.

Page 13: COP 5611 Operating Systems Spring 2010

13

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 14: COP 5611 Operating Systems Spring 2010

14

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 15: COP 5611 Operating Systems Spring 2010

15

A B

packet containing responsetimer expires,resend

send request,

duplicate arrives at BB sends response 4’

receive

response

receiveresponse,

reset timer

X

duplicate

gets delayed

set timerrequest 4

response 4

request 4’

response 4’

Delays and recovery lead to duplicate response

Page 16: COP 5611 Operating Systems Spring 2010

16

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

Networks traverse hostile environments

Noise damages dataLinks stop working

Best-effort networks have

Variable delaysVariable transmission ratesDiscarded packetsDuplicate packetsMaximum packet lengthReordered delivery

Page 17: COP 5611 Operating Systems Spring 2010

17

Layering

Simplify the design Example- RPC

Page 18: COP 5611 Operating Systems Spring 2010

18

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

Client stub Service stub

proc: FIRE

args: 3

type: integervalue: 2

type: string

value: “Lucifer”

type: procedure

value: 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 19: COP 5611 Operating Systems Spring 2010

19

Main program called procedureapplication protocol

RPC client stub presentation protocol RPC service stub

Page 20: COP 5611 Operating Systems Spring 2010

20

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 21: COP 5611 Operating Systems Spring 2010

21

Layer One

Layer Two

Layer Three

A B C D

X Y Z

J K L

Example of layered design

Page 22: COP 5611 Operating Systems Spring 2010

22

LinkLayer link

protocollink

protocol

link 1 link 2

LI NK_SEND (pkt, link2)

LinkLayer

LinkLayer

A B C

DATA

DATA LHLT

NETW ORK_HANDLE

Data link layer

Page 23: COP 5611 Operating Systems Spring 2010

23

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 24: COP 5611 Operating Systems Spring 2010

24

LinkLayer

NetworkLayer

FI RE (7, “Lucifer”, evade)

end-to-end

protocol

End-to-EndLayer

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)

End-to-end (transport) layer

Page 25: COP 5611 Operating Systems Spring 2010

25

How many layers should a network model have?

OSI –has 7 layers Internet is based on a model including

Application Transport Network Data Link Physical Layer

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 26: COP 5611 Operating Systems Spring 2010

26

Network composition

Mapped composition some layers of a network are composed of basic data-link, network, and transport layers of another network.

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

Internet

Page 27: COP 5611 Operating Systems Spring 2010

27

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 28: COP 5611 Operating Systems Spring 2010

28

More about the link layer

Function: push bits from one place to another 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 29: COP 5611 Operating Systems Spring 2010

29

time

V1 1 1 1 10 0 0 0

Serial transmission

Page 30: COP 5611 Operating Systems Spring 2010

30

data

ready

acknowledgeA B

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

Page 31: COP 5611 Operating Systems Spring 2010

31

A B

Signal attenuation and shape distortion

Page 32: COP 5611 Operating Systems Spring 2010

32

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 33: COP 5611 Operating Systems Spring 2010

33

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 34: COP 5611 Operating Systems Spring 2010

34

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 35: COP 5611 Operating Systems Spring 2010

35

Network protocol

Standard Highrobustnessprotocolprotocol

Network Layer

Link LayerExperimentalprotocol

A network protocol may use multiple data link protocols

Page 36: COP 5611 Operating Systems Spring 2010

36

Network Layer

Link Layer

InternetProtocol

AppletalkProtocol

PathVector

ExchangeProtocol

AddressResolution

Protocol

Standard Highrobustness

protocolprotocolExperimental

protocol

Multiple transport and data link protocols

Page 37: COP 5611 Operating Systems Spring 2010

37

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 38: COP 5611 Operating Systems Spring 2010

38

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