1 / 15

Application Layer and Client-Server Model

CLIENT-SERVER MODEL CONCURRENCY PROCESSES. Chapter 15. Application Layer and Client-Server Model. Comparison between OSI and TCP/IP. 15.1 Client-server model. To make any use of the Internet, application programs should run on the two endpoints of a network connection.

utter
Download Presentation

Application Layer and Client-Server Model

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CLIENT-SERVER MODEL • CONCURRENCY • PROCESSES Chapter 15 Application LayerandClient-Server Model

  2. Comparison between OSI and TCP/IP

  3. 15.1 Client-server model • To make any use of the Internet, application programs should run on the two endpoints of a network connection. • The applications are the entities that communicate with each other to exchange services • “Client” applications request service • “Server” applications provide service.

  4. Client-Server Relationship: Many-to-One • Servers • Run all the time (i.e. infinite) • Provide service to any client • Typically specialize in providing a certain type of service, e.g. Mail. • Listen to a well-known port and passively open connection. • Clients • Run when needed, then terminate (i.e. finite) • Actively Open TCP or UDP connection with Server’s socket.

  5. 15.1 Concurrency • Operation mode could be either iterative or concurrent. • In clients: • Iterative mode: One client at-a-time in serial • Concurrent mode: Several clients run at the same time • In servers: • Iterative mode: serve one client at-a-time (clients wait in a queue) • Concurrent mode: serve multiple clients concurrently and independently. • In addition, servers could chose the Transport layer protocol: • UDP, i.e. connectionless • TCP, i.e. connection-oriented

  6. Server typesTransport Protocol Operation Mode

  7. Connectionless iterative server • Clients’ request arrive inside UDP datagrams and wait in a queue for the server • Server processes one datagram at-a-time, send response back to client inside a UDP datagram • Clients use ephemeral UDP ports • Server uses one well-known UDP port at which all clients’ requests arrive

  8. Connection-Oriented Concurrent Server • Requests and responses are streams of data spanning several segments. • Parent Server passively opens the well-know port to listen for incoming connection requests • Once opened, connections now use ephemeral ports between one client and one Child Server.

  9. 15.3 Programs and Processes • Program: code on disk • Process: a running instance of a program. • Process Control Block: • ProcessID, UserID, Program Name. • Where is the data • Which line will execute next • Figure shows two processes of the same program.

  10. The Process ID & getpid()

  11. Process Creation & fork() • By Replication • One-Parent needed • After the fork(), both parent and child processes execute the same line, the one after the fork()

  12. A program with two fork functions

  13. Return Value of fork() • In the parent process, fork() returns the processID of the just created child • In the child process, fork() simply returns a 0 (which is not a valid processID) • This way, each of the two identical replica can detect whether it is indeed the original parent, or it is the newly created process.

  14. A program that prints the processIDs of the parent and the child

  15. Example of a server program with parent and child processes • Parent Server listens indefinitely (to the well-know port) for connection requests from clients • Once a client requests a connection, a child server process is created to serve this client (on an ephemeral port) • The parent server continues to listen for more clients

More Related