Processes Chapter 3. Table of Contents Multithreading Clients and Servers Code Migration Software Agents (special topic)

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

CS-495 Distributed Systems Fabián E. Bustamante, Winter 2004 Processes Threads & OS Threads in distributed systems Object servers Code migration Software.
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.
Computer Systems/Operating Systems - Class 8
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.
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.
3.5 Interprocess Communication
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.
Computer Science Lecture 7, page 1 CS677: Distributed OS Multiprocessor Scheduling Will consider only shared memory multiprocessor Salient features: –One.
Processes After today’s lecture, you are asked to know
EEC-681/781 Distributed Computing Systems Lecture 8 Wenbing Zhao Cleveland State University.
CS 603 Threads, Processes, and Agents March 18, 2002.
Tutorials 1 1.What is the definition of a distributed system? 1.A distributed system is a collection of independent computers that appears to its users.
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.
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
PRASHANTHI NARAYAN NETTEM.
Chapter 3  Processes 1 Processes Chapter 3 Chapter 3  Processes 2 Introduction  A process is a program in execution  For OS important issues are.
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.
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.
Processes, Threads and Virtualization
Kyung Hee University 1/57 Communication Chapter 3.
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. 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.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
OS2- Sem ; R. Jalili Introduction Chapter 1.
Kyung Hee University 1/41 Introduction Chapter 1.
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.
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.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
OS2- Sem1-83; R. Jalili Introduction Chapter 1. OS2- Sem1-83; R. Jalili Definition of a Distributed System (1) A distributed system is: A collection of.
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,
Operating Systems: Internals and Design Principles
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
CSC 322 Operating Systems Concepts Lecture - 7: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Processes, Threads and Virtualization Chapter The role of processes in distributed systems.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
TEXT: Distributed Operating systems A. S. Tanenbaum Papers oriented on: 1.OS Structures 2.Shared Memory Systems 3.Advanced Topics in Communications 4.Distributed.
Primitive Concepts of Distributed Systems Chapter 1.
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 and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes and threads.
Processes Chapter 3.
Advanced Operating Systems
Processes Chapter 3.
Prof. Leonardo Mostarda University of Camerino
Processes Chapter 3.
Processes Chapter 3.
Presentation transcript:

Processes Chapter 3

Table of Contents Multithreading Clients and Servers Code Migration Software Agents (special topic)

3.1 Multithreading Process vs. Thread –A process is often defined as a program in execution. –A thread is a sequence of instructions that can be executed in parallel with other threads. –Threads are like lightweight processes.

3.1 Multithreading Process vs. Thread –Multiple threads within a single process share the state information, memory and other resources directly, but they are able to execute independently –Threads collaborate with each other -- processes compete. –……

3.1 Multithreading Why Multithreading? –Allows to perform more than one task at a time. –Increases the performance of programs.

3.1 Multithreading When Multithreading? –A multiprocessor computer works by using the multiple processors to handle threads simultaneously (multiprocessing). –A program that spends a great deal of time waiting for outside events (time slicing).

Threads in Nondistributed Systems Interprocess communication (IPC) –Pipes, Message queues, Shared memory segments, Semaphore, Signal –Heavy context switching user -> kernel mode switch in kernel kernel -> user mode

Threads in Nondistributed Systems Context switching as the result of IPC

Threads in Nondistributed Systems Multithreads (in a process) –Communicate by using shared data –User space switching mostly –Don’t bother the kernel => Efficient

Thread Implementation Combining kernel-level lightweight processes and user-level threads.

Threads in Distributed Systems The usage of threads –allows blocking system calls without blocking the entire process in which the thread is running. –Multiple threads maintain multiple logical connections at the same time.

Threads in Distributed Systems Multithreaded Clients –Example: web browser Main HTML file More connections simultaneously for images, … –Web servers are replicated Request is forwarded Connections to replicas Transfer data in parallel

Threads in Distributed Systems Multithreaded Servers –Single-threaded process –Finite-state machine –Threads

Single-threaded process The server –Receive a request –Execute it (either locally or remotely) Loop –Reply the result No other request is allowed when handling the current request. Simple, easy, … but inefficient

Finite-state machine The server –Received messages are recorded in a table –Fetch a message new work? Start it Result of previous work? Reply it Nonblocking calls to send and receive

Threads The server –Receive a request –Dispatch to a free worker thread A multithreaded server organized in a dispatcher/worker model.

Three ways to construct a server Blocking calls: Easy Parallelism: Efficient, high performance ModelCharacteristics ThreadsParallelism, blocking system calls Single-threaded processNo parallelism, blocking system calls Finite-state machineParallelism, nonblocking system calls

3.2 Clients Task –Interface: interact with a human user and a remote server. –Partial computation –Implementation of Transparency –……

Distribution Transparency A client should not be aware that it is communicating with remote processes.

Distribution Transparency Different forms of transparency in a distributed system. (from chapter one) TransparencyDescription Access Hide differences in data representation and how a resource is accessed LocationHide where a resource is located MigrationHide that a resource may move to another location Relocation Hide that a resource may be moved to another location while in use ReplicationHide that a resource is replicated Concurrency Hide that a resource may be shared by several competitive users FailureHide the failure and recovery of a resource Persistence Hide whether a (software) resource is in memory or on disk

Distribution Transparency (1) Access transparency –A client stub is generated from an interface definition of what the server has to offer. –The client stub: provides the same interface as available at the server. handles the communication between two sides.

Distribution Transparency (2) Location | Migration | Relocation transparency –Naming system –Bind and rebind the server –Temporarily out of service (maybe)

Distribution Transparency (3) Replication transparency –Forward a request to each replica –Collect all responses –Pick a single return value Safe but inefficient

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

Distribution Transparency (4) Failure transparency –Repeat to build the connection –Try another server –Pick the data from its own cache

Distribution Transparency (5) Concurrency transparency –Server’s job mostly –Intermediate servers Persistence Transparency –Server’s job totally

3.3 Servers Definition –A server is a process implementing a specific service on behalf of a collection of clients Organization –Waits for an incoming request from a client –Handle the request –Reply the result to the client

3.3 Servers Type –Iterative server Handle the request by itself –Concurrent server Forward to other available process (or thread) Fork a new process (or thread) to handle the request

3.3 Servers –Stateless server Does not keep information on the state of its clients, for example, a web server. –Stateful server Maintain information on its clients Better services, better performance Drawback: recover the client information sometimes –Hybrid solution cookie

3.3 Servers Endpoint or port –Preassign endpoint for well-known services globally: FTP:21, –(Server, port) pair in a special daemon –Superserver Listen to some endpoints Fork a server process to handle the incoming request

Servers: General Design Issues 3.7 a)Client-to-server binding using a daemon as in DCE b)Client-to-server binding using a superserver as in UNIX

3.3 Servers Special Case: Object servers –Definition: A server to support (contain) distributed objects No service directly from the server, but implemented by the objects in the server Server’s job: invoke local objects based on incoming requests Positive: easy to change services by just updating objects

3.3 Servers –Object Data: represents the state Code: method implementation –Object Adapter Activation policies: the way how to invoke an object Object adapter: a mechanism to group objects based on the above policy and dispatch requests to different objects

Object Adapter (Omitted) Organization of an object server supporting different activation policies.

3.4 Code Migration What is code migration? –In a distributed system, programs (code) can be transferred among different machines, sometimes even while they are be executed. Why code migration? –Performance, always Why not code migration? –Security, always

Reasons for Migrating Code Basic idea of process migration –Overall system performance can be improved if processes are moved from heavily-loaded to lightly-loaded machines. Related stuff –Communication cost –Heterogeneity –Security –Error recovery

Examples Clients => Servers –A program in the client containing a lot of query operations for the database residing in a server. Servers => Clients –Network installation: OS… –Java applets A tradeoff between the cost of communication and the execution of program

Examples The principle of dynamically configuring a client to communicate to a server. The client first fetches the necessary software, and then invokes the server. Code migrated from the third party

Models for Code Migration Fugetta’s framework (1998) –Code segment Instructions of a program –Resource segment References to external resources: printer, devices, other processes, … –Execution segment Current execution state of a process: private data, stack, program counter.

Models for Code Migration Mobility –Weak mobility: only transfer the code segment as well as some initialization data Transferred programs are always started from the very beginning. Simple –Strong mobility: transfer not only the code segment, but also the execution segment Running process is stopped => move to other machine => resume execution Flexible but hard to be implemented

Models for Code Migration Initiator –Sender-initiated: a migration is initiated from a the machine where the code currently resides or is being executed. –Receiver-initiated: the target machine initiates the migration, for example, Java applet.

Models for Code Migration Migration in client/server model –Client => Server Access to the server’s resource security problem –Server => Client Improve the client-side performance

Models for Code Migration How to execute the migrated code in weak mobility? –By target process Avoid communication, efficient Once again, security problem –Start a new process IPC

Models for Code Migration How to execute the migrated code in strong mobility? –Migrate process –Clone process In UNIX, remote cloning is done by fork off a child process and let it run in the remote machine. Simple

Models for Code Migration Alternatives for code migration.

Models for Code Migration Migration and Local resource –The resource segment in Fugetta’s framework –How to bind a resource to a process? –What kind of resources a process may use?

Models for Code Migration Process-resource Binding –By identifier URL to a server by its internet address reference to local communication endpoint –By value Library code –By type Monitors, printers, …

Models for Code Migration Resource-machine binding –Unattached Typically (data) files associated with the migrated program Easy to move –Fastened Local databases and complete web sites Reluctant to move –Fixed Local devices, local communication endpoint Impossible to move

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 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 in Heterogeneous Systems So far, we always assume that the migrated code can be easily executed at the target machine. Homogeneous system: same architecture, same data representation, same compiler, same platform… Heterogeneous system

Migration in Heterogeneous Systems Weak mobility –Transfer the code –Compile it in the target machine –Execute it Strong mobility –Nightmare –How to deal with the platform-dependent runtime information? –Migration stack solution: difficult with more restriction

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

Migration in Heterogeneous Systems Virtual machine: a charming solution –Source code in scripting languages –Intermediate machine-independent code generated by compilers Java Bytecode JVM

Homework #1 due 11/26, 2pm Problem 3 in chapter 3, page 180 –In the text, we described a multithreaded file server, showing why it is better than a single- threaded server and a finite-state machine server. Are there any circumstances in which a single- threaded server might be better? Give an example. Problem 14 in chapter 3, page 181 –Is a server that maintains a TCP/IP connection to a client stateful or stateless? In general, what’s the benefit of code migration? What’s the difficulty of doing so?

Invited Talk 软件 agent 技术 曹 春 博士 南大软件新技术国家重点实验室