Chapter 16 Client/Server Computing

Download Report

Transcript Chapter 16 Client/Server Computing

Operating Systems:
Internals and Design Principles, 6/E
William Stallings
Distributed Computing
Systems
Dr. Sunny Jeong & Mike Huang
Dave Bremer
Otago Polytechnic, N.Z.
©2008, Prentice Hall
Roadmap
• Distributed Computing Introduction
•
•
•
•
Client/Server Computing
Distributed message passing
Remote Procedure Calls
Clusters
Traditional
Data Processing
• Traditionally data processing was
centralised
• Typically involving centralised
– Computers
– Processing
– Data
Distributed
Data Processing
• Distributed Data Processing (DDP)
departs from the centralised model in one
or multiple ways.
• Usually smaller computers, are dispersed
throughout an organization.
• May involve central node with satellites, or
be a dispersed peer to peer approach
– Interconnection is usually required
Advantages of DDP
•
•
•
•
•
•
Responsiveness
Availability
Resource Sharing
Incremental growth
Increased user involvement and control
End-user productivity
Roadmap
• Distributed Computing Introduction
• Client/Server Computing
• Distributed message passing
• Remote Procedure Calls
• Clusters
Client/Server
Computing
• Client machines are generally single-user
workstations providing a user-friendly
interface to the end user
• Each server provides a set of shared
services to the clients
– enables many clients to share access to the
same database
– enables the use of a high-performance
computer system to manage the database
Client/Server
Terminology
Generic Client/Server
Environment
Client/Server Applications
• The key feature of a client/server
architecture is the allocation of applicationlevel tasks between clients and servers.
• Hardware and the operating systems of
client and server may differ
– These lower-level differences are irrelevant as
long as a client and server share the same
communications protocols and support the
same applications
Generic Client/Server
Architecture
Client/Server
Applications
• Bulk of applications software executes on
the server
• Application logic is located at the client
• Presentation services in the client
Database Applications
• The server is a database server
– Most common family of client/server
applications
• Interaction is in the form of transactions
– the client makes a database request and
receives a database response from server
• Server is responsible for maintaining the
database
Architecture
for Database Applications
Client/Server
Database Usage
Client/Server
Database Usage
Classes of
Client/Server Architecture
• A spectrum of implementations exist.
• Four general classes are:
– Host-based processing
– Server-based processing
– Cooperative processing
– Client-based processing
Host-based processing
• Not true client/server computing
– Traditional mainframe environment
– all or virtually all of the processing is done on
a central host.
Server-based
processing
• Server does all the processing
• Client provides a graphical user interface
Client-based processing
• All application processing done at the
client
• Data validation routines and other
database logic functions are done at the
server
Cooperative processing
• Application processing is performed in an
optimized fashion
• Complex to set up and maintain
• Offers greater productivity and efficiency
Three-tier
Client/Server Architecture
• Application software distributed among
three types of machines
– User machine
• Thin client
– Middle-tier server
• Gateway
• Convert protocols
• Merge/integrate results from different data sources
– Backend server
Three-tier
Client/Server Architecture
File Cache Consistency
• File caches hold recently accessed file
records
• Caches are consistent when they contain
exact copies for remote data
• File-locking prevents simultaneous access
to a file
Distributed File
Caching in Sprite
Middleware Overview
•
•
•
•
1970s
– By Socket Programming
1980s
– By RPC (Remote Procedure Call)
RPC on DCE
RPC on DCOM
1990s
– By ROI (Remote Object Invocation)
ORB on CORBA Platform
RMI on Java Platform
Remote on .NET Platform
2000s
– By Web Service
Web Service on Java Platform
Web Service on .NET Platform
Web Service on Linux
Network Computing
Distributed Computing
Distributed Computing Systems
Data
Data
Front Server
Client
Data
Server
Backed Server
Data
Client
Server
Distributed Computing Systems
Data
Proxy
Data
Server
Client
Data
Client-Server Systems
a) Remote
Presentation
b) Distributed
Presentation
c) Distributed
Program
Data
Data
Data
Application
Program
Application
Program
Application
Program
d) Remote
Data
Data
e) Distributed
Data
Data
User Interface
Data
User Interface
•
User Interface
Application
Program
Application
Program
Application
Program
User Interface
User Interface
User Interface
2 Tier Architecture
Client-Server Systems
Data
Data
Data
Application
Program
Application
Program
Application
Program
Application
Program
Application
Program
Application
Program
User Interface
User Interface
• 3 Tier Architecture
Data
User Interface
Data
Application
Program
Data
Application
Program
User Interface
•
Client-Server
Systems
Client/Server Service
– Client and Server doing their jobs
– Between Client and Server, they communicate with
messages (without global variable )
• Characteristics
– Message exchanging is an interaction between Client and
Server
– Processes of Client and Server exist on other computers.
Client Process
Server Process
Client middleware
Server
Middleware
Local
Service
Network
Service
Local
Service
Network
Service
Middleware
• Definition
software layer that lies between the operating system and the applications on each
site of the system.
– Stimulated by the growth of network-based applications, middleware
technologies are taking an increasing importance. They cover a wide range of
software systems, including distributed objects and components, messageoriented communication, and mobile application support.
• Examples
– ftp, E-mail
– Web browsers
– Database drivers and gateways
– OSF’s DCE (Distributed Computing Environment)
– OMG’s CORBA (Common Object Request Broker Architecture)
Middleware
• Set of tools that provide a uniform means
and style of access to system resources
across all platforms
• Enable programmers to build applications
that look and feel the same
• Enable programmers to use the same
method to access data
Middleware
USER
Application
Application
user
middleware
middleware
middleware
middleware
Network
Aspect of users
Roles Components of Middleware
– to make application development easier, by providing common
programming abstractions, by masking the heterogeneity and the
distribution of the underlying hardware and operating systems, and by
hiding low-level programming details.
Middleware – software layer
Components of Middleware
Applications
CORBA, RMI, RPC and events…
Request reply protocol
External data representation
Operating Systems
Software Layers
language and run-time
support for program
Interactions
conventional
and
distributed
applications
applications
extended services
available to those of
the distributed system
Open (distributed) services
Middleware( CORBA, Java RMI, Web service, DCOM, RD-ODP)
responsible for basic local
Operating system
resource management
(memory allocation/protection,
process creation and
scheduling, local inter-process
communication and peripheral
devices handling)
Computer and network (TCP.UDP/IP). hardware
Platform(green part)
36
Socktet - TCP
•
TCP server procedure
TCP Server
TCP Client
socket()
① socket() generates a socket.
② Bind() local IP and port
determined. Listen() Change TCP
state to LISTENING.
③ Accept() another socket generate
for the client (remote ip and port
determined)
④ Send(), recv() after sending &
receiving data, closesocket() Close
the socket.
⑤ repeat ④~⑤step.
bind()
listen()
accept()
recv()
send()
closesocket()
37
Socktet - UDP
•
UDP Client method procedure
① socket() generates a
socket..
② sendto(), recvfrom()
communicate with server,
data transfer methods
③ closesocket() Closes the
socket
UDP Server
socket()
bind()
recvfrom()
sendto()
closesocket()
UDP Client
– Definition
JAVA RMI
allows a Java program to invoke a
method that is being executed on a remote machine
• RMI (Remote Method Invocation)
– Character
• Transparency Method call
• Support Callback from Server to Client
– Action
• Stub and Skeleton
– Class allow exchanging data between Client and Server
• Remote Reference layer
– Support various hosts in heterogeneous environment
Client
• Transport layer
– Path the marshaled stream
Stub
Server
Skeleton
Remote Reference Layer
Transport Layer
JAVA RMI
• RMI Tools
Tool
Description
rmic
Generate stubs and skeletons for remote objects
rmiregistry
Remote object registry service
rmid
RMI activation system daemon
serialver
Return class serialVersionUID
RMI Program Procedure
①
②
③
④
⑤
⑥
Set a remote interface
Remote interface class
Complete server program
Set a client program to use the remote object
Compile ②,③,④
Create stub and skeleton by rmic
% rmic Classname
⑦ Activate rmiregistry
⑧ Run the programs
41
RMI example
Interface for Server side
import java.rmi.*;
import java.util.Date;
public interface timeServer extends Remote {
public long getTime() throws RemoteException;
}
RMI example
import java.net.*; import java.rmi.*; import java.rmi.registry.*;
import java.rmi.server.UnicastRemoteObject;
public class timeServerImpl extends UnicastRemoteObject implements timeServer {
public timeServerImpl ( ) throws RemoteException {
super( );
}
public long getTime() throws RemoteException {
return System.currentTimeMillis(); //using java.util.Date class ok
}
//but need to convert it to long
public static void main(String[] args) {
try {
LocateRegistry.createRegistry(1099);
timeServerImpl f = new timeServerImpl( );
Naming.rebind("myTimeServer", f);
System.out.println("myTimeServer ready.");
} catch (RemoteException rex) {
System.out.println("Exception in timeServerImpl.main: " + rex);
} catch (MalformedURLException ex) {
System.out.println("MalformedURLException " + ex);
}
}
}
Role of Middleware in
Client/Server Architecture
Logical View
of Middleware
Object-Oriented
Mechanisms
• Clients and servers ship messages back
and forth between objects
• A client sends a request to an object
broker
• The broker calls the appropriate object
and passes along any relevant data
• Examples include Microsoft’s COM and
CORBA
Object Request Broker
Roadmap
•
•
•
•
Distributed Computing Introduction
Client/Server Computing
Distributed message passing
Remote Procedure Calls
• Clusters
Clusters
• Alternative to symmetric multiprocessing
(SMP)
• Group of interconnected, whole computers
working together as a unified computing
resource
– Illusion is one machine
– System can run on its own
Benefits of Clusters
• Absolute Scalability
– Larger than any single device is possible
• Incremental scalability
– System can grow by adding new nodes
• High availability
– Failure of one node is not critical to system
• Superior price/performance
– Using commodity equipment
Cluster Classification
• Numerous approaches to classification.
– Simplest is based on shared disk access
Clustering Methods:
Benefits and Limitations
Clustering Methods:
Benefits and Limitations
Operating System
Design Issues
• Clusters require some enhancements to a
single-system OS.
– Failure Management
– Load Balancing
– Parallelizing Computation
Failure Management
• Highly available cluster offers a high
probability that all resources will be in
service
– No guarantee about the state of partially
executed transactions if failure occurs
• Fault-tolerant cluster ensures that all
resources are always available
• Failover vs. FailBack
Load Balancing
• When new computer added to the cluster,
the load-balancing facility should
automatically include this computer in
scheduling applications
• Middleware must recognize that services
can appear on many different members of
the cluster
Parallelizing Computation
• Parallelizing compiler
– determines, at compile time, which parts of an
application can be executed in parallel.
• Parallelized application
– application written to run on a cluster and
uses message passing to move data,
• Parametric computing
– Algorithm must run many times with different
parameters
Cluster Computer
Architecture
Middleware Services
and Functions
• Single entry point
– User logs onto cluster, not individual server
•
•
•
•
Single file hierarchy
Single control point
Single virtual networking
Single memory space
– Distributed shared memory enables programs
to share variables.
Middleware Services
and Functions (cont.)
•
•
•
•
•
Single job-management system
Single user interface
Single I/O space
Single process space
Checkpointing
– Allowing rollback and recovery
• Process migration
– Enables load balancing
Clusters Compared
to SMP
• SMP is easier to manage and configure,
take up less space and draw less power
• SMP products are well established and
stable
• Clusters are better for incremental and
absolute scalability
• Clusters are superior in terms of
availability