+ All Categories
Home > Documents > Distributed Computing. Distributed Computation Using Files Part 1 Part 2 f1 = open(toPart2, …);...

Distributed Computing. Distributed Computation Using Files Part 1 Part 2 f1 = open(toPart2, …);...

Date post: 21-Dec-2015
Category:
View: 218 times
Download: 1 times
Share this document with a friend
25
Distributed Computing
Transcript

Distributed Computing

Distributed Computation Using Files

Part 1Part 1 Part 2Part 2

f1 = open(toPart2, …);while(…){ write(f1. …);}close(f1);

…f2 = open(toPart1, …);while(…){ write(f2. …);}close(f2);

f2 = open(toPart2, …);while(…){ read(f1, …);}close(f1);

f2 = open(toPart1, …);while(…){ read(f2, …);}close(f2);

Finer Grained Sharing (1)• Distributed computing can be for:

– Speed up (simultaneous execution)– Simplify data management (consistency)

• Last Generation: programming languages (and programmers) do serial computation– Want to share global data– Speed up is a specialist’s domain

• Procedure is basic unit of abstraction– Abstract data type behavior

Finer Grained Sharing (2)• Newer computing model

– Partition into processes/threads– Message passing communication

• New OS & language support– Remote procedures– Remote objects with remote method invocation– Distributed process management– Shared memory– Distributed virtual memory

• … but first, how to partition the computations?

Data Partition

Serial Form

while(…){…}

Distribute DataDistribute Data

Serial Form Serial Form Serial Form

Execute all data streams simultaneously

Functional Partition (1)

Serial Form

A Partition

The Parts

Functional Partition (2)• Software is composed from procedures• All programmers are familiar with procedural

abstraction – exploit procedure model• Allow each function to be a blob• Implement each blob as a process• OS provide network IPC mechanism for serial use

of distributed functions– TCP/IP– Messages– Serial “procedure call” protocol between client and

server

Record Sharing

Part 1Part 1 Part 2Part 2

…while(…){ writeSharedRecord(…); readSharedRecord(…);}…

…while(…){ readSharedRecord(…); writeSharedRecord(…);}…

Message PassingApplication buffer

Kernel buffer

Network packet

DL Frame

Remote Procedure Call

int main(…) { … func(a1, a2, …, an); …}

void func(p1, p2, …, pn) { …}

int main(…) { … func(a1, a2, …, an); …}

void func(p1, p2, …, pn) { …}

Conventional Procedure Call Remote Procedure Call

Conceptual RPC Implementationint main(…) { … func(a1, a2, …, an); …}

void func(p1, p2, …, pn) { …}

…pack(a1, msg);pack(a2, msg);…pack(an, msg);send(rpcServer, msg);// waiting ...result = receive(rpcServer);...

// Initialize the serverwhile(TRUE) { msg = receive(anyClient); unpack(msg, t1); unpack(msg, t2); … unpack(msg, tn); func(t1, t2, …, tn); pack(a1, rtnMsg); pack(a2, rtnMsg); … pack(an, rtnMsg); send(rpcServer, rtnMsg);}

Remote Procedure Callint main(…) { … func(a1, a2, …, an); …}

void func(p1, p2, …, pn) { …}

…pack(a1, msg);pack(a2, msg);…pack(an, msg);send(rpcServer, msg);// waiting ...result = receive(rpcServer);...

// Initialize the serverwhile(TRUE) { msg = receive(anyClient); unpack(msg, t1); unpack(msg, t2); … unpack(msg, tn); func(t1, t2, …, tn); pack(a1, rtnMsg); pack(a2, rtnMsg); … pack(an, rtnMsg); send(rpcServer, rtnMsg);}

Implementing RPC• Syntax of an RPC should look as much like a local

procedure call as possible• Semantics are impossible to duplicate, but they

should also be as close as possible• The remote procedure’s execution environment

will not be the same as a local procedure’s environment– Global variables– Call-by-reference– Side effects– Environment variables

Implementing RPC

int main(…) { … localF(…); … remoteF(…); …}

void localF(…) { … return;}

lookup(remote);pack(…);send(rpcServer, msg);receive(rpcServer);unpack(…);return;

register(remoteF);while(1) { receive(msg); unpack(msg); remoteF(…); pack(rtnMsg); send(theClient,rtnMsg);}

clientStub

main

theClient

void remoteF(…) { … return;}

void register(…) { …}

void lookup(…) { …}

Name Server

rpcServer

Compiling an RPC

• callRemote(remoteF, …);• remoteF(…);

– Compile time– Link time– Dynamic binding

A Partitioned Computation

Serial Form

A Partition

The Parts

Supporting the Computation• Each blob might be a process, thread, or object• Blobs should be able to run on distinct,

interconnected machines• OS must provide mechanisms for:

– Process Management• Control

• Scheduling

• Synchronization

• IPC

– Memory Management• Shared memory

– File Management – remote files

• Distributed OS or cooperating Network OSes?

Control• Remote process/thread create/destroy

• Managing descriptors

• Deadlock

Scheduling• Threads and processes

• Explicit scheduling

• Transparent scheduling

• Migration & load balancing

• Objects– Active vs passive– Address spaces

Synchronization

• Distributed synchronization– No shared memory no semaphores– New approaches use logical clocks & event

ordering

• Transactions– Became a mature technology in DBMS– Multiple operations with a commit or abort

• Concurrency control– Two-phase locking

Traditional Memory Interfaces

ProcessProcess

VirtualMemory

VirtualMemory File

Management

FileManagement

PhysicalMemory

PhysicalMemory

StorageDevices

StorageDevices

Device Interface

Secondary Memory InterfacePrimary Memory Interface

Remote File Services

ProcessProcess

VirtualMemory

VirtualMemory File

Management

FileManagement

PhysicalMemory

PhysicalMemory

StorageDevices

StorageDevices

Secondary Memory InterfacePrimary Memory Interface

Remote DiskClient

Remote DiskClient

Remote DiskServer

Remote DiskServer

Remote FileClient

Remote FileClient

Remote FileServer

Remote FileServer

Distributed Shared Memory

ProcessProcess

FileManagement

FileManagement

Remote Memory Interface

Remote MemoryClient

Remote MemoryClient

Remote MemoryServer

Remote MemoryServer

•Static memory New language•Dynamic memory New OS interface•Low level interface

•Binding across address spaces•Shared memory malloc

•High level interface•Tuples•Objects

Distributed Virtual MemoryProcessProcess

VirtualMemory

VirtualMemory

PhysicalMemory

PhysicalMemory

StorageDevices

StorageDevices

Primary Memory Interface

Remote PagingClient

Remote PagingClient

Remote PagingServer

Remote PagingServer

StorageDevices

StorageDevices

Distributed Objects

ProcessProcess

Object Interface

Remote ObjectClient

Remote ObjectClient

Remote ObjectServer

Remote ObjectServer

Local ObjectsLocal Objects

ProcessProcess

RemoteObject Interface

Remote ObjectClient

Remote ObjectClient

Remote ObjectServer

Remote ObjectServer

Local ObjectsLocal Objects

LocalObject Interface

Performance

e.g. Corba, DCOM,SOAP, …


Recommended