56
Distributed Computing Systems Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Dr. Sunny Jeong & Mr. M.H. Park Operating Systems: Internals and Design Principles, 6/E William Stallings Distributed system, 2nd Andrew S Tanenbaum

Distributed Computing Systems Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Dr. Sunny Jeong & Mr. M.H. Park Operating Systems: Internals and

Embed Size (px)

Citation preview

Distributed Computing Systems

Dave BremerOtago Polytechnic, N.Z.

©2008, Prentice Hall

Dr. Sunny Jeong & Mr. M.H. Park

Operating Systems:Internals and Design Principles, 6/E

William Stallings

Distributed system, 2ndAndrew S Tanenbaum

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

Process Migration

• Transfer of sufficient amount of the state of a process from one computer to another

• The process executes on the target machine

Motivation

• Load sharing– Move processes from heavily loaded to lightly

load systems

• Communications performance– Processes that interact intensively can be

moved to the same node to reduce communications cost

– May be better to move process to the data than vice versa

Motivation

• Availability– Long-running process may need to move

because of faults or down time

• Utilizing special capabilities– Process can take advantage of unique

hardware or software capabilities

Initiation of Migration

• Operating system– When goal is load balancing

• Process– When goal is to reach a particular resource

What is Migrated?

• Must destroy the process on the source system and create it on the target system

• Process image and process control block and any links must be moved

Example of Process Migration

Example of Process Migration

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 application-level 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

Middleware Overview• 1970s

– By Socket Programming

• 1980s-90s– By RPC (Remote Procedure Call)

RPC on DCERPC on DCOM

• 1990s – 2000s– By ROI (Remote Object Invocation)

ORB on CORBA PlatformRMI on Java PlatformRemote on .NET PlatformNew web mechanism

Network Computing

Distributed Computing

Distributed Computing Systems

Data

Client Backed Server

Data

Front Server

ClientServer

Server

Data Data

Distributed Computing Systems

Data

Client Server

Data

Data

Data

ProxyProxy

Data

Client-Server Systems

• Logical and physical architecture

Data Layer(D)Data Layer(D)

ProcessingLayer(P)

ProcessingLayer(P)

User Layer(U)User Layer(U)

Logical Layer

D, P, UIn the

Machine

D, P, UIn the

Machine

1 Tier

D inMachine

Two

D inMachine

Two

P, UIn

MachineOne

P, UIn

MachineOne

2 Tier

D inMachine

Three

D inMachine

Three

3 Tier

P inMachine

Two

P inMachine

Two

U inMachine

One

U inMachine

One

Client-Server Systems

• 2 Tier Architecture

a) RemotePresentation

Data

ApplicationProgram

User Interface

b) DistributedPresentation

Data

User Interface

ApplicationProgram

User Interface

c) DistributedProgram

Data

ApplicationProgram

ApplicationProgram

User Interface

Data

d) RemoteData

ApplicationProgram

User Interface

Data

e) DistributedData

ApplicationProgram

Data

User Interface

Client-Server Systems

• 3 Tier Architecture

Data

ApplicationProgram

User Interface

Data Data Data

Data

Data

ApplicationProgram

ApplicationProgram

ApplicationProgram

ApplicationProgram Application

Program

ApplicationProgram

ApplicationProgram

User InterfaceUser InterfaceUser 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

Client middleware

LocalService

NetworkService

Server Process

ServerMiddleware

LocalService

NetworkService

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, message-oriented 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

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.

NetworkAspect of users

middleware middleware middleware middleware

USER Application Application user

Middleware – software layer Components of Middleware

Applications

CORBA, RMI, RPC and events…

Request reply protocol

External data representation

Operating Systems

30

Software Layers

Computer and network (TCP.UDP/IP). hardware

Operating system

Middleware( CORBA, Java RMI, Web service, DCOM, RD-ODP)

Open (distributed) services

Platform(green part)

applications

language and run-timesupport for program

Interactions

conventionaland

distributedapplications

responsible for basic localresource management

(memory allocation/protection,process creation and

scheduling, local inter-processcommunication and peripheral

devices handling)

extended servicesavailable to those of

the distributed system

Socket – Definition• allows communications between

hosts or between processes on one computer, using the concept of an Internet socket. It can work with many different I/O devices and drivers, although support for these depends on the operating-system implementation.

– Characteristics• Berkeley, California ,UNIX• open/read/write/close Mechanisms

– Operation• Making a pair and one process send

message to the other• The message might be stay in Queue

and wait for the System call사용자와 네트워크 사이의 인터페이스

32

Socktet - TCP • TCP server procedure

① 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.④ ⑤

32

socket()socket()

bind()bind()

listen()listen()

accept()accept()

recv()recv()

send()send()

closesocket()closesocket()

TCP Server TCP Client

Socktet - UDP• UDP Client method procedure

① socket() generates a socket..

② sendto(), recvfrom() communicate with server, data transfer methods

③ closesocket() Closes the socket

UDP 서버 UDP 클라이언트

socket()socket()

bind()bind()

recvfrom()recvfrom()

sendto()sendto()

closesocket()closesocket()

JAVA RMI – Definition

• RMI (Remote Method Invocation) allows a Java program to invoke a method that is being executed on a remote machine

– 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 • Transport layer

– Path the marshaled stream

Transport Layer

Remote Reference Layer

Stub Skeleton

Client Server

JAVA RMI

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 Tools

36

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

⑦ Activate rmiregistry⑧ Run the programs

% rmic Classname

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 SystemDesign 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