Processes - PowerPoint PPT Presentation

About This Presentation
Title:

Processes

Description:

Processes Chapter 3 Introduction A process is a program in execution For OS important issues are Management of processes Scheduling of processes In dist systems ... – PowerPoint PPT presentation

Number of Views:147
Avg rating:3.0/5.0
Slides: 58
Provided by: Tjad
Learn more at: http://www.cs.sjsu.edu
Category:

less

Transcript and Presenter's Notes

Title: Processes


1
Processes
  • Chapter 3

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

3
Topics Covered
  • Threads
  • Clients
  • Servers
  • Code Migration
  • Software Agents

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

5
Threads
  • Thread is like a (sub)process
  • But, OS does not provide concurrency transparency
    between threads
  • For example, dont protect data from access by
    other threads within a process
  • Plusses?
  • Efficiency
  • Minuses?
  • More work for application developer

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

7
Interprocess Communication
  • If separate processes, 3 context switches
  • If same process, but separate threads, more
    efficient

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

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

10
Threads and LWPs
  • A bunch of LWPs hang around
  • LWPs grab threads as needed

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

12
Multithreaded Servers
  • Multithreaded server
  • dispatcher/worker model

13
Multithreaded Servers
Model Characteristics
Threads Parallelism, blocking system calls
Single-threaded process No parallelism, blocking system calls
Finite-state machine Parallelism, nonblocking system calls
  • Three ways to construct a server
  • Single thread ? process stalls
  • Finite state machine ? hard to program
  • Threads ? totally awesome, dude
  • Threads rule!

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

15
Clients
  • Client interacts with user and server
  • UI is sometimes simple
  • Cell phone
  • Sometimes UI is not-so-simple
  • X Window System

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

17
X Window System
  • Organization of X Window System

18
Client-Side Transparency
  • Consider ATM and TV set-top box
  • For these, UI is small part of client side
  • 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)
  • And not so important

19
Client-Side Transparency
  • Access transparency
  • Client stub (middleware)
  • Location, migration, and relocation transparency
  • Naming
  • Replication transparency
  • One approach is on next slide

20
Client-Side Transparency
  • Replication transparency
  • Client (stub) invokes object on all replicas
  • Collects responses and passes one result to client

21
Client-Side Transparency
  • Failure transparency
  • Client middleware repeatedly attempt to connect
    to server
  • Client middleware tries another server
  • Client provides cached result
  • Concurrency/persistence transparency
  • ?????

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

23
Servers
  • Requests arrive at an endpoint
  • Port
  • How does client know endpoint?
  • Well-known
  • Some service to look it up
  • Superserver serves servers
  • Listens for a bunch of servers

24
Client-to-Server Binding
  1. Client-to-server binding using a daemon as in DCE
  2. Client-to-server binding using a superserver as
    in UNIX

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

26
Stateless vs Stateful
  • Stateless vs stateful server
  • What if server crashes
  • Stateless?
  • No problem, just restart
  • Stateful?
  • Big problems
  • Security of stateless vs stateful?

27
Object Server
  • Server designed for dist objects
  • a place where objects live
  • Easy to change services on server
  • Read Section 3.3.2

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

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

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

31
Reason for Migrating Code
  • Dynamically configuring client
  • Client fetches necessary software
  • Then client contacts server

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

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

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

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

36
Models for Code Migration
  • Alternatives for code migration

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

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

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

40
Migration and Local Resources
Resource-to machine binding
Fixed
Attached
Unattached
Process-to-resource binding
GR 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
  • GR ? establish global systemwide reference
  • MV ? move the resource
  • CP ? copy the file to the resource
  • RB ? rebind process to locally available resource

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

42
Migration in Heterogeneous Systems
  • Maintaining a migration stack to support
    migration of an execution segment
  • Can be done in C/C

43
Migration in Heterogeneous Systems
  • Migration in heterogeneous systems
  • Basic problem is similar to portability
  • What is the solution for portability?
  • Virtual machine is one solution
  • So similar solution should work here

44
Code Migration in D'Agents
  • Middleware approach
  • Supports various forms of code migration
  • Read it!

45
Software Agents
  • So far
  • Threads
  • Clients
  • Servers
  • Mobility
  • And now for something completely different
  • Software agents

46
Software Agents
  • Software agents ? no precise definition
  • Autonomous agents capable of performing a task
    in collaboration with other, possibly remote,
    agents
  • 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

47
Software Agents
  • Collaborative agents
  • Agents that work together as part of multiagent
    system
  • Example agents that arrange a meeting
  • Mobile agents
  • Able to move between machines
  • May require strong mobility
  • Example to police the Internet

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

49
Software Agents
Description
Common to all agents?
Property
Can act on its own
Yes
Autonomous
Responds timely to changes in its environment
Yes
Reactive
Initiates actions that affects its environment
Yes
Proactive
Can exchange information with users and other
agents
Yes
Communicative
Has a relatively long lifespan
No
Continuous
Can migrate from one site to another
No
Mobile
Capable of learning
No
Adaptive
  • Properties of software agents

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

51
FIPA Platform
  • FIPA model for an agent platform
  • Agent Communication Channel (ACC)
  • Sending messages between platforms
  • Uses Internet Inter-ORB Protocol (IIOP) ? Chapter
    9

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

53
ACL
Message purpose Description Message Content
INFORM Inform that a given proposition is true Proposition
QUERY-IF Query whether a given proposition is true Proposition
QUERY-REF Query for a give object Expression
CFP Ask for a proposal Proposal specifics
PROPOSE Provide a proposal Proposal
ACCEPT-PROPOSAL Tell that a given proposal is accepted Proposal ID
REJECT-PROPOSAL Tell that a given proposal is rejected Proposal ID
REQUEST Request that an action be performed Action specification
SUBSCRIBE Subscribe to an information source Reference to source
  • Different purposes in FIPA ACL

54
ACL Example
Field Value
Purpose INFORM
Sender max_at_http//fanclub-beatrix.royalty-spotters.nl7239
Receiver elke_at_iiop//royalty-watcher.uk5623
Language Prolog
Ontology genealogy
Content female(beatrix),parent(beatrix,juliana,bernhard)
  • Sender INFORMs receiver of Dutch royal genealogy
  • Ontology says that Prolog statements to be
    semantically interpreted as genealogy info

55
Summary
  • Threads
  • Sequential programming
  • Parallel processing
  • Clients
  • User interface
  • Distribution transparency

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

57
Summary
  • Software agents
  • Autonomous and cooperative
  • Agent communication language (ACL)
  • Purpose vs content
Write a Comment
User Comments (0)
About PowerShow.com