1 / 54

5. Processes

5. Processes. Process. OS DS manage & schedule + migrate process process & I/O overlap +process & comm. overlap / agent. addr.space. thread. process. 5.1 Threads in distributed systems. Share one address space, running in quasi- parallel.

Télécharger la présentation

5. Processes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 5. Processes

  2. Process OS DS manage & schedule + migrate process process & I/O overlap +process & comm. overlap / agent

  3. addr.space thread ... process 5.1 Threads in distributed systems Share one address space, running in quasi-parallel. Blocking system call won’t block the entire process

  4. 2. Multithreaded clients P142 • Example, web browser A web document = plain text + a collection of images, icon… As soon as main HTML file has been fetched: connect server, read a file0, display connect server, read a file1, display connect server, read a file2, display … …

  5. A blocking call to set up a connection and read data doesn’t suspend the entire process Browser Server

  6. 20 3. Multithreaded servers • Example, file server FTPd C1 C2 21 ..1 ..2 IPC1 IPC2 IPS

  7. P143 A multithreaded server organized in a dispatcher/worker model.

  8. … /log.html .HTML … /a.asp .HTML … /applet applet 5.2 Code migration P158 3.2, 3.3x Examples: applet, agent, patch Three Web documents: • Static C S • Dynamic C S execute • Active C S take and send

  9. Dataset Text documents, numerical data, etc. Client/Proxy Server Dataset Client/Proxy Server Save network bandwidth

  10. Why migrate code? Applet, agent, process • flexibility: download applet, patch • parallelism: send processes to other machines or send agents to search for information • performance: reduce communication, load balance • failure transparency: transfer processes to other machine

  11. P160 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.

  12. What are difficulties? • different machine ? What form? • local resources used ? • process is running ? When? 1. Models for code migration P160 framework: a process consists of • code segment/data • resource segment • execution segment program references to external resources: file, printer, other processes, port current execution state: private data, stack, program counter

  13. P162 Models for Code Migration agent Alternatives for code migration. applet applet I’m busy process I’m idle

  14. weak mobility: transfer only code segment (applet) • strong mobility: execution segment is transferred (process) • sender-initiated mobility: P161 (I’m too busy) • receiver-initiated mobility: (I’m idle)

  15. 1234 migrate ? 2345 2. Migration and local resources Programs usually use various resources, such as • file, database, URL • printer, TCP ports, library, … What are solutions? P164

  16. URL migrate URL migrate Lib GR Identifier GR value Lib

  17. migrate GR f1 Move or copy migrate RB f1 printer type of device printer Resource segment can’t always be transferred without being changed -- need change references to resources

  18. Three types of process-to-resources binding. reference How deal with the reference to resources when migrating code? • binding by identifier require precisely the referenced resource. URL, IP • binding by value only need value. dictionary, library... • binding by type only need a resource of a specific type. printer,..

  19. Unattached Fastened Fixed 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 GR RB (or GR) P164 Three types of resources-to-machine binding. • fixed: printer, port no., RAID • fastened: database • unattached: files associated only with program Resource-to machine binding Process-to -resource binding Actions to be taken with respect to the references to local resources when migrating code to another machine.

  20. Establish a global reference (GR) • move the resource (MV) • copy the value of the resource (CP) • rebind process to locally available resource (RB) • applet – • virus – GR local, GR

  21. S S S S S S 2000.2.7 distributed denial of service (分布式拒绝服务) c 黑客 Yahoo 目标: Yahoo 有安全漏洞的系统

  22. P165 3. Migration in homo/heterogeneous systems Issues which must be considered: 1) What kind of code to move? • binary code • source code • intermediate code 2) When to move? • before executing weak mobility • during executing strong mobility(homogeneous) • at any point in the execution of a program • only at specific points

  23. Platform specific Problem to be solved in strong mobility Execution segment is dependent on platforms. . Stack Register values, program counter To avoid having execution depend on platform- specific, migration can take place only when a next subroutine is called

  24. local var local var L b a swap 146 b a Example 3000 Stack Main( ) 100: op …, … { 110: load $R1, pi area=pi*r*r 114: mul $R1, r … … swap(a, b) 130: push a … 134: push b } 138: push return addr void swap(u,v) 142: goto swap { int t; 146: op …, … … } 200: swap 204: … Label table name offset main 0 swap 100 L 46

  25. P167 • The principle of maintaining a migration stack to support migration of an execution segment in a heterogeneous environment 3-15

  26. What do we need for migration? memory address identifier, label • Migration stack • migration stack is its own copy of the program stack, but in a machine-independent way. • It is updated when a subroutine is called, or return from a subroutine • Runtime system for migration

  27. Jobs of runtime system 1) When a subroutine is called, • marshal the proper data in stack (of which the return address is change into a jump label) • marshaled data are pushed onto the migration stack, along with an identifier for the called subroutine

  28. 2) When migration takes place, • marshal all global program-specific data forming part of execution segment • marshaled data are transferred to destination, along with the migration stack

  29. Destination node performs • load the code segment • marshaled data are unmarshaled (global data) • a runtime stack is constructed by unmarshaling the migration stack • execution is resumed by entering the subroutine

  30. Modifying compiler P167 • generate code to update migration stack whenever a subroutine is entered or exited (via a runtime system) • generate labels in the caller’s code, instead of return address (machine-independent) • need a runtime system About implementation • use a preprocessor to insert the necessary code

  31. 5.3 Software Agent P173 Basic component for constructing software statement -> procedure ->object ->? Their features: • not autonomous • passive object (can’t actively do something) • cooperative way is single: invocation (can’t request or query)

  32. 1. Introduction What is a software agent? • An agent is a process that acts autonomously on behalf of a person or organization (AI). • A mobile agent is an agent that is not bound to the system where it begins execution. It has the unique ability to transport itself from one system in a network to another.

  33. Types • task agent: arrange a meeting • interface agent: assist user in the use of applications (learning capability) • information agent: manage information • stationary ~ : ordering, filtering, … • mobile ~ : roam the network to collect information move data ---> move function

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

  35. 2. Distributed computing models • C/S model • static • data movement causes high network load • RPC and RMI • interoperability, not smart object • passive, not cooperative • new model? • cooperative • active

  36. Dataset Text documents, numerical data, etc. Client/Proxy Server Dataset Client/Proxy Server Save network bandwidth

  37. Dataset Dataset Dynamically selected proxy site Dataset

  38. Move to better location Chat server (a “reflector”)

  39. Questions 1. What issues do we need to deal with when a chat server moves to a better location? • how find the better location • code migration 2. What kind of migration is it? P162 strong mobility---sender-initiated---migrate process 3. What kinds of resources does the process use?

  40. 4. What kind of process-to-resource binding and resource-to-machine binding? P164 Suggest your scheme to solve the issues

  41. 3. Agent Technology -- implementation P175 It is better to have a general-purpose platform to support agent system. An agent platform(server) should accept and manage agents, so it should provide: • create and delete agents • locate agents • inter-agent communication • move agent?

  42. a special port • The general model of an agent platform (adapted from [fipa98-mgt]).

  43. Agent management component • create and delete agents • keep track of agents • look up a specific agent • local directory service • agents can look up what other agents on the platform offer • agent communication channel • take care of all communication between agents (or platforms)

  44. registernode currentnode -层次式通信框架 • 寻址示例: • Agent A->Agent B A: send(B, M) • A、B同在一个节点:本地通信 • A的名:A:202.119.36.170/100232:202.119.36.131 • B的名:B:202.119.36.136/100247:202.119.36.131 • A、B不在一个节点:远程通信 • A的名:A:202.119.36.170/100232:202.119.36.130 • B的名:B:202.119.36.136/100247:202.119.36.135

  45. -层次式通信框架 A:send(B,M) A:202.119.36.170/100232:202.119.36.131 B:202.119.36.136/100247:202.119.36.131 B A 202.119.36.131 得到B,M 查B在本节点 将M交给B Agent列表: A:202.119.36.170/100232:202.119.36.131 B:202.119.36.136/100247:202.119.36.131

  46. M M -层次式通信框架 A的名:A:202.119.36.170/100232:202.119.36.130 B的名:B:202.119.36.136/100247:202.119.36.135 A 202.119.36.130 A:send(B,M) 202.119.36.136 0:截获通信请求 1:发现B不在本地 2:向B的出生地136请求B的当前位置 3:136上的communicator接受请求,向Home查询,得到B的位置为135 4:向130上的communicator回复:135 B 202.119.36.135

  47. -层次式通信框架 • 特点: • 由Communicator集中进行寻址和消息路由,而不是由agent获得目标地址后自行建立连接发送消息 • 优点: • 名全局唯一 • 使用方便 • 寻址透明 • 功能可扩充

  48. Performative Content description purpose | action 4. Agent Communication Languages • Message types the kind of information that agents communicate is quite different from what we discussed before. • Message form

  49. Message purpose (performative) 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 Agent Communication Languages • Examples of different message types in the FIPA ACL [fipa98-acl], giving the purpose of a message, along with the description of the actual message content.

  50. ACL does not prescribe the format and language in which the message content is expressed. As long as the agents have a common understanding how to interpret the data. • Example

More Related