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.

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.
Chap 2 System Structures.
Chap 4 Multithreaded Programming. Thread A thread is a basic unit of CPU utilization It comprises a thread ID, a program counter, a register set and a.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
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.
1 Processes and Pipes COS 217 Professor Jennifer Rexford.
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
EEC-681/781 Distributed Computing Systems Lecture 8 Wenbing Zhao Cleveland State University.
CS 603 Threads, Processes, and Agents March 18, 2002.
Process Processes are executing or executable instances of programs. Processes in a modern OS haveOS –management information –resources –unique process.
1 Chapter 4 Threads Threads: Resource ownership and execution.
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.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
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).
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.
Protection and the Kernel: Mode, Space, and Context.
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.
Processes Chapter 3. Table of Contents Multithreading Clients and Servers Code Migration Software Agents (special topic)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Threads G.Anuradha (Reference : William Stallings)
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 Thread Usage.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
GLOBAL EDGE SOFTWERE LTD1 R EMOTE F ILE S HARING - Ardhanareesh Aradhyamath.
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.
Processes and Threads MICROSOFT.  Process  Process Model  Process Creation  Process Termination  Process States  Implementation of Processes  Thread.
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.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Introduction to Operating Systems Concepts
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Processes Chapter 3.
Introduction to Operating Systems
Threads, SMP, and Microkernels
Chapter 15, Exploring the Digital Domain
Processes Chapter 3.
Threads Chapter 4.
Prof. Leonardo Mostarda University of Camerino
Processes Chapter 3.
CS510 Operating System Foundations
Processes Chapter 3.
Presentation transcript:

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 and server? What is the role of Virtualization in Distributed Systems? How the client deal with access transparency and replication transparency? What is stateless server and what is stateful server? What is iterative and concurrency server? What are the reasons for Migrating Code? Tells the three segments of a process. What are the weak mobility model and strong mobility model?

Process A Process is often defined as a program in execution. To execute a program, an operating system creates a number of virtual processors, each one for running a different program. To keep track of these virtual processors, the operating system has a process table, containing entries to store CPU register values, memory maps, open files, accounting information, privileges, etc Processes in a modern OS have: –Management information –Resources –Unique process identifier or PID

Process Management information covers –allocated resources –event handling –permissions –scheduling information –utilisation of resources Resources include –memory allocated - address space –open files, I/O channels, devices –secondary storage allocations - swap space, memory mapping Address space is protected so only process may read/write to it. Memory protection stops process –writing to address space of other processes or kernel –crashing OS or other processes if it goes wrong

Process For creating a process, the OS must create a complete independent address. The price is high. Even for the switching of the CPU between two processes, because the OS will have to modify registers of the memory management unit (MMU) and invalidate address translation caches such as in the translation lookaside buffer (TLB) Requirements: Changing the memory map in the MMU Flashing the TLB (Translation lookaside buffer)

Process Creation in Java Class Run.java uses getRuntime() obtain context for spawning external process exec() get OS command interpreter to run command getInputStream() get input stream to read output from process

Thread A thread is very similar to a process in the sense that it can also be seen as the execution of a (part of a) program on a virtual processor. A thread context often consists of nothing more than the CPU context, along with some other information for thread management. Threads are sometimes called lightweight subcomputations running a in a process that –Have their own flow of control and execution state –Share their resource context – address space, open files

Thread Compared to processes, threads – are quick to create – are quick to context switch – can readily share memory, files and sockets Threads are useful where – many concurrent computation units are needed – computation units need to share address space easily

Thread Usage in Non-distributed Systems For a single-threaded process, whenever a blocking system call is executed, the process as a whole is blocked. Using the multithread process, a program can process more than two tasks at same time, for example the spreadsheet program. Multithreading also makes it possible to exploit parallelism when executing the program on a multiprocessor system. Thread switching can sometimes be done entirely in user space.

Java Thread Wire.java creates 2 threads that compete to print their IDs

Threads in Distributed Systems Multithreaded Clients Example: Web browser is doing a number of tasks simultaneously. It is designed as a multithreaded client program. Each thread sets up a separate connection to the server and pulls in the data. Advantages: –Hiding communication latencies as much as possible by delivering text contents first, then image and other data. –Several connections can be opened simultaneously. Web server can be replicated across multiple machines with multithreaded client. Connections maybe set up to different replicas, allowing data to be transferred in parallel.

Multithreaded Servers (1) A multithreaded server organized in a dispatcher/worker model.

Multithreaded 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

The Role of Virtualization in Distributed Systems (a) General organization between a program, interface, and system. (b) General organization of virtualizing system A on top of system B.

Architectures of Virtual Machines (1) Interfaces at different levels: 1.An interface between the hardware and software consisting of machine instructions –that can be invoked by any program. 2.An interface between the hardware and software, consisting of machine instructions –that can be invoked only by privileged programs, such as an operating system.

Architectures of Virtual Machines (2) 3.An interface consisting of system calls as offered by an operating system. 4.An interface consisting of library calls –generally forming what is known as an application programming interface (API). –In many cases, the aforementioned system calls are hidden by an API.

Architectures of Virtual Machines (3) (a) A process virtual machine, with multiple instances of (application, runtime) combinations.

Architectures of Virtual Machines (5) (b) A virtual machine monitor, with multiple instances of (applications, operating system) combinations.

Clients Client-Side Software for Distribution Transparency Besides the user interface and other application-related software, client software comprises components for achieving distribution transparency. Access transparency is generally handled through the generation of a client stub from an interface definition of what the server has to offer. Replication transparency in many distributed systems is handled by means of client-side solution. One way is forward invocation request to each replica and client proxy collects all responses transparently and passes a single return value to the client application.

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

General Server Design Issues A server is a process implementing a specific service on behalf of a collection of clients. It is organized in this way: it waits for an incoming request from a client and subsequently ensures that the request is taken care of, after which it waits for the next incoming request. Issues: –Iterative server: the server itself handles the request and, if necessary, returns a response to the requesting client. –Concurrent server: it does not handle the request itself, but passes it to a separate thread or another process, after which it immediately waits for the next incoming request. E.g. Multithreaded server, or Unix way: fork a new process for each new incoming request. –Discuss the endpoint (port) and how to manage it. –Whether or not the server is stateless: A stateless server does not keep information on the sate of its clients, and can change its own state without having to inform any client, e.g. A Web Server. A stateful server does maintain information on its clients, e.g. a file server that allows a client to keep a local copy of a file.

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 (e.x. inetd 3.7

CODE MIGRATION Reasons for Migrating Code Code migration in distributed systems took place in the form of process migration. That reason has always been performance: –The process should be close to where that data reside. A. Migrating parts of the client to server when doing the database operation. B. Migrating parts of the server to client in interactive database applications. –Code migration can be used to improve performance by exploiting parallelism.

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.

Models for Code Migration As in process migration, the execution status of a program, pending signals and other parts of the environment must be moved as well. A process consists of three segments according to Fugetta’s framework: –Code segment is the part that contains the set of instructions that make up the program that is being executed. –Resource segment contains references to external resources needed by the process, such as file, printers, devices, other processes, and so on. –Execution segment is used to store the current execution state of a process, consisting of private data, the stack, and the program counter. Weak mobility model: In this model, it is possible to transfer only the code segment, along with perhaps some initialization data. Feature: a transferred program is always started from its initial state, e.g. Java applets. Strong mobility model: Besides the code segment being transferred, the execution segment can be transferred as well. Feature: A running process can be stopped, subsequently moved to another machine, and then resume execution where it left off.

Models for Code Migration Even for the upper two models, further distinction can be made between sender-initiated and receiver-initiated migration. In sender-initiated migration, migration is initiated at the machine where the code currently resides or is being executed. In receiver-initiated migration, the initiative for code migration is taken by the target machine In the case of weak mobility, it also makes a difference if the migrated code is executed by the target process, or whether a separate process is started, e.g. Java applets sere executed in the browser’s address space. For strong mobility model, instead of moving a running process, it can also be supported by remote cloning.

Models for Code Migration Alternatives for code migration.

Migration and Local Resources Three types of process-to-resource bindings: –Strongest binding – binding by identifier is when a process refers to a resource by its identifier. E.x. when a process uses a URL to refer to a specific Web site by means of that server’s IP address. –Weaker form binding is when only the value of a resource is needed. It is also called binding by value. The execution of the process wouldnot be affected if another resource would provide the same value. E.x. a program relies on standard libraries. –The weakest form of binding is when a process indicates it needs only a resource of a specific type. This binding by type is exemplified by references to local devices, such as monitors, printers, and so on.

Migration and Local Resources Actions to be taken with respect to the references to local resources when migrating code to another machine. GR: Establish a global system wide reference. MV: Move the resource. CP: Copy the value of the resource. RB: Rebind process to locally available resource. Three types of resource to machine bindings: –Unattached resources can be easily moved between different machines ( e.x. data) –Fastened resources. Moving or copying may be possible –Fixed resources. Often refer to local devices. 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

Process used in Web-based Systems Client side process – Web browser &Web proxy Server side process – Apache Web Server Web server clusters

Processes – Clients (1) The logical components of a Web browser.

Processes – Clients (2) Using a Web proxy when the browser does not speak FTP.

The Apache Web Server The general organization of the Apache Web server.

Web Server Clusters The principle of using a server cluster in combination with a front end to implement a Web service.