1 Processes Chapter 3. 2 Processes  Communication takes place between processes. But, what ’ s a process?  “ A program in execution ”  Traditional.

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.
Threads Section 2.2. Introduction to threads A thread (of execution) is a light-weight process –Threads reside within processes. –They share one address.
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.
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.
Processes Chapter 3. Thread Usage in Nondistributed Systems Context switching as the result of IPC –Process: a running program (mgmt. unit of OS) –Thread:
3.5 Interprocess Communication
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.
Processes. Communication takes place between processes. But, what’s a process? “A program in execution” Traditional operating systems: concerned with.
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.
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.
Chapter 3  Processes 1 Processes Chapter 3 Chapter 3  Processes 2 Introduction  A process is a program in execution  For OS important issues are.
1 Processes and Distributed Computing Issues: moving processes around design of server and client processes migration of processes/programs agent programs.
Lecture 8 Epidemic communication, Server implementation.
Processes.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
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 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Kyung Hee University 1/57 Communication Chapter 3.
1 Distributed Systems Processes Chapter 3. 2 Course/Slides Credits Note: all course presentations are based on those developed by Andrew S. Tanenbaum.
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.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes Chapter 3. Processes  OS provides concurrency transparency of multiple processes (sharing CPU, memory)  High price  Process creation  Context.
Processes. Processes and threads Process forms a building block in distributed systems Processes granularity is not sufficient for distributed systems.
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.
Processes Chapter 3. Processes Process: Program in execution. In DSs, more concepts come into consideration, eg. Multi-treading, process migration, code.
Joonwon Lee Process and Address Space.
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,
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
Department of Computer Science and Software Engineering
1 Chapter 3 Processes Dowon Cho (RTMM Lab) & Jongwon Lee (SE Lab)
Acknowledgement: These slides are adapted from slides provided in Thißen & Spaniol's course Distributed Systems and Middleware, RWTH Aachen Processes Distributed.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Threads. Readings r Silberschatz et al : Chapter 4.
Processes, Threads and Virtualization Chapter The role of processes in distributed systems.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Processes Chapter 3. Processes  Process is a program in running state  PROCESSES ARE THE BUILDING BLOCKS OF DISTRIBUTED SYSTEMS, ESPECIALLY IN unix.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes and threads.
Processes Chapter 3.
Processes Chapter 3.
Fast Communication and User Level Parallelism
Threads Chapter 4.
Multithreaded Programming
Chapter 2: Operating-System Structures
Prof. Leonardo Mostarda University of Camerino
Processes Chapter 3.
CS510 Operating System Foundations
Processes Chapter 3.
Chapter 2: Operating-System Structures
Presentation transcript:

1 Processes Chapter 3

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

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

4 Threads  Process A program in execution, or A program is currently being executed on one of the OS ’ s virtual processors.  Process table Entries to CPU register values, memory maps, open files, accounting infor., privileges, etc.  Cost highly Saving CPU context, e.g., register values, program counter, stack pointers, etc. Modify registers of the memory management unit (MMU) Invalidate address translation caches such as in the translation lookaside buffer (TLB) Swapping processes Occupies main memory simultaneously  Thread Thread context consists of nothing more than the CPU context.

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

6 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). 3. Additionally, the assumption is that the development environment provides a Threads Library for developers to use (most modern environments do).

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

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

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

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

11 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 organize the server as a single “ dispatcher ” with multiple threaded “ workers ”, as diagrammed overleaf.

12 Multi-Threaded Servers (1)  A multithreaded server organized in a dispatcher/worker model.

13 Multi-Threaded Servers (2)  Three ways to construct a server. ModelCharacteristics ThreadsParallelism, blocking system calls Single-threaded processNo parallelism, blocking system calls Finite-state machineParallelism, nonblocking system calls hard to implement

14 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 multi- tiered levels of the Client/Server architecture from earlier …

15 Multi-Tiered Client Architectures

16 The X-Window System  The basic organization of the X Window System

17 Client-Side Software for Distribution Transparency  A possible approach to transparent replication of a remote object using a client-side solution.

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

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

20 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, Internet Assigned Numbers Authority). FTP, TCP port 21 HTTP, TCP port 80.  Dynamically assigned end-points (DCE).  A popular variation:  the “ super-server ” (inetd on UNIX).

21 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

22 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, see chapter 7).

23 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 ”.

24 Code Migration  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?

25 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 ”.

26 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 web forms is a good example of this type of processing. Error-check the data close to the user, not at the server.

27 “ 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.

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

29 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 ”.

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

31 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.  Strong Mobility: the code and the state is moved – and execution restarts from the next statement.  e.g. D ’ Agents.  Comment: very powerful, but hard to implement.

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

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

34 Models for Code Migration  Alternatives for code migration.

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

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

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

38 Migration and Local Resources  Actions to be taken with respect to the references to local resources when migrating code to another machine. UnattachedFastenedFixed By identifier By value By type MV (or GR) CP ( or MV, GR) RB (or GR, CP) GR (or MV) GR (or CP) RB (or GR, CP) GR RB (or GR) Resource-to machine binding Process-to- resource binding

39 Migration in Heterogeneous Systems  The principle of maintaining a migration stack to support migration of an execution segment in a heterogeneous environment 3-15

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

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

42 Implementation Issues (1)  The architecture of the D'Agents system.

43 Implementation Issues (2)  The parts comprising the state of an agent in D'Agents. StatusDescription Global interpreter variablesVariables needed by the interpreter of an agent Global system variablesReturn codes, error codes, error strings, etc. Global program variablesUser-defined global variables in a program Procedure definitionsDefinitions of scripts to be executed by an agent Stack of commandsStack of commands currently being executed Stack of call framesStack of activation records, one for each running command

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

45 Agent Technology  The general model of an agent platform (adapted from [fipa98-mgt]).

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

47 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. Message purposeDescriptionMessage Content INFORMInform that a given proposition is trueProposition QUERY-IFQuery whether a given proposition is trueProposition QUERY-REFQuery for a give objectExpression CFPAsk for a proposalProposal specifics PROPOSEProvide a proposalProposal ACCEPT-PROPOSALTell that a given proposal is acceptedProposal ID REJECT-PROPOSALTell that a given proposal is rejectedProposal ID REQUESTRequest that an action be performedAction specification SUBSCRIBESubscribe to an information sourceReference to source

48 Agent Communication Languages (2)  A simple example of a FIPA ACL message sent between two agents using Prolog to express genealogy information. FieldValue PurposeINFORM LanguageProlog Ontologygenealogy Contentfemale(beatrix),parent(beatrix,juliana,bernhard)

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

50 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?  Format: A4, typed, bound, single-spaced, 12pt. A cover page should also be included, as should a page of annotated references (and these are NOT counted as one of the pages).