Processes. Communication takes place between processes. But, what’s a process? “A program in execution” Traditional operating systems: concerned with.

Slides:



Advertisements
Similar presentations
CS-495 Distributed Systems Fabián E. Bustamante, Winter 2004 Processes Threads & OS Threads in distributed systems Object servers Code migration Software.
Advertisements

Threads, SMP, and Microkernels
Processes: Code Migration Chapter 3 Will Cameron CSC 8530 Dr. Schragger.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Describe the concept of lightweight process (LWP) and the advantages to using LWPs Lightweight process (LWP) lies in a hybrid form of user-level & kernel-level.
Distributed Systems Architectures
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Threads Clients Servers Code Migration Software Agents Summary
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 31/10/2007.
EECS122 - UCB 1 CS 194: Distributed Systems Processes, Threads, Code Migration Computer Science Division Department of Electrical Engineering and Computer.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
Computer Science Lecture 8, page 1 CS677: Distributed OS Code and Process Migration Motivation How does migration occur? Resource migration Agent-based.
3.5 Interprocess Communication
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
Threads CSCI 444/544 Operating Systems Fall 2008.
Processes After today’s lecture, you are asked to know The basic concept of thread and process. What are the advantages of using multi-threaded client.
EEC-681/781 Distributed Computing Systems Lecture 8 Wenbing Zhao Cleveland State University.
CS 603 Threads, Processes, and Agents March 18, 2002.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
Processes After today’s lecture, you are asked to know The basic concept of thread and process. What are the advantages of using multi-threaded client.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Objectives Thread definitions and relationship to process Multithreading.
Processes After today’s lecture, you are asked to know The basic concept of thread and process. What are the advantages of using multi-threaded client.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Give an example to show the advantages to using multithreaded Clients See page 142 of the core book (Tanebaum 2002).
Lecture 8 Epidemic communication, Server implementation.
Processes.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
Client/Server Architectures
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 12 Slide 1 Distributed Systems Architectures.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Processes, Threads and Virtualization
1 Processes Chapter 3. 2 Processes  Communication takes place between processes. But, what ’ s a process?  “ A program in execution ”  Traditional.
1 Distributed Systems Processes Chapter 3. 2 Course/Slides Credits Note: all course presentations are based on those developed by Andrew S. Tanenbaum.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Computer Science Lecture 8, page 1 CS677: Distributed OS Last Class Threads –User-level, kernel-level, LWPs Multiprocessor Scheduling –Cache affinity –Preemption.
Processes Chapter 3. Table of Contents Multithreading Clients and Servers Code Migration Software Agents (special topic)
Processes Chapter 3. Thread Usage in Nondistributed Systems Context switching as the result of IPC.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
Processes. Processes and threads Process forms a building block in distributed systems Processes granularity is not sufficient for distributed systems.
Code Migration Russell T. Potee, III. Overview Why Code Migration? Code Migration Models Migration and Handling Resources Heterogeneous Systems Migration.
Distributed Systems Principles and Paradigms Chapter 03 Processes 00 – 1.
Computer Science Lecture 7, page 1 CS677: Distributed OS Multiprocessor Scheduling Will consider only shared memory multiprocessor Salient features: –One.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
1 Reasons for Migrating Code The principle of dynamically configuring a client to communicate to a server. The client first fetches the necessary software,
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
M. Accetta, R. Baron, W. Bolosky, D. Golub, R. Rashid, A. Tevanian, and M. Young MACH: A New Kernel Foundation for UNIX Development Presenter: Wei-Lwun.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Acknowledgement: These slides are adapted from slides provided in Thißen & Spaniol's course Distributed Systems and Middleware, RWTH Aachen Processes Distributed.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Threads. Readings r Silberschatz et al : Chapter 4.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Processes, Threads and Virtualization Chapter The role of processes in distributed systems.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes Chapter 3.
Processes and Threads Processes and their scheduling
Chapter 4: Multithreaded Programming
Processes Chapter 3.
Prof. Leonardo Mostarda University of Camerino
Chapter 4: Threads & Concurrency
Processes Chapter 3.
CS510 Operating System Foundations
Processes Chapter 3.
Presentation transcript:

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. There are three main areas of study: 1.Threads (within clients/servers). 2.Process and code migration. 3.Software agents.

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. To achieve acceptable performance in distributed systems, relying on the OS’s idea of a process is often not enough - finer granularity is required. The solution: Threading.

Problems with Processes Creating and managing processes is generally regarded as an expensive task ( fork system call). Making sure all the processes peacefully co-exist on the system is not easy (as concurrency transparency comes at a price). Threads can be thought of as an “execution of a part of a program (in user-space)”. Rather than make the OS responsible for concurrency transparency, it is left to the individual application to manage the creation and scheduling of each thread.

Two Important Implications 1.Threaded applications often run faster than non- threaded applications (as context-switches between kernel and user-space are avoided). 2.Threaded applications are harder to develop (although simple, clean designs can help here). Additionally, the assumption is that the development environment provides a Threads Library for developers to use (most modern environments do).

The Cost of Context-Switches Context switching as the result of IPC (Inter-process communications).

Threads in Non-Distributed Systems Advantages: 1.Blocking can be avoided 2.Excellent support for multi-processor systems (each running their own thread). 3.Expensive context-switches can be avoided. 4.For certain classes of application, the design and implementation is made considerably easier.

Threads in Distributed Systems Important characteristic: a blocking call in a thread does not result in the entire process being blocked. The leads to the key characteristic of threads within distributed systems: “We can now express communications in the form of maintaining multiple logical connections at the same time (as opposed to a single, sequential, blocking process).”

Example: MT Clients and Servers Mutli-Threaded Client: to achieve acceptable levels of perceived performance, it is often necessary to hide communications latencies. Consequently, a requirement exists to start communications while doing something else. Example: modern web browsers. This leads to the notion of “truly parallel streams of data” arriving at a multi-threaded client application.

Example: MT-Servers Although threading is useful on clients, it is much more useful in distributed systems servers. The main idea is to exploit parallelism to attain high performance. A typical design is to organise the server as a single “dispatcher” with multiple threaded “workers”, as diagrammed overleaf.

An Multi-Threaded Server A multithreaded server organized in a dispatcher/worker model.

More on Clients and Servers What’s a client? Definition: “A program which interacts with a human user and a remote server.” Typically, the user interacts with the client via a GUI. Of course, there’s more to clients than simply providing a UI. Remember the multitiered levels of the Client/Server architecture from earlier …

Multitiered Client Architectures

What’s a Server? Definition: “A process that implements a specific service on behalf of a collection of clients”. Typically, servers are organised to do one of two things: 1.Wait 2.Service … wait … service … wait … service … wait …

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). Concurrent: server does not handle the request itself; a separate thread or sub-process handles the request and returns any results to the client; the server is then free to immediately service the next client (i.e., there’s no waiting, as service requests are processed in parallel).

Problem: Identifying “end-points”? How do clients know which end-point (or port) to contact a server at? How do they “bind” to a server? Statically assigned end-points (IANA). Dynamically assigned end-points (DCE). A popular variation: the “super-server” (inetd on UNIX).

Servers: Binding to End-Points a)Client-to-server binding using a daemon (DCE). b)Client-to-server binding using a super-server (inetd on UNIX). 3.7

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. Stateful servers – information is maintained on the current “connections” to the server. Advanced file servers, where copies of a file can be updated “locally” then applied to the main server (as the server knows the state of things). These are more difficult to implement. But, what happens if something crashes? (More on this later).

A Special Type: Object Servers A server tailored to support distributed objects. Does not provide a specific service. Provides a facility whereby objects can be remotely invoked by non-local clients. Consequently, object servers are highly adaptable. “A place where objects live”.

Under certain circumstances, in addition to the usual passing of data, passing code (even while it is executing) can greatly simplify the design of a distributed system. However, code migration can be inefficient and very costly. So, why migrate code? Code Migration

Reasons for Migrating Code Why? Biggest single reason: better performance. The big idea is to move a compute-intensive task from a heavily loaded machine to a lightly loaded machine “on demand” and “as required”.

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. Moving (part of) a server to a client – checking data prior to submitting it to a server. The use of local error-checking (with JavaScript) on webforms is a good example of this type of processing. Error- check the data close to the user, not at the server.

“Classic” Code Migration Example Searching the web by “roaming”. Rather than search and index the web by requesting the transfer of each and every document to the client for processing, the client relocates to each site and indexes the documents it finds “in situ”. The index is then transported from site to site, in addition to the executing process.

Another Big Advantage: Flexibility The principle of dynamically configuring a client to communicate to a server. The client first fetches the necessary software, and then invokes the server. This is a very flexible approach.

Major Disadvantage Security Concerns. “Blindly trusting that the downloaded code implements only the advertised interface while accessing your unprotected hard-disk and does not send the juiciest parts to heaven-knows-where may not always be such a good idea”.

Code Migration Models A running process consists of three “seqments”: 1.Code – instructions. 2.Resource – external references. 3.Execution – current state.

Code Migration Characteristics Weak Mobility: just the code is moved – and it always restarts from its initial state. Eg. Java Applets. Comment: simple implementation, but limited applicability. Strong Mobility: the code and the state is moved – and execution restarts from the next statement. Eg. D’Agents. Comment: very powerful, but hard to implement.

More Characteristics Sender- vs. Receiver-Initiated. Which side of the communication starts the migration? The machine currently executing the code (known as sender-initiated) or The machine that will ultimately execute the code (known as receiver-initiated).

How Does the Migrated Code Run? Another issue surrounds where the migrated code executes: -Within an existing process (possibly as a thread) or -Within it’s own (new) process space. Finally, strong mobility also supports the notion of “remote cloning”: an exact copy of the original process, but now running on a different machine.

The Models of Code Migration

What About Resources? This is tricky. What makes code migration difficult is the requirement to migrate resources. Resources are the external references that a process is currently using, and includes (but is not limited to): Variables, open files, network connections, printers, databases, etc., etc.

Types of Process-to-Resource Binding Strongest: binding-by-identifier (BI) – precisely the referenced resource, and nothing else, has to be migrated. Binding-by-value (BV) – weaker than BI, but only the value of the resource need be migrated. Weakest: binding-by-type (BT) – nothing is migrated, but a resource of a specific type needs to be available after migration (eg, a printer).

More Resource Classification Resources are further distinguished as one of: 1.Unattached: a resource that can be moved easily from machine to machine. 2.Fastened: migration is possible, but at a high cost. 3.Fixed: a resource is bound to a specific machine or environment, and cannot be migrated. Refer to diagram 3-14 in the textbook for a good summary of resource-to-binding characteristics (to find out what to do with which resource when).

Migration in Heterogeneous DS’s Using a migration stack: the principle of maintaining a migration stack to support migration of an execution segment in a heterogeneous environment. Usually requires changes to the programming language and its environment. 3-15

Software Agents What is a software agent? “An autonomous unit capable of performing a task in collaboration with other, possibly remote, agents”. The field of Software Agents is still immature, and much disagreement exists as to how to define what we mean by them. However, a number of types can be identified.

Types of Software Agent Collaborative Agent – also known as “multi-agent systems”, which can work together to achieve a common goal (eg, planning a meeting). Mobile Agent – code that can relocate and continue executing on a remote machine. Interface Agent – software with “learning abilities” (that damned MS paperclip, and the ill-fated “bob”). Information Agent – agents that are designed to collect and process geographically dispersed data and information.

Software Agents in Distributed Systems Some important properties by which different types of agents can be distinguished within the Distributed Systems world. Property Common to all agents? Description AutonomousYesCan act on its own. ReactiveYesResponds timely to changes in its environment. ProactiveYesInitiates actions that affects its environment. CommunicativeYes Can exchange information with users and other agents. ContinuousNoHas a relatively long lifespan. MobileNoCan migrate from one site to another. AdaptiveNoCapable of learning.

Agent Technology - Standards The general model of an agent platform has been standardized by FIPA (The “Foundation for Intelligent Physical Agents”) located at the website. Specifications include: Agent Management Component. Agent Directory Service. Agent Communication Channel. Agent Communication Language.

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).