lecture2
DESCRIPTION
Network principles for IT1 CourseTRANSCRIPT
![Page 1: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/1.jpg)
Networking Principles
IT1 Course SlideIT1 Course Slide
Instructor:
Majid Taghiloo
![Page 2: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/2.jpg)
FunctionalityFunctionality
• Transport layer and layers belowB i i ti– Basic communication
– Reliability
• Application layer– Abstractions
• Files• Services• Databases
– Names
2
![Page 3: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/3.jpg)
Dichotomy of DutiesDichotomy of Duties
• Network– Transfers bits
– Operates at application’s requestOperates at application s request
• Applications determine– What to send
– When to send
– Where to send
– Meaning of bits
3
Meaning of bits
![Page 4: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/4.jpg)
Important PointImportant Point
Although an internet system provides a basic communication service, the protocol , psoftware cannot initiate contact with, or accept contact from, a remote computer. p f , pInstead, two application programs must participate in any communication: oneparticipate in any communication: one application initiates communication and the other accepts it.the other accepts it.
4
![Page 5: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/5.jpg)
How Two Application Programs Make Contact
• One application– Begins execution firstg
– Waits passively at prearranged location
A th li ti• Another application– Begins execution later
– Actively contacts first program
• Called client‐server interaction• Called client‐server interaction
5
![Page 6: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/6.jpg)
Client Server ParadigmClient‐Server Paradigm
• Used by all network applications
• Passive program called a serverPassive program called a server
• Active program called a client
6
![Page 7: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/7.jpg)
Internet CommunicationInternet Communication
All network applications use a form of communication known as the client‐server paradigm. A server application waits passively for contact, while a client p y f ,application initiates communication actively.actively.
7
![Page 8: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/8.jpg)
Characteristics of a ClientCharacteristics of a Client
• Arbitrary application program
• Becomes client temporarilyBecomes client temporarily
• Can also perform other computations
• Invoked directly by user
• Runs locally on user’s computerRuns locally on user s computer
• Actively initiates contact with a server
• Contacts one server at a time
8
![Page 9: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/9.jpg)
Characteristics of a ServerCharacteristics of a Server
• Special‐purpose, privileged program
• Dedicated to providing one service
• Can handle multiple remote clients simultaneously
• Invoked automatically when system bootsy y
• Executes forever
• Needs powerful computer and operating systemNeeds powerful computer and operating system
• Waits passively for client contact
• Accepts requests from arbitrary clients• Accepts requests from arbitrary clients
9
![Page 10: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/10.jpg)
TerminologyTerminology
• Server– An executing program that accepts contact over g p g p
the network
• Server class computer• Server‐class computer– Hardware sufficient to execute a server
• Informally– Term server often applied to computerTerm server often applied to computer
10
![Page 11: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/11.jpg)
Direction of Data FlowDirection of Data Flow
fl• Data can flow– From client to server only– From server to client only– In both directions
• Application protocol determines flow• Typical scenario• Typical scenario
– Client sends request(s)– Sever sends response(s)
11
![Page 12: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/12.jpg)
Key IdeaKey Idea
Although the client initiates contact, information can flow in either or bothinformation can flow in either or both directions between a client and server. Many services arrange for the client to send one or more requests and the server to return one response for each request.
12
![Page 13: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/13.jpg)
Clients Servers and Other ProtocolsClients, Servers, and Other Protocols
•Clients and servers are application programs
13
![Page 14: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/14.jpg)
Server CPU UseServer CPU Use
• Facts– Server operates like other applications
• Uses CPU to execute instructions• Performs I/O operations
– Waiting for data to arrive over a network does not require CPU time
• Consequence– Server program only uses CPU when servicing a p g y g
request
14
![Page 15: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/15.jpg)
Multiple ServicesMultiple Services
• Can have multiple servers on single computer
• Servers only use processor when handling aServers only use processor when handling a request
P f l h d i d h dl• Powerful hardware required to handle many services simultaneously
15
![Page 16: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/16.jpg)
Illustration of Multiple ServersIllustration of Multiple Servers
• Each server offers one service• Each server offers one service• One server can handle multiple clients
16
![Page 17: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/17.jpg)
Identifying a ServiceIdentifying a Service
l b d• Protocol port number used• Each service given unique port number, Pg q p• Server
– Informs OS it is using port P– Informs OS it is using port P– Waits for requests to arrive
Cli• Client– Forms request– Send request to port P on server computer
17
![Page 18: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/18.jpg)
The Point About PortsThe Point About Ports
Transport protocols assign each service a unique port identifier A server must specifyunique port identifier. A server must specify the identifier when it begins execution. A client must specify the identifier when itclient must specify the identifier when it requests transport protocol software to contact a server. Protocol software on the server computer uses the identifier to direct an incoming request to the correct server.
18
![Page 19: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/19.jpg)
In TheoryIn Theory
• Port numbers are merely integers
• Any server could use any port numberAny server could use any port number
19
![Page 20: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/20.jpg)
In PracticeIn Practice
P t l t b d i• Protocol port numbers used as service identifiers
• Need uniform numbering• Need uniform numbering– To allow arbitrary client to contact server on
arbitrary machinearbitrary machine– To avoid inventing “directory assistance”
mechanism• Port numbers
– Uniform throughout Internet– Set by standards bodies
20
![Page 21: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/21.jpg)
TerminologyTerminology
• Sequential program– Typical of most programsyp p g
– Single thread of control
C t• Concurrent program– Multiple threads of control
– Execution proceeds “in parallel”
– More difficult to createMore difficult to create
21
![Page 22: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/22.jpg)
Servers and ConcurrencyServers and Concurrency
• Sequential server– Also called iterative
– Handles one request at a time
C t• Concurrent server– Can handle multiple requests at a time
– No waiting
22
![Page 23: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/23.jpg)
Delay in ServersDelay in Servers
• Concurrent server– Server creates new thread of control to handle each request
– Client only waits for its request to be processed
• Sequential server– Client waits for all previous requests to be processed as well
f it t t b das for its request to be processed
– Unacceptable to user if long request blocks short requests
23
![Page 24: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/24.jpg)
Concurrency in ServersConcurrency in Servers
Concurrent execution is fundamental to servers because concurrency permitsservers because concurrency permits multiple clients to obtain a given service without having to wait for the server towithout having to wait for the server to finish previous requests. In a concurrent server, the main server thread creates a new service thread to handle each client.
24
![Page 25: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/25.jpg)
Protocol Ports and Concurrent ServersProtocol Ports and Concurrent Servers
• Apparent problem– One port number assigned to each servicep g
– Concurrent server has multiple copies (threads) runningrunning
– Client and server may interact
’ b d li d– Messages sent to server’s port must be delivered to correct copy
25
![Page 26: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/26.jpg)
Protocol Ports and Concurrent Servers (continued)
l i bl i f i b• Solution to problem: use information about client as well as server to deliver incoming packets
• TCP uses four items to identify connectiony– Server’s IP address– Server’s protocol port numberServer s protocol port number– Client’s IP address
Client’s protocol port number– Client s protocol port number
26
![Page 27: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/27.jpg)
Demultiplexing in a Concurrent ServerDemultiplexing in a Concurrent Server
Transport protocols assign an identifier toTransport protocols assign an identifier to each client as well as to each service. Protocol software on the server’s machineProtocol software on the server s machine uses the combination of client and server identifiers to choose the correct copy of aidentifiers to choose the correct copy of a concurrent server.
27
![Page 28: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/28.jpg)
Variations on a ThemeVariations on a Theme
• A server can use– Connectionless transport (UDP)– Connection‐oriented transport (TCP)– Both for a single serviceg
• A single server can offer multiple servicesOften used for “trivial” services– Often used for trivial services
– Server uses multiple port numbers simultaneously
28
![Page 29: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/29.jpg)
Variations on a Theme (cont)Variations on a Theme (cont)
• A server can– Maintain interaction with a client for days or hoursy
– Send a short response and terminate interaction
Perform I/O on the local computer– Perform I/O on the local computer
– Become a client for another service (potential l bl )cycle problem)
29
![Page 30: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/30.jpg)
Example of CircularityExample of Circularity
i• Time server– Returns time of day
• File server– Allows client to read or write a fileAllows client to read or write a file– Calls time server when generating time stamp for
filefile
• Suppose programmer modifies time server to log requests to a filelog requests to a file
30
![Page 31: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/31.jpg)
Interacting with Protocol Softwareg
• Client or server uses transport protocols
• Protocol software inside OS• Protocol software inside OS
• Applications outside OS
• Mechanism needed to bridge the two– Called Application Program Interface (API)Called Application Program Interface (API)
31
![Page 32: Lecture2](https://reader034.vdocuments.net/reader034/viewer/2022042813/54901b6eb47959515c8b45d8/html5/thumbnails/32.jpg)
Application Program InterfaceApplication Program Interface
• Part of operating system
• Permits application to use protocolsPermits application to use protocols
• Defines– Operations allowed
– Arguments for each operationg p
32