Download presentation
Presentation is loading. Please wait.
1
Boots Cassel Villanova University
Computer Networks Boots Cassel Villanova University
2
Client - Server Computing
Direction of initiation determines which side is which Client initiates Server responds Same system may be client and server
3
Parameterization of clients
Parameter specifies machine where server resides Optional parameter specifies the port where the server listens Include the port number parameter in defining clients Especially useful for testing new versions
4
Addressing Specify the machine Specify the port number
name gets converted to IP address Specify the port number Which running process to connect to.
5
How do you know Which machine Which port
you have to know the name or the IP address of the partner Names get converted by a Domain Name Service Which port Common services have assigned port numbers telnet = 23, http = 80, etc.
6
Domain Name Service Structure of Internet Names
gadget.netlab.csc.villanova.edu Lookup in order from right to left netlab and csc are both entries in the villanova DNS, so that lookup can go directly from villanova to netlab without using the csc DNS That is always an option in configuring the servers
7
DNS - Christie’s table ; Addresses for the canonical names ;
localhost.netlab.csc.villanova.edu. IN A christie.netlab.csc.villanova.edu IN A doyle.netlab.csc.villanova.edu IN A gadget.netlab.csc.villanova.edu IN A missmarple.netlab.csc.villanova.edu. IN A lordpeter.netlab.csc.villanova.edu. IN A poirot.netlab.csc.villanova.edu IN A koko.netlab.csc.villanova.edu IN A sherlock.netlab.csc.villanova.edu IN A cadfael.netlab.csc.villanova.edu IN A columbo.netlab.csc.villanova.edu IN A weber.netlab.csc.villanova.edu IN A matlock.netlab.csc.villanova.edu IN A samspade.netlab.csc.villanova.edu IN A poe.netlab.csc.villanova.edu IN A
8
Port number usage Some implementations do not allow the user to specify a port number uses the protocol’s reserved number only Allowing a port number to be specified makes it easier to test the implementation allow the “real” version to run while testing a different version
9
Server Usually runs in privileged condition Responsibilities
needs to access protected resources be careful about what access it gives to clients Responsibilities Authenticate client identity Enforce authorization restrictions Data protection: security and privacy Protection: system resources from abuse
10
Connectionless vs Connection-oriented
Directly related to the choice of transport protocol UDP: connectionless TCP: connection-oriented Can build connection-oriented client/server application over a connectionless transport layer Silly to do the converse
11
Server state Stateless server Stateful server
no memory of past interaction each request must be fully qualified Stateful server records state information reduces needed content in subsequent messages depends on reliable network communication vulnerable to system failures, reboots
12
Idempotent operations
An operation that always yields the same result, regardless of repetition or missing prior steps READ or WRITE, without automatic increment of pointer not idempotent - increment, add amount to total, etc.
13
Concurrent processes Multiprogramming Multiprocessing
Apparent simultaneous execution Multiprocessing Real simultaneous execution
14
Server Concurrency Need to serve requests from multiple clients
Process Fundamental unit of computation Address space plus at least one thread of execution instruction pointer tells where in the process the thread is currently executing
15
Threads Similar to a process except
a thread is owned by a process a thread may share common resources belonging to a process A thread has a private copy of local variables
16
Concurrent processes In a uniprocessor system
Each process gets a slice of the CPU time in turn All appear to run at the same time If each process has only one thread of execution, that process shares the CPU with other processes on a time sharing plan If a process has more than one thread, the CPU time is divided among the threads. OS varies: divide time among all threads or divide among processes and multiple threads share the time allotted to their parent process In a multiprocessor system, each process or thread may be allocated a separate CPU
17
Threads in servers A process may respond to client requests by spawning a separate thread for each client Clients appear to be served simultaneously but actually receive intermingled slices of the CPU time.
18
Unix concurrency Different operating systems handle concurrency in idfferent ways unix: fork() creates an exact copy of the calling process and continues execution from exactly the same place in the code. Copy includes the stack showing function calls, local and global variables Original and forked process continue from the same point in execution One distinction: fork returns a value: new process returns 0, original returns non zero value
19
Unix concurrency example
Sum = 0; pid = fork(); if (pid != 0 ) { /* original */ printf (“The original process\n”); }else { /* the new process */ printf (“The new process\n”);
20
Concurrency in Windows
_beginthread parameter specifies what is to be executed Not necessarily executing the same code as the calling process
21
Sockets A de facto standard interface to TCP/IP protocols
Defined in BSD unix Adapted by other operating systems
22
Initiating concurrent subprocesses
Windows: _beginthread parameter specifies what to execute as thread unix fork new process is a copy of the initiating process pid identifies each
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.