Threads Clients Servers Code Migration Software Agents Summary

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.
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
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-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Chapter 5 Threads os5.
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
EECS122 - UCB 1 CS 194: Distributed Systems Processes, Threads, Code Migration Computer Science Division Department of Electrical Engineering and Computer.
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.
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.
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.
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.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
9/13/20151 Threads ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original slides.
Processes, Threads and Virtualization
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
Kyung Hee University 1/57 Communication Chapter 3.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
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.
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-
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.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.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
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.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Department of Computer Science and Software Engineering
Module 2.0: Threads.
Acknowledgement: These slides are adapted from slides provided in Thißen & Spaniol's course Distributed Systems and Middleware, RWTH Aachen Processes Distributed.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
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.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
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
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Chapter 4 Threads.
Operating System Concepts
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.
Processes Chapter 3.
Presentation transcript:

Threads Clients Servers Code Migration Software Agents Summary CHAPTER 3 Processes Threads Clients Servers Code Migration Software Agents Summary

Process A program in execution An instance of a program running on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by the execution of a sequence of instructions, a current state, and an associated set of system instructions

Threads:Introduction Process : A program in execution OS create a number of virtual processors for running a different program Process Table : to keep track of VP Entries to CPU register value. Memory Maps Open Files Accounting Information Privileges etc Multiple Processes may be concurrently sharing the same resources.

Threads:Introduction Each time process is created- OS must create Independent address space Initializing memory segment Setting up a stack for temporary data Switching the CPU between two process require saving CPU Context, modify register in MMU and invalidate address translation cache in TLB. Both of them is expensive

Threads:Introduction Threads : execution of part of process on virtual processor lightweight process Contains only the minimum information to allow CPU to be shared by several thread. ie: mutex variable,

Thread Usage in Non-distributed Systems Single threaded process Whenever a blocking system call is executed- the whole process is blocked. Would be able to service only one client at a time. Run with two threads- Microsoft Excel Spreadsheet One handling interaction with the user One for updating the spreadsheet

Thread Usage in Non-distributed Systems Exploit parallelism in the case of multiprocessor system. Shared data is stored in shared memory Each CPU run different thread. Also useful in large application Collection of cooperating programs, each to be executed by a separate process. IPC in UNIX system

Process/Thread Usage in Nondistributed Systems Context switching as the result of IPC IPC drawback: communication between two process requires extensive context switching- kernel mode-user mode

Thread Implementation(1) Instead of using processes, an application can also be constructed by separate threads. Communication between threads is dealt by using shared data. Thread switching is done in user space. Threads are generally provided in the form of a thread package Operation to create, destroy & synchronization between them Divide the large application into parts that could be logically executed at the same time

Thread Implementation(2) Two approaches Construct the thread library – executed in user mode Kernel be aware of threads and schedule them User-level threads Cheap to create & destroy in term of operation to allocate MM Switching threads context can be done with a few instruction-synchronizing when entering a section of shared data Only the value of CPU register need to be changed No need to change memory map, TLB etc Drawback is – the invocation of blocking system call will block the entire process belonging to the threads –(i/o) Kernel-Level Threads Same as process – have to go through kernel itself

Combining kernel-level and user-level threads There can be several LWP per process run on kernel space System also user-level thread process run on user space Creating and destroying thread Synchronization Mutexes Condition Variable

Thread Implementation(3) Combining kernel-level and user-level threads. Thread table : keep track of the current set of threads – shared by LWP Lightweight Processes

Example: Java Thread Java threads may be created by: Extending Thread class Implementing the Runnable interface Java threads are managed by the JVM.

Multithreaded Client Hide Communication Latency initiate communication and do something else Eg: Web Browser web doc consist of HTML + image + icons the browser has to set up TCP/IP connection read incoming data + pass to display Setup tcp/ip… blocking operation Start display data while fetching it- text -- image

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

Clients User Interfaces Interact with a human and remote server. telnet X windows; Unix – % xhost + %setenv DISPLAY <hostname/address>

The basic organization of the X Window System

Client-Side Software for Distribution Transparency Client not only comprises of UI processing and data level are also executed in client side. A client has their own software must provide distribution transparency A client should not aware that it is communicating with a remote process in the server side. Replication?

Client-Side Software for Distribution Transparency Communication is handle by client middleware. – cache data A possible approach to transparent replication of a remote object using a client-side solution.

Servers: General Design Issues Server just listen for the request Ensure the request is served Wait for the next incoming request Servers is organized in several ways:- Iterative server Handles the request Return the response to the requesting client Concurrent server Pass the request to separate thread/process (not handle by itself) Wait for next incoming request E.g:multithreaded server

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

Servers: another Design Issues Stateless server Ignore the information on the state of its client Can change the server state without informing the client Eg: Web Server Stateful server Maintains information on its clients Table containing (client, file)

Code Migration In Distributed System- entire process was moved from one machine to another Moving a running process is costly in term of performance So – Ship part of the client application to the server and send only the result across the network Improve performance More flexible

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 Process for code migration is divided into three segments; Code Segment The part that contains the set of instructions that make up the program that is being executed. Resource Segment Reference to external resource needed by the process ie. Printers, files, devices other pcs etc. Execution Segment store current execution state of a process, consisting of private data, the stack, and the program counter.

Models for Code Migration Alternatives for code migration.

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

Software Agents Autonomous process capable of reacting to and initiating changes in, its environment, possibly in collaboration with users and other agents. Features: ability to act on its own – take initiative where appropriate i.e agent-based web crawler

Software Agents in Distributed Systems Property Common to all agents? Description Autonomous Yes Can act on its own Reactive Responds timely to changes in its environment Proactive Initiates actions that affects its environment Communicative Can exchange information with users and other agents Continuous No Has a relatively long lifespan Mobile Can migrate from one site to another Adaptive Capable of learning Some important properties by which different types of agents can be distinguished.

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