Chapter 3  Processes 1 Processes Chapter 3 Chapter 3  Processes 2 Introduction  A process is a program in execution  For OS important issues are.

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, 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.
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
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.
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.
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
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.
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.
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
Computer Engineering Department Distributed Systems Course
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED.
Processes, Threads and Virtualization
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
1 Processes Chapter 3. 2 Processes  Communication takes place between processes. But, what ’ s a process?  “ A program in execution ”  Traditional.
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.
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.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Background: Operating Systems Brad Karp UCL Computer Science CS GZ03 / M th November, 2008.
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.
Threads G.Anuradha (Reference : William Stallings)
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,
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
Operating Systems: Internals and Design Principles
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.
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.
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.
Processes Chapter 3.
Multithreaded Programming
Prof. Leonardo Mostarda University of Camerino
Processes Chapter 3.
Processes Chapter 3.
Presentation transcript:

Chapter 3  Processes 1 Processes Chapter 3

Chapter 3  Processes 2 Introduction  A process is a program in execution  For OS important issues are o Management of processes o Scheduling of processes  In dist systems, issues such as o Multithreading o Process/code migration o Software agents

Chapter 3  Processes 3 Topics Covered  Threads  Clients  Servers  Code Migration  Software Agents

Chapter 3  Processes 4 Threads  Processes (not threads): OSs makes sure o Processes do not affect each other, accidentally or intentionally (separation) o Processes not aware of each other (concurrency transparency)  Costly to set up independent processes  Switching between processes is costly o Must save state of current process o Must restore state of new process o Might also have to swap to disk

Chapter 3  Processes 5 Threads  Thread is like a (sub)process  But, OS does not provide concurrency transparency between threads  For example, don’t protect data from access by other threads within a process  Plusses? o Efficiency  Minuses? o More work for application developer

Chapter 3  Processes 6 Threading Example  Spreadsheet program o Change to one cell updates many cells o Interface is one thread, update another o Gives impression both are simultaneous o Even better in multiprocessor system  Other examples? o Word processor  Distributed examples?

Chapter 3  Processes 7 Interprocess Communication  If separate processes, 3 context switches  If same process, but separate threads, more efficient

Chapter 3  Processes 8 Thread Implementation  Two possible approaches o User-level threads  all in user space o Kernel-level threads  kernel is involved  User-level threads o Plus: cheap to create/destroy threads o Plus: thread context switch is cheap o Minus: Blocking system call will block all threads in process (e.g., blocking on I/O)  Kernel-level threads remove the “minus” o But thread context switching is more costly

Chapter 3  Processes 9 Lightweight Processes  User-level threads and…  Lightweight processes (LWPs) that act like kernel-level threads  LWPs take care of threads as needed  Plusses? o Thread stuff is efficient (user-level) o Blocking system call will not suspend all threads (provided enough LWPs) o Apps need not be aware of LWPs o LWPs can execute on different processors

Chapter 3  Processes 10 Threads and LWPs  A bunch of LWPs hang around  LWPs grab threads as needed

Chapter 3  Processes 11 Threads in Dist Systems  Advantage to threads in dist system o Can block without stalling entire process  Multithreaded clients o Conceal communication delays o For example, a Web browser  Multithreaded servers o More benefit on server side than client o Process incoming requests and do local things o Without threading, could implement this as a “big finite-state machine” (saving state, etc.)

Chapter 3  Processes 12 Multithreaded Servers  Multithreaded server o dispatcher/worker model

Chapter 3  Processes 13 Multithreaded Servers  Three ways to construct a server o Single thread  process stalls o Finite state machine  hard to program o Threads  totally awesome, dude  Threads rule! ModelCharacteristics ThreadsParallelism, blocking system calls Single-threaded processNo parallelism, blocking system calls Finite-state machineParallelism, nonblocking system calls

Chapter 3  Processes 14 Threads: The Bottom Line  Consider RPC with blocking system call o Easy to program, but… o Inefficient without threads since… o No parallelism  W/O threads, finite state machine o Then obtain parallelism o But very painful to program  Threads provide o Sequential programming and parallel processes

Chapter 3  Processes 15 Clients  Client interacts with user and server  UI is sometimes simple o Cell phone  Sometimes UI is not-so-simple o X Window System

Chapter 3  Processes 16 X Window System  X Window System consists of o X kernel  low level interface for screen, mouse, etc. o Xlib  to access X kernel o Window manager  app that can manipulate screen o X protocol  allows for X kernel and X app to reside on different machines o X terminals  client using X protocol

Chapter 3  Processes 17 X Window System  Organization of X Window System

Chapter 3  Processes 18  Consider ATM and TV set-top box o For these, UI is small part of client side o Lots of processing on client side, lots of communication from client side  Client-side transparency is possible  Server side transparency harder to achieve (performance issues) o And not so important Client-Side Transparency

Chapter 3  Processes 19  Access transparency o Client stub (middleware)  Location, migration, and relocation transparency o Naming  Replication transparency o One approach is on next slide Client-Side Transparency

Chapter 3  Processes 20 Client-Side Transparency  Replication transparency o Client (stub) invokes object on all replicas o Collects responses and passes one result to client

Chapter 3  Processes 21  Failure transparency o Client middleware repeatedly attempt to connect to server o Client middleware tries another server o Client provides cached result  Concurrency/persistence transparency o ????? Client-Side Transparency

Chapter 3  Processes 22 Servers  Server  a process implementing a service for a collection of clients o Server waits for incoming requests o Server services requests  Server can be iterative or concurrent o Iterative  handles request, response o Concurrent  passes request to another process/thread (fork a new process)

Chapter 3  Processes 23 Servers  Requests arrive at an endpoint o Port  How does client know endpoint? o Well-known o Some service to look it up  Superserver serves servers o Listens for a bunch of “servers”

Chapter 3  Processes 24 Client-to-Server Binding a) Client-to-server binding using a daemon as in DCE b) Client-to-server binding using a superserver as in UNIX

Chapter 3  Processes 25 Other Server Issues  How to interrupt server? o Break connection (common in Internet) o Out of band data  Stateless vs stateful  Stateless  no memory of clients and can change its state without telling clients o For example, a Web server (w/o cookies)  Stateful  remembers its clients o For example, file server must remember who has file at any given time

Chapter 3  Processes 26 Stateless vs Stateful  Stateless vs stateful server  What if server crashes…  Stateless? o No problem, just restart  Stateful? o Big problems…  Security of stateless vs stateful?

Chapter 3  Processes 27 Object Server  Server designed for dist objects o “a place where objects live” o Easy to change services on server  Read Section 3.3.2

Chapter 3  Processes 28 Code Migration  Code migration  passing programs o Perhaps even while executing  Expensive, so why bother?  Consider process migration o Move a process to another machine o Move process from heavily loaded machine o A form of load balancing  When is it worthwhile? o Not easy to calculate in heterogeneous network o Minimizing communication may be good reason

Chapter 3  Processes 29 Code Migration  For example o Server manages a huge database o Spse client needs to access and process lots of data o May save bandwidth by shipping process to the server  Other examples (wrt performance)?

Chapter 3  Processes 30 Code Migration  Code migration might also increase flexibility  For example, it might be possible to dynamically configure the system  Dynamically download client software o No need to pre-install software o Other benefits? o What about security?

Chapter 3  Processes 31 Reason for Migrating Code  Dynamically configuring client o Client fetches necessary software o Then client contacts server

Chapter 3  Processes 32 Models for Code Migration  Process consists of 3 segments o Code segment  self explanatory o Resource segment  external resources o Execution segment  current state  Weak mobility  migration of code segment and some initialization data o For example, Java applets o Simple, only requires code is portable o Execute in current process, or start new one

Chapter 3  Processes 33 Models for Code Migration  Strong mobility  migrate exe segment o Running process stopped, moved to another machine, starts where left off o For example, D’Agents o Complex but powerful  Instead of moving the process, might clone the process o Then runs in parallel at client and server  Why? o Cloning improves transparency

Chapter 3  Processes 34 Models for Code Migration  Sender or receiver initiated?  Sender initiated o Initiated by machine where code resides o For example, uploading program to server o Other examples?  Receiver initiated o Initiated by target machine o For example, Java applets o Other examples?

Chapter 3  Processes 35 Models for Code Migration  Receiver initiated  client takes initiative o Code migrates to client o Done for performance reasons  Sender initiated  server takes initiative o Code migrates to server o Probably want access to server data  Receiver initiated is o Simpler (why?) o More secure (why?)

Chapter 3  Processes 36 Models for Code Migration  Alternatives for code migration

Chapter 3  Processes 37 Migration and Local Resources  What about resource segment?  Spse process is using a specific port for communication o This info is in resource segment  If process migrates, gets a new port  But an absolute URL will not change o Also in resource segment

Chapter 3  Processes 38 Migration and Local Resources  3 types of process-to-resource binding  Binding by identifier o Known locally and remotely o For example, URL or IP address  Binding by value o Available locally and remotely, but location might be different o C or Java library  Binding by type o Only available locally o Local devices (printers, monitors, etc.)

Chapter 3  Processes 39 Migration and Local Resources  3 types of resource-to-machine bindings  Unattached resources o Easy to move from one machine to another o Such as data files used by programs  Attached resources o Difficult to move from on machine to another o Such as database or entire website  Fixed resources o Cannot be moved o Such as local devices

Chapter 3  Processes 40 Migration and Local Resources  GR  establish global systemwide reference  MV  move the resource  CP  copy the file to the resource  RB  rebind process to locally available resource GR RB (or GR) GR (or MV) GR (or CP) RB (or GR, CP) MV (or GR) CP ( or MV, GR) RB (or GR, CP) By identifier By value By type FixedAttachedUnattached Resource-to machine binding Process-to- resource binding

Chapter 3  Processes 41 Migration in Heterogeneous Systems  Code executes on different platforms  Each platform must be supported  Easier if limited to weak mobility o Different code segments  In strong mobility, difficult…  Restrict migration to certain points in code o Such as a function call  Maintain machine independent stack o Migration stack

Chapter 3  Processes 42 Migration in Heterogeneous Systems  Maintaining a migration stack to support migration of an execution segment  Can be done in C/C++

Chapter 3  Processes 43 Migration in Heterogeneous Systems  Migration in heterogeneous systems o Basic problem is similar to portability  What is the solution for portability? o Virtual machine is one solution  So similar solution should work here

Chapter 3  Processes 44 Code Migration in D'Agents  Middleware approach  Supports various forms of code migration  Read it!

Chapter 3  Processes 45 Software Agents  So far o Threads o Clients o Servers o Mobility  And now for something completely different…  Software agents

Chapter 3  Processes 46 Software Agents  Software agents  no precise definition o “Autonomous agents capable of performing a task in collaboration with other, possibly remote, agents” o “An autonomous process capable of reacting to, and initiating change in, its environment, possibly in collaboration with users and other agents”  Able to act on its own (autonomous)  Able to cooperate with other agents  Able to take the initiative

Chapter 3  Processes 47 Software Agents  Collaborative agents o Agents that work together as part of multiagent system o Example: agents that arrange a meeting  Mobile agents o Able to move between machines o May require strong mobility o Example: to “police” the Internet

Chapter 3  Processes 48 Software Agents  Interface agents o Assist users with one or more applications o Actively learns from its interactions o Example: agent that brings buyers and sellers together  Information agents o Manage info from many different sources o In distributed system, info is from physically distributed systems o Example: agent to filter spam, others?

Chapter 3  Processes 49 Software Agents  Properties of software agents Capable of learningNoAdaptive Can migrate from one site to anotherNoMobile Has a relatively long lifespanNoContinuous Can exchange information with users and other agents YesCommunicative Initiates actions that affects its environmentYesProactive Responds timely to changes in its environmentYesReactive Can act on its ownYesAutonomous Description Common to all agents? Property

Chapter 3  Processes 50 Intelligent Agents  Foundation for Intelligent Agents o FIPA  Developing general model for agents  Agents registered at agent platform  Platform provides basic services o Create and delete agents o Locate agents (directory service) o Inter-agent communication facilities

Chapter 3  Processes 51 FIPA Platform  FIPA model for an agent platform  Agent Communication Channel (ACC) o Sending messages between platforms o Uses Internet Inter-ORB Protocol (IIOP)  Chapter 9

Chapter 3  Processes 52 ACL  FIPA defines Agent Communication Language o Defines a “high level communication protocol between a collection of agents” o How does this differ from IIOP?  Separation between msg purpose and content o Header states the msg purpose o Format and language of content is left open o Need enough info in header to interpret content o Ontology: mapping of symbols to meanings

Chapter 3  Processes 53 ACL  Different “purposes” in FIPA ACL Message purposeDescription Message 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 performed Action specification SUBSCRIBESubscribe to an information source Reference to source

Chapter 3  Processes 54 ACL Example  Sender INFORMs receiver of Dutch royal genealogy  Ontology says that Prolog statements to be semantically interpreted as genealogy info FieldValue PurposeINFORM LanguageProlog Ontologygenealogy Contentfemale(beatrix),parent(beatrix,juliana,bernhard)

Chapter 3  Processes 55 Summary  Threads o Sequential programming o Parallel processing  Clients o User interface o Distribution transparency

Chapter 3  Processes 56 Summary  Servers o Efficiency more important than transparency o Interactive or concurrent? o Stateful or stateless? o Object servers  Code migration o Performance and flexibility o Strong mobility vs weak mobility o Local resources? o Heterogeneity/virtual machines

Chapter 3  Processes 57 Summary  Software agents o Autonomous and cooperative o Agent communication language (ACL) o Purpose vs content