eleg 651 / cpeg 419 review of lecture 1 and continuation of chapter 1 introduction to data...

32
ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Upload: john-park

Post on 04-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

ELEG 651 / CPEG 419

Review of Lecture 1 and continuation of chapter 1

Introduction to Data Networking

Page 2: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Announcements

• Homework 1 due next week

• Project 1 due next week

Page 3: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Today

• Recent News

• Review and complete Chapter 1

• Start Chapter 2

Page 4: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

In the news

News sources

www.lightreading.com (general networks)

www.unstrung.com (wireless and mobile)

www.darkreading.com (network security)

www.alleyinsider.com (general tech business news)

arstechnica.com (general tech news)

Page 5: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Comcast Defends P2P Management

• P2P file sharing is responsible for a – large share to the bytes send over the Internet, – but only a small fraction of the connections

• Thus, a few P2P users are using most of the bandwidth• ISPs would rather give good service to users other than to P2P users

– If a transfer of a large file takes a bit longer, it does not impact the utility (the user does not really care)

– If a short file transfer takes longer, it greatly impact utility (delaying a web page or a VoIP packet is a big problem for a user)

– Ideally, service is provided according to user utility, more utility results in more bandwidth

• Possibly, Comcast uses equipment to ensure that short connections receive the maximum possible bandwidth at the expense of long connections.

– Comcast denies this• Some claim that Comcast cut P2P connections in general

– This seems doubtful• P2P users claim that comcast is not abiding by network neutrality

http://www.lightreading.com/document.asp?doc_id=146016&site=cdn

Page 6: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

network neutrality• Net neutrality is about allowing any type of connections and providing the

same type of service with any decimation. • Depending on your prospective, it is a good idea or bad idea.• Google likes the idea that they do not have to do anything special to get

bandwidth• ISPs and some application developers are against net neutrality

– Suppose that an ISP allows cheap or free access but charges google for searches. If google does not want to pay, then the ISP directs searches to yahoo, microsoft, or ask.com

• Would you rather get free access or ensure that all your searches go where you want. • Google is very afraid of lack of customer loyalty.

– Net-flex and amazon and others would like to sell video over the network. However, the network is too slow. They might be willing to pay for a faster service.

• Net neutrality is blamed for a lack of video on-demand

• Politically motivated censoring– google.cn and china in general blocks network content that is against Chinese

government– There is little doubt that without net neutrality, if Rupert Murdock (the owner of

fox tv) owned an ISP, he would block access to web sites with non-conservative viewpoints

• There have been several attempts to pass net neutrality laws (one is currently pending), but so far, net neutrality is not a law

– The comcast vs P2P is being used to motivate the current bill

Page 7: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The Protocol Stack

• The application layer includes network applications and network application protocols– e.g. of applications: web, IM, email– e.g., application protocols: OSCAR,

http, smtp, ftp, DNS.

• Provide a service to a user or another application.

• Require service from the lower layers, but typically only interact with the transport layer.

application

transport

network

link

physical

Page 8: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The Protocol Stack

• The transport layer (typically) transports messages from and to applications

• Different transport layer protocols provide different types of services.

• Types of services MAY include– Reliability: the sender application can be assured that

the data is correctly received, or receives an error message.

– Congestion and flow control: attempt to send data quickly but not so quickly to cause congestion in the network or at the receiving host

– Error detection / correction– In order delivery– Break long messages into small chunks suitable for

transmission over the network– Multiplexing so that multiple transport layer connections

can occur simultaneously• Note that when a transport protocol provides these

services, the application does not have to. – This makes implementation of applications easier.– This allows careful design of transport protocols,

following the divide and conquer approach• The transport layer uses the network layer to deliver

packets, but does not require any type of service guarantees from the network layer

– In practice, the transport layer hopes for in order delivery.

application

transport

network

link

physical

Page 9: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Transport layer protocols: TCP and UDP

• TCP and UDP are the most widely used transport protocols.

• Other protocols include SCTP (UD and Cisco are active in developing SCTP), RTP (for multimedia such as VoIP)

• TCP and UDP will be covered in great detail later. But for now:

• TCP provides many services– Congestion control– Flow control– Reliability– Multiplexing– Error detection

• UDP provides few services– Error detection– Multiplexing– The application must implement any other

services that it requires.• TCP requires a connection to be established,

UDP does not

application

transport

network

link

physical

Page 10: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Transport Multiplexing

• Transport layers use ports to provide multiplexing– A two hosts can have

multiple simultaneous connections by using ports.

– Well known ports can be used to specify a particular application

• E.g., web servers will accept TCP connections on port 80

• A host can have two connections with a web server by using different ports

host

TCP

0

45674568

216-1

UDP

0

216-1

host(web server)

TCP

0

80

216-1

UDP

0

216-1

Page 11: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Sockets – gateway between the app layer and the transport layer

• process sends/receives messages to/from its socket

• socket analogous to door– sending process shoves

message out door

– sending process relies on transport infrastructure on other side of door which brings message to socket at receiving process

process

TCP withbuffers,variables

socket

host orserver

process

TCP withbuffers,variables

socket

host orserver

Internet

controlledby OS

controlled byapp developer

Page 12: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

TCP Sockets

• An application accesses TCP and UDP through sockets.• TCP is connection based so one host must be listening and the other must

be connecting (calling)• The basic steps for a TCP listener

– Define socket variable as a TCP socket– Bind socket to a port (the bind function)

• If some other application is or was recently (120 sec) listening on this port, this function will fail.

• The application must check that this command succeeds.– Listen on this port (the listen function)– When a the other host connects, the listen function completes and data can be

send or received.– Close socket

• Basic steps for TCP caller– Define socket variable as a TCP socket

• No port is given, the OS will assign which ever port is available. The application has no control over the port

– Connect– Send data– Close socket

Page 13: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

UDP Sockets

• UDP are connectionless. – A host sends a packet when it wants. – There is no concept of one host connecting to another.– There is only the concept of one host sending a packet and the other host receiving the

packet. And either host can send or receive• Steps to send and then receive a UDP message

– Define socket as a UDP socket– Bind socket to a port

• If this port is in use, bind will fail– Send message– Wait for message

• There are two ways to wait for messages, blocking or non-blocking• A blocking function will wait for a message to arrive. It might wait forever.• A non-blocking will return immediately, but if no message was waiting in the transport layer, then no

message is returned• select function allows a time out to be set. So the function will wait until a message arrives or the

timeout time to elapse.– Close socket

• Steps to receive a UDP message– Define socket as a UDP socket– Bind socket to a port

• If this port is in use, bind will fail– Send message– Wait for response– Close socket

Page 14: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Project 1

• In this project messages will be sent over TCP and UDP.• The project is description currently at

– www.eecis.udel.edu/~bohacek/Classes/ELEG651Spring2008/Project1/Project1.htm

• Once mycourses is up, it will be listed there.• All the required information should be online. Post

questions on mycourses (if it is up)• This project can be completed by cut and pasting from

the web site. But try to understand the steps.• Let me know if there are typos.

Due 2/25

Page 15: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The Protocol Stack

• The network layer routes packets (datagrams) through the network

• The network layer gets packets from the transport layer or from the link layer.

• Depending on the destination address, the network layer will give the packet to the transport protocol or to a specific link layer to send on a specific link

• The network layer also provides fragmenting of a large packet into chunks suitable for the link layer

application

transport

network

link

physical

Page 16: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The Protocol Stack

• The link layer moves packets (frames) between two hosts

• However, the link layer may provide a wide range of services including– Media access control– Error detection / correction– Routing over layer 2 networks– Reliability (where the network layer is

informed if the transmission fails)

application

transport

network

link

physical

Page 17: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The Protocol Stack

• The physical layer moves packets (frames) between two connected hosts

• This requires putting the bits onto a physical medium and decoding them from the medium.

• In this course we mostly neglect the physical layer and assume that is works correctly (each layer always assumes that the other layers work correctly)

• But the performance of a protocol at a layer often dependent on the other layers.– One approach is for cross-layer design

application

transport

network

link

physical

Page 18: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

sourceapplicatio

ntransportnetworklink

physical

HtHn M

segment Ht

datagram

destination

application

transportnetworklink

physical

HtHnHl M

HtHn M

Ht M

M

networklink

physical

linkphysical

HtHnHl M

HtHn M

HtHn M

HtHnHl M

router

switch

Encapsulationmessage M

Ht M

Hn

frame

Page 19: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Packet Switching vs. Circuit Switching

• Packet switching uses statistical multiplexing at each link– As packets arrive at a link, they are processed in a first-come-

first-served basis• Circuit switching use statistical multiplexing over

connections– As connections arrived, they are processes on a first-come-first-

served basis• Circuit switching might lead to wasted resources at links

if the demand is random.– If demand is predictable, then circuit switching is more efficient,

e.g., 100% utilization is possible

• Packet switching leads to random delays and even losses. Thus, network protocols must function correctly when packets are delayed or lost.

Page 20: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Suppose that at each time step either1. The queue increases by length one with probability p2. If the queue is not empty, it decreases by length 1 with probability q = 1 – p3. If the queue is empty, then it stays empty with probability q = 1 - p

The delay goes to infinity as utilization goes to 1

Discrete-time queuing theory – Markov Chains

Required for ELEG 651 but optional for CPEG 419

Diagram of the states the queue can take

Q=0(empty)

Q=1 Q=2 Q=i-1 Q=i Q=i+1

Page 21: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Suppose that at each time step either1. The queue increases by length one with probability p2. If the queue is not empty, it decreases by length 1 with probability q = 1 – p3. If the queue is empty, then it stays empty with probability q = 1 - p

The delay goes to infinity as utilization goes to 1

Discrete-time queuing theory – Markov Chains

Required for ELEG 651 but optional for CPEG 419

Q=0(empty)

Q=1 Q=2 Q=i-1 Q=i Q=i+1

Diagram of the states the queue can take

p

q

p

q q

p p p p

q q q q

Page 22: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Q=0(empty)

Q=1 Q=2 Q=i-1 Q=i Q=i+1

p

q

p

q q

p p p p

q q q q

Define P(i) to be the probability that the queue has i packets

Page 23: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Page 24: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Page 25: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Expected queue occupancy

Page 26: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Q=0(empty)

Q=1 Q=2 Q=i-1 Q=i Q=i+1

p

q

p

q q

p p p p

q q q q

Define P(i) to be the probability that the queue has i packets

P(i) = P(i+1)*q + P(i-1)*p For all i except i=0

P(0) = P(1)*q + P(0)*p For i=0

i=0 P(i) = 1

Page 27: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

P(1) = P(0) (1 - q)/q = P(0) p/q

P(1) = P(2)*q + P(0)*pP(0) p/q = P(2)*q + P(0)*pP(0)(p/q – p) = P(2)*qP(0)(p/q – p*q/q) = P(0)( (p-pq)/q) )= P(0)( p(1-q)/q) = P(0)p2/qP(0)p2/q = P(2)qP(2) = P(0) (p/q)2

Perhaps: P(i) = P(0) (p/q)i

check

P(i) = P(i+1)*q + P(i-1)*pP(0)(p/q)i = P(0) (p/q)i+1q + P(0) (p/q)i-1p 1 = (p/q) q + q = q (p/q + 1) = q(p/q + q/q) = q((p+q)/q) = q/q = 1 1=1, It works!

Page 28: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

P(i) = P(0) (p/q)i

i=0 P(i) = 1

i=0 P(0) (p/q)i = 1P(0) i=1 (p/q)I = 1P(0) 1 / (1-p/q) = 1P(0) = 1-p/qP(i) = (1-p/q) (p/q)i

Page 29: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Expected queue occupancy

i 0 i 1

1 EQ i 0

iPi

i 0

iP0pq

i

P0 i 0

ipq

i

From calculus:

So:dd

i 0

i dd

11

i 0

i 11 2

Putting this together:

EQ P0 11 p

q2

1 pq1

1 pq

2

11 p

q

limp/q 1EQ And so

Page 30: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

The delay goes to infinity as utilization goes to 1

Required for ELEG 651 but optional for CPEG 419

Page 31: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking

Delay in Packet Networks

Types of delay in packet networks

• Queuing delay

• Propagation delay

• Transmission delay

• Processing delay

Page 32: ELEG 651 / CPEG 419 Review of Lecture 1 and continuation of chapter 1 Introduction to Data Networking