CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we...

46
CS1Q Computer Systems Lecture 16 Simon Gay

Transcript of CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we...

Page 1: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

CS1Q Computer SystemsLecture 16

Simon Gay

Page 2: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 2

Where we are

Global computing: the Internet

Networks and distributed computing

Application on a single computer

Operating System

Architecture

Digital Logic

Electronics

Physics

from small to large networks

interaction

Page 3: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 3

NetworksIn computer terms:

A group of computers connected together so that they canexchange information.

More generally:

Any system for exchanging information among physicallyseparate components.

Networks make distributed computing and distributed applicationspossible.

Page 4: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 4

Examplesbank cash machines

credit card payment machines

voice telephone

faxtwo different applications for the telephone network

local area networks e.g. within the CS department

wide area networks

the Internet a network of networks

Page 5: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 5

How many networks have you used today?

None

One

Two

Three

Four or more

Page 6: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 6

Network vs. ApplicationDistinguish between a distributed application and the network whichit uses.

Example: the World Wide Web is a particular application which usesthe Internet for its data transfer. Electronic mail is another.

Example: home banking initially used dialup connections and specialsoftware; now it is usually done via the Internet.

Page 7: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 7

Issues in Networks & Distributed Systemsphysical implementation: wire? optical fibre? undersea cables?satellites? radio? microwaves? analogue or digital?

structure (topology): e.g. for local area networks:

star ring bus

routing: must be a route between any two points. Perhaps several: howto choose one?

for wide area networks: mixture of structures

Page 8: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 8

Issues in Networks & Distributed Systemsnaming: where is the data going? What does www.dcs.gla.ac.uk mean?

data formats and error correction

security: physical security? information security - encryption?more issues: key exchange, authentication, non-repudiation, …

design of distributed systems:• which part is in control?• all the problems of programming, plus: synchronisation, security, reliability of networks, …• issues beyond correctness: performance, quality of service, failure of components, failure of network, …• how can we understand all this complexity?

Page 9: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 9

Hosts, Nodes and LinksHosts are the computers that are running applications, includingclients (e.g. your workstation running a web browser) and servers(e.g. a computer running a web server).

Nodes are computers at intermediate points in the networks, e.g.routers (specialised computers which deal with sending data to thecorrect destination).

Links are data connections between nodes, or between nodes and hosts.

A B

X

Y

hostlink node

Page 10: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 10

Circuit Switching, Packet SwitchingTwo fundamentally different ways to organize communication.

Circuit switching

for example, the traditional (land-line) telephone system

Packet switching

for example, the Internet

Page 11: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 11

Circuit SwitchingCircuit switching: the same route is used for the whole of a“conversation” between two points in the network.

e.g. telephone system.

A B

To establish a connection from A to B, a complete path must bedetermined and each node on the path remembers its role in theconnection. Data can then be transferred at high speed.

Page 12: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 12

Circuit Switching: AssessmentAdvantages:• Can carry very high volume messages efficiently.• Works for both analogue and digital messages

Disadvantages• It takes resources to establish the circuit in the first place, and remove it at the end.• Bandwidth (transmission capacity) is wasted if a transmission comes in bursts.

Page 13: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 13

Packet SwitchingData is split into packets, and a route is found for each packetseparately; packets are reassembled at destination. Only used fordigital data.

e.g. the Interneteach node can contribute toseveral routes; similar ideato multi-taskingA B

X

Y

hostlink node

Page 14: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 14

Packet Switching

e.g. the Interneteach node can contribute toseveral routes; similar ideato multi-taskingA B

X

Y

Data is split into packets, and a route is found for each packetseparately; packets are reassembled at destination. Only used fordigital data.

Page 15: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 15

Packet Switching

e.g. the Interneteach node can contribute toseveral routes; similar ideato multi-taskingA B

X

Y

Data is split into packets, and a route is found for each packetseparately; packets are reassembled at destination. Only used fordigital data.

Page 16: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 16

Packet Switching

e.g. the Interneteach node can contribute toseveral routes; similar ideato multi-taskingA B

X

Y

Data is split into packets, and a route is found for each packetseparately; packets are reassembled at destination. Only used fordigital data.

Page 17: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 17

How long have we had large-scale electronic communications

networks?Less than 20 years

Between 20 and 50 years

Between 50 and 100 years

Between 100 and 150 years

More than 150 years

Page 18: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 18

Historical Networks1843 Telegraph connection between Washington and Baltimore1861 Transcontinental telegraph in US (using Morse Code)1866 Transatlantic telegraph cable operational1876 Telephone invented1912 Commercial telephone service in UK1927 Commercial transatlantic telephone service 1965 First computer network, using telephone lines (California)1969 ARPANET, the origin of the internet1986 Telecom Gold: email service via dialup connections (UK)

Page 19: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 19

Client-Server SystemsA very common design for distributed applications is the client-serverarchitecture.

The idea:• the server is able to provide services to clients. The server responds to requests from clients.• a client makes use of these services to accomplish some task.

Examples:• a web browser acts as a client of web servers• an email application acts as a client of an email server• any application can act as a client of a printer server• in a networked file system, individual computers are clients

The client is in control.

Page 20: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 20

Client-Server SystemsUsually the client and the server are at different places on the network.Think of them as two different computers (actually, each is anapplication running on a computer).

client

server

client client

Many clients may use the same server(this is the whole point!). network

A particular application may be a clientof several different types of server(e.g. printing from a web browser), or aclient of several different servers of the same type(e.g. browsing different web sites).

Page 21: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 21

Client-Server SystemsAn application may be both a client and a server.

Example: proxy web server

client serverproxy

client sends requeststo server, which areintercepted by theproxy server

proxy server respondsusing local data if possible,otherwise passes on the requeststo the server

Page 22: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 22

ProtocolsIn order to communicate effectively, there must be standardconventions about:• possible types of message• the precise format and meaning of each message• situations in which messages are sent

A protocol is a set of conventions for a particular area of networking.

Examples:• protocols used by distributed applications, e.g. HTTP, FTP, …• protocols used for detailed routing of packets between nodes

Page 23: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 23

Local Area NetworksIn the 1960s and 1970s, multi-user computing was based on a centralmainframe or minicomputer with a number of terminals directlyconnected to it by wires.

mainframe

terminalterminal terminal

The terminals had minimal computing power.

Page 24: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 24

Local Area NetworksPersonal computers became widespread during the 1980s. An officefull of independent computers makes it difficult to share resources(e.g. printers) and data, so networking was an obvious and necessarydevelopment (many ideas go back to the 1970s).

How best to organise the connections between computers?

One idea: point-to-point connections

some benefits, but a huge drawbackis the number of connections needed

Exercise: how many point-to-point connections are needed for N points?

Page 25: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 25

Point-to-Point ConnectionsIf there are N points in the network then the number of point-to-pointconnections is N(N-1)/2.

This means a large amount of wiring for networks of a reasonablesize, and makes it awkward to add new points.

Page 26: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 26

Local Area NetworksInstead of point-to-point connections, LANs are based on cheaper (lesswiring) interconnection schemes, and broadcasting. Every computerreceives every message, but discards all the messages which are notaddressed to it. (The details are handled by the hardware: a networkedapplication is only aware of relevant messages.)

There is a variety of LAN technologies which use different networkstructures or topologies: (also, extensions and variations of these)

star ring bus

Page 27: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 27

Local Area NetworksBroadcasting means that all hosts are sharing the transmission medium.Data is organised into packets, so that long messages do not hog theresource.

Networked computers must be named, so that messages can be sent tothe correct destination. There are three naming systems (in the Internetas well as in LANs): hardware addresses (48 bit numbers), IP addresses(32 bit numbers), host names (e.g. www.dcs.gla.ac.uk).

LANs generally involve relatively small numbers of computers in alocal area (of course!) such as a single building.

Page 28: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 28

Local Area NetworksAn obvious potential problem with broadcasting is: what happens iftwo or more computers broadcast at the same time? This must beavoided.

Also, in configurations other than a bus topology (where all computersare connected to a single wire), how does the broadcast happen?

Let’s have a brief look at two systems: Ethernet (a bus topology) andtoken rings.

Page 29: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 29

EthernetEthernet is a widely used LANtechnology based on a bus topology.Only one computer can transmit data ata time (otherwise there would beelectrical conflicts).

Each computer is able to detect collisions when transmitting. If acollision occurs, each sender waits for a random time (up to 10ms, say)before trying again. If there is a second collision, the upper bound forthe random delay is doubled (and so on, for subsequent collisions).

This is called binary exponential backoff. It is handled by the networkinterface hardware.

Page 30: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 30

Ethernet Broadcasting

A B C D E

A wants to send a message to B

Page 31: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 31

Ethernet Broadcasting

A B C D E

A wants to send a message to B

A broadcasts the message

Page 32: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 32

Ethernet Broadcasting

A B C D E

A wants to send a message to B

A broadcasts the message

B keeps the message; everyone else ignores it

Page 33: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 33

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

Page 34: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 34

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

collision!

Page 35: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 35

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

Page 36: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 36

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 1ms

Page 37: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 37

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 2ms

Page 38: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 38

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 3ms

Page 39: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 39

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 4ms

Page 40: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 40

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 5ms

Page 41: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 41

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

A and C each choose a random delay between 0 and 10 milliseconds.After waiting, they try again: suppose A waits 2ms and C waits 5ms.

time = 6ms

Page 42: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 42

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

If A and C both chose the same delay, say 3ms, a collision occursagain.

Page 43: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 43

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

If A and C both chose the same delay, say 3ms, a collision occursagain.

time = 1ms

Page 44: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 44

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

If A and C both chose the same delay, say 3ms, a collision occursagain.

time = 2ms

Page 45: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 45

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

If A and C both chose the same delay, say 3ms, a collision occursagain.

time = 3ms

Page 46: CS1Q Computer Systems Lecture 16 Simon Gay. Lecture 16CS1Q Computer Systems - Simon Gay2 Where we are Global computing: the Internet Networks and distributed.

Lecture 16 CS1Q Computer Systems - Simon Gay 46

Ethernet Broadcasting

A B C D E

If A tries to send to B, and C tries to send to D at the same time:

An electrical conflict arises, which A and C can detect.

If A and C both chose the same delay, say 3ms, a collision occursagain.

They must both choose another delay, this time between 0 and 20ms,making it more likely that the delays will be different.