Kyung Hee University 1/57 Communication Chapter 3.

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

Chapter 4 Threads Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Threads, SMP, and Microkernels
Processes: Code Migration Chapter 3 Will Cameron CSC 8530 Dr. Schragger.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
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.
Computer Science Lecture 6, page 1 CS677: Distributed OS Processes and Threads Processes and their scheduling Multiprocessor scheduling Threads Distributed.
1 DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S. TANENBAUM MAARTEN VAN STEEN Chapter 3 Processes Skip
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
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.
Processes After today’s lecture, you are asked to know
EEC-681/781 Distributed Computing Systems Lecture 8 Wenbing Zhao Cleveland State University.
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.
Processes Chapter 3.
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.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Give an example to show the advantages to using multithreaded Clients See page 142 of the core book (Tanebaum 2002).
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.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
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.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Kyung Hee University 1/41 Introduction Chapter 1.
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.
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.
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.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
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,
Processes Chapter 3. Processes Topics discussed in this chapter: –Threads improve performance. In distributed systems threads allow clients can servers.
Processes & Threads Introduction to Operating Systems: Module 5.
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.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
Processes, Threads and Virtualization Chapter The role of processes in distributed systems.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
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 Chapter 3.
Chapter 4 Threads.
Distributed Systems - Comp 655
Processes Chapter 3.
Prof. Leonardo Mostarda University of Camerino
Processes Chapter 3.
Processes Chapter 3.
Presentation transcript:

Kyung Hee University 1/57 Communication Chapter 3

Kyung Hee University 2/57 Agenda 1-Threads (N.Q.Hung) (N.Q.Hung) 2-Clients (L.X.Hung) (L.X.Hung) 3-Servers (L.X.Hung) (L.X.Hung) 4-Code Migration (N.Q.Hung) (N.Q.Hung) 5-Software Agent (L.X.Hung) (L.X.Hung)

Kyung Hee University 3/57 Chapter 3 Process Part 1 THREAD

Kyung Hee University 4/57 Process at a glance

Kyung Hee University 5/57 Process Process Control Block (PCB)

Kyung Hee University 6/57

Kyung Hee University 7/57 Thread

Kyung Hee University 8/57

Kyung Hee University 9/57

Kyung Hee University 10/57 Kernel-Level Threads Kernel is aware of and schedules threads A blocking system call, will not block all peer threads Expensive to manage threads Expensive context switch Kernel Intervention Maybe as expensive as using processes!!

Kyung Hee University 11/57 Light-Weight Processes (LWP) Support for hybrid (user-level and Kernel) threads A process contains several LWPs Developer: creates multi-threaded applications System: Maps threads to LWPs for execution

Kyung Hee University 12/57 Thread Implementation-LWP (1) Combining kernel-level lightweight processes and user-level threads.

Kyung Hee University 13/57 Thread Implementation - LWP (2) Each LWP offers a virtual CPU LWPs are created by system calls They all run the scheduler, to schedule a thread Thread table is kept in user space Thread table is shard by all LWPs LWPs switch context between threads

Kyung Hee University 14/57 Thread Implementation - LWP (3) When a thread blocks, LWP schedules another ready thread Thread context switch is completely done in user-address space When a thread blocks on a system call,execution mode changes from user to kernel but continues in the context of the current LWP When current LWP can no longer execute, context is switched to another LWP

Kyung Hee University 15/57 LWP Advantages Cheap thread management A blocking system call may not suspend the whole process LWPs are transparent to the application LWPs can be easily mapped to different CPUs Managing LWPs is expensive (like kernel threads)

Kyung Hee University 16/57 Threads and Distributed Systems Important property of thread: a blocking system call will not block the entire process Very attractive to maintain multiple logical connections between many clients and a server

Kyung Hee University 17/57 Multi-Threaded Clients High propagation delay in big networks WAN: a round trip delay ~ seconds To hide this delay, use threads Initiate communication by a separate thread Example: Web browsers Separate connection for each page component (HTML file, image, audio…) Better: if server is horizontally distributed, data will be transferred in parallel

Kyung Hee University 18/57 Multi-Threaded Servers (1) Much more Important than multi-threaded clients Not only simplifies server code, but also boosts server performance (exploit parallelism) It is common to have multiple-CPU (Multiprocessor) server machines Example: File Server (fig)

Kyung Hee University 19/57 Multithreaded Servers (2) A multithreaded server organized in a dispatcher/worker model.

Kyung Hee University 20/57 Multithreaded Servers (3) Three ways to construct a server. ModelCharacteristics ThreadsParallelism, blocking system calls Single-threaded processNo parallelism, blocking system calls Finite-state machineParallelism, nonblocking system calls Back to Agenda

Kyung Hee University 21/57 Clients and Servers

Kyung Hee University 22/57 Clients Main role of clients is: to interact with human user and remote server -User Interface (UI): -Client-side software: UI + components for achieving transparent

Kyung Hee University 23/57 User Interface The X-Window System Goal Generally is used to control bit-mapped terminals (include a monitor, keyboard, mouse) (or a part of OS that controls the terminal) X-kernel: -Contains all terminal-specific devices -Offer relative low-level interface for controlling the screen -Capturing evens from the keyboard and mouse Comprise 4 major components: -X Servers: Managing the screen, mouse and keyboard -> interact with the user -X Clients: The application (where the real work gets done ) -X Protocol: Client/server communication -X Library: The Programming interface

Kyung Hee University 24/57 User Interface The basic organization of the X Window System The X-Window System

Kyung Hee University 25/57 Client-Side Software for Distribution Transparency -UI is a small part of the client-side S/W -Client S/W includes: +Local processing +Communication facilities: distribution transparency +Replication transparency (next slide) +Access transparency: client stub +Location, migration, relocation transparency: naming +Failure transparency

Kyung Hee University 26/57 Client-Side Software for Distribution Transparency A possible approach to transparent replication of a remote object using a client-side solution. Common interface to Service Client or Server side

Kyung Hee University 27/57 Servers

Kyung Hee University 28/57 Servers: General Design Issues 1-Organize of server? 2-How client contacts with server? 3-Whether and how a server can be interrupt? 4-Stateful or Stateless server?

Kyung Hee University 29/57 Servers: General Design Issues 1-Organize of server? -Iterative server (sequential server): itself handle the request and return a response to the request. -Concurrent server: does not handle the request but passes it into threads (Ex multithreads server)

Kyung Hee University 30/57 Servers: General Design Issues 2-How client contacts with server? Way: Clients send the request to the endpoint (port) of the server Approach 1: Endpoint is assigned with the well-know service (Ex: FPT request listen to port 21, HTTP: port 80) Approach 2 : Not preassigned endpoint (next slice) Solution 1: Each server has a special daemon to keep tracks of the current endpoint of each service (Ex: DCE) Solution 2:Using a single SuperServer (inetd in UNIX)

Kyung Hee University 31/57 Servers: General Design Issues a)Client-to-server binding using a daemon as in DCE b)Client-to-server binding using a superserver as in UNIX 3.7

Kyung Hee University 32/57 Servers: General Design Issues 3- Whether and how a server can be interrupt? Approach 1: Client suddenly exits the application and restarts it immediately  server thinks the client had crashed and will tear down the connection. Approach 2 (better): Send out-of-band data (which is process by the server before any other client data) -Solution 1: Out-of-band data is listened by separated endpoint. -Solution 2: Out-of-band data is sent across the same connection with urgent

Kyung Hee University 33/57 Servers: General Design Issues 4- Stateful or Stateless server? Stateless server: -Does not keep information on the state of its clients. -Can change it own state without having to inform any client. Ex: Web server Stateful server: - Does maintain information on its clients. Ex: File server

Kyung Hee University 34/57 Object Servers - Tailored for distributed objects support -Provides environment for objects -Not a service by itself (government) -Services are provided by objects -Easy to add services (by adding Objects) Object Data Code (methods) Object server Object

Kyung Hee University 35/57 Invoking Objects The Object Server is needed to know: -Which code is execute? -On which data is should operate?

Kyung Hee University 36/57 Invoking Objects Activation Policies Decisions on how to invoke objects All objects are alike –Inflexible Objects differ and require different policies –Object type –Memory allocation –Threading

Kyung Hee University 37/57 Create at the first invocation request and destroy when clients are no longer bound to it Create all transient objects when server is initialized Server resources? Invocation time? Transient Objects

Kyung Hee University 38/57 Each object has its own memory segment Objects can share memory segments Security? Memory resources? Memory Allocation

Kyung Hee University 39/57 One thread in the server Several threads in the server Separate thread for each object Separate thread for each request Concurrent access? Threads

Kyung Hee University 40/57 A S/W implementation of an activation policy Generic to support developers Group objects per policy Several objects under an adapter Several adapters under a server Object Adapters (Wrappers)

Kyung Hee University 41/57 Organization of an object server supporting different activation policies. Object Adapters (Wrappers) Back to agenda

Kyung Hee University 42/57 Chapter 3 Process Part 4. Code migration

Kyung Hee University 43/57 Code Migration Code Migration = moving processes between machines Process = 3 segments Text segment (the code) Resource segment (refs to external resources {files, printers, devices, other processes, etc}) Execution segment (state of a process {stack, program counter, registers, private data …} )

Kyung Hee University 44/57 Why migrate code? (1) Main Reason: Better performance of overall system

Kyung Hee University 45/57 Why migrate code? (2)  Load-Balancing (for multiprocessors) Move process from over-utilized to under-utilized CPU  Minimizing Communication Costs  Exploiting parallelism Examples: client application needs to do many database operations involving large quantities of data => ship part of the client application to the server Interactive database applications: client needs to fill in forms => ship part of the server application to the client Searching information in the Web by a small mobile prog. => send some copies of such a prog. off to different sites

Kyung Hee University 46/57 Why migrate code? (3)  Besides improving performance: Flexibility  Clients need not have all the S/W pre-installed: download on demand, then dispose. Remote object stub in Java Java applets  Security: Can you trust any code? (both client & server)  Need a standardized protocol for downloading & initializing code  Guarantee that downloaded code can be executed

Kyung Hee University 47/57 Scenario of 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.

Kyung Hee University 48/57 Models for Code Migration Alternatives for code migration. Transfer only the code segment => simplicity Execution segment can be transferred as well (running process can be stopped & moved to another machine to resume execution) anonymous Require registration & authentication at the server Eg: search prog., uploading programs to a compute server Process = 3 segments Text segment (the code) Resource segment (refs to external resources {files, printers, devices, other processes, etc}) Execution segment (state of a process {stack, program counter, registers, private data …} )

Kyung Hee University 49/57 GR: Establish a global systemwide reference MV: Move the Resource CP: Copy the value of the resource RB: Rebind process to locally available resource 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 Binding by identifier: e.g, uses a URL for Website or IP address for FTP server. Binding by value: e.g, C or Java standard libraries Binding by type: local devices such as monitors, printers, … Unattached resources: can easily moved between different machines, typically (data) files associated only with the program that is to be migrated. Fastened resources: eg, local databases, complete Websites (moveable but high costs) Fixed resources: local devices

Kyung Hee University 50/57 Migration in Heterogeneous Systems  Requirements:  Platform supported: code segment may be recompiled to be executed in new platform  Ensure the execution segment can be represented at each platform properly.  Solutions:  Weak mobility: no runtime information needs to be transferred => just recompile the source code  Strong mobility: segment is highly dependent on the plaform => migration stack: a copy of the program stack in a machine-independent way.(C, Java)  Scenario:  Migration can take place only when a next subroutine is called.  When subroutine is called: marshalled data are pushed onto the migration stack along with identifier for the called subroutine & the return label  Then all global program-specific data are also marshalled (current stack & machine-specific data are ignored)

Kyung Hee University 51/57 Migration in Heterogeneous Systems The principle of maintaining a migration stack to support migration of an execution segment in a heterogeneous environment 3-15 end

Kyung Hee University 52/57 Software Agents

Kyung Hee University 53/57 Software Agents Definition: Is as an autonomous process capable of reacting to, and changes in, its environment, possibly in collaboration with users and other agents

Kyung Hee University 54/57 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 CommunicativeYes Can exchange information with users and other agents ContinuousNoHas a relatively long lifespan MobileNoCan migrate from one site to another AdaptiveNoCapable of learning

Kyung Hee University 55/57 Agent Technology The general model of an agent platform (adapted from [fipa98-mgt]).

Kyung Hee University 56/57 Agent Communication Languages (1) Components of a message

Kyung Hee University 57/57 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 source Reference to source

Kyung Hee University 58/57 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)

Kyung Hee University 59/57 End of chapter 3 Thank you for joining us!