Professional Documents
Culture Documents
Chen 03
Chen 03
Chapter 3
1
Processes
Communication takes place between processes.
But, what’s a process?
“A program in execution”
Traditional operating systems: concerned with
the “local” management and scheduling of
processes.
Modern distributed systems: a number of other
issues are of equal importance.
2
Introduction to Threads
Modern OSes provide “virtual processors”
within which programs execute.
A programs execution environment is
documentated in the process table and
assigned a PID.
4
Benefits of Threads
A single-thread process
The process as a whole is blocked whenever a blocking
system call is executed.
For example, a spreadsheet program
Multithreading
Becomes possible to exploit parallelism
Useful in the context of large applications
One application, several cooperating programs, each to be
executed by a separate process.
Interprocess communication (IPC) is needed if cooperating
programs are implemented.
When IPC is invoked, it requires changing the memory map
in the MMU, as well as flushing the TLB.
5
Two Important Implications
1. Threaded applications often run faster than non-
threaded applications (as context-switches
between kernel and user-space are avoided).
6
Thread Implementation
Tow approaches to implement a thread package
To construct a thread library that is executed entirely in user
mode
To have the kernel be aware of threads and schedule them
User-level thread
Easy to create and destroy
Creating a thread is primarily determined by the cost for
allocating memory to set up a thread stack.
Destroying a thread involves freeing memory for the stack.
Switching thread context can be done in a few instructions.
Drawbacks:
Encounter a blocking system call (e.g., I/O)
7
Threads in Non-Distributed Systems
Advantages:
8
Threads in Distributed Systems
Important characteristic: a blocking call in a
thread does not result in the entire process
being blocked.
9
Example: MT Clients and Servers
Mutli-Threaded Client: to achieve acceptable levels
of perceived performance, it is often necessary to
hide communications latencies.
10
Example: MT-Servers
Although threading is useful on clients, it is
much more useful in distributed systems
servers.
11
Multi-Threaded Servers (1)
A multithreaded server organized in a dispatcher/worker
model.
12
Multi-Threaded Servers (2)
Model Characteristics
hard to implement
13
More on Clients and Servers
What’s a client?
15
The X-Window System
The basic organization of the X Window
System
16
Client-Side Software for Distribution
Transparency
A possible approach to transparent replication of a
remote object using a client-side solution.
17
What’s a Server?
Definition: “A process that implements a
specific service on behalf of a collection
of clients”.
18
Servers: Iterative and Concurrent
Iterative: server handles request, then
returns results to the client; any new client
requests must wait for previous request to
complete (also useful to think of this type
of server as sequential).
A popular variation:
the “super-server” (inetd on UNIX).
20
Servers: General Design Issues
a) Client-to-server binding using a daemon (DCE)
b) Client-to-server binding using a super-server
(inetd on UNIX)
3.7
21
Server “States”
Stateless servers – no information is maintained on
the current “connections” to the server. The web is
the classic example of a stateless service. As can be
imagined, this type of server is easy to implement.
24
Reasons for Migrating Code
Why?
25
Code Migration Examples
Moving (part of) a client to a server –
processing data close to where the data
resides. It is often too expensive to
transport an entire database to a client for
processing, so move the client to the data.
27
Reasons for Migrating Code
The principle of dynamically configuring a client to communicate to
a server. The client first fetches the necessary software, and then
invokes the server.
28
Major Disadvantage
Security Concerns.
29
Code Migration Models
A running process consists of three
“segments”:
Code Segment – instructions
The part that contains the set of instructions that
make up the program that is being executed.
Resource Segment – external references.
The part that contains references to external
resources needed by the process, such as files,
printers, devices, other processes, and so on.
Execution Segment – current state.
Used to store the current execution state of a
process, consisting of private data, the stack, and
the program counter.
30
Code Migration Characteristics
Weak Mobility: just the code is moved –
and it always restarts from its initial state.
e.g. Java Applets.
Comment: simple implementation, but
limited applicability.
32
How Does the Migrated Code Run?
Another issue surrounds where the
migrated code executes:
34
What About Resources?
This is tricky.
35
Types of Process-to-Resource Binding
Strongest: binding-by-identifier (BI) –
precisely the referenced resource, and
nothing else, has to be migrated.
38
Migration in Heterogeneous
Systems
The principle of maintaining a migration stack to
support migration of an execution segment in a
heterogeneous environment
3-15
39
Software Agents
What is a software agent?
42
Implementation Issues (2)
The parts comprising the state of an agent in D'Agents.
Status Description
Global system variables Return codes, error codes, error strings, etc.
Stack of call frames Stack of activation records, one for each running command
43
Software Agents in Distributed Systems
Common to
Property Description
all agents?
Autonomous Yes Can act on its own
Reactive Yes Responds timely to changes in its environment
Proactive Yes Initiates actions that affects its environment
Communicative Yes Can exchange information with users and other agents
44
Agent Technology
The general model of an agent platform (adapted from
[fipa98-mgt]).
45
Agent Technology - Standards
The general model of an agent platform
has been standardized by FIPA (The
“Foundation for Intelligent Physical
Agents”) located at the
http://www.fipa.org website.
Specifications include:
Agent Management Component.
Agent Directory Service.
Agent Communication Channel.
Agent Communication Language.
46
Agent Communication Languages
(1)
Examples of different message types in the FIPA ACL [fipa98-acl],
giving the purpose of a message, along with the description of the
actual message content.
47
Agent Communication Languages
(2)
Field Value
Purpose INFORM
Sender max@http://fanclub-beatrix.royalty-spotters.nl:7239
Receiver elke@iiop://royalty-watcher.uk:5623
Language Prolog
Ontology genealogy
Content female(beatrix),parent(beatrix,juliana,bernhard)
48
Summary - Processes
Processes play a fundamental role in DS’s.
Threads play a central role in building systems that
don’t BLOCK when performing I/O – key
requirement.
The “classic” process organization model is
client/server, and we looked at the various ways to
organize the client and the server components.
“Object Servers” are a special case.
Processes can migrate from system-to-system: for
performance and flexibility reasons.
Although a simple, and easy to understand, idea,
actually realizing this is not that simple (especially
within heterogeneous environments).
Standards are immature in this area, but are gaining
support within the community (eg, FIPA).
49
Homework Assignment
You are to produce a five page report on GRID COMPUTING.
This is a topic that has generated considerable interest within
both the academic and commercial distributed computing
communities.
Your five page report should answer the following questions
and address the following points:
What is GRID COMPUTING (GC)?
How does GC differ from traditional distributed computing
environments?
Why is GC important?
What type of distributed systems is GC suited to?
Identify three GC environments? What plaforms do they run on?
Is GC just another distributed computing fad?