120 likes | 162 Views
Processes. Threads & OS Threads in distributed systems Object servers Code migration Software agents. Threads. Idea – we build virtual processors in software Processor, processes and threads Context switch Process and thread context Observations Threads shared the same address space
E N D
Processes Threads & OS Threads in distributed systems Object servers Code migration Software agents
Threads • Idea – we build virtual processors in software • Processor, processes and threads • Context switch • Process and thread context • Observations • Threads shared the same address space • Process switching involves getting the OS in the loop - >$ • Creating and destroying threads is cheaper than doing so with processes • Threads and the OS • User or kernel threads? • Two level threading and scheduler activations
Threads in Distributed Systems • Multithreaded clients – to hide network latency • Web client • RPCs • Multithreaded servers – improve performance & structure • Starting a thread is cheaper than starting a process • A single-threaded server is a problem for scalability • Move on to next request instead of waiting • Using blocking calls simplifies overall structure • Simplified flow control (?)
Alternatives to Threaded Servers • Alternatives • Problems with threads? • Hard to program: synchronization & deadlocks • Hard to debug: data and timing dependencies • Hard to get good performance • Should you abandon threads? No – but avoid them if you can
Servers – Design Issues • General organization • Basic model & superservers (inetd) • Out-of-band communication • Use a separate port • Use a special message • State • Stateless – no memory/no problem • Stateful – faster + reliability headache • Object servers • Objects – data/state + method • Transient and persistent objects, thread per object or per invocation … • Activation policies and object adapters
Code Migration • Why? • Performance • Flexibility • Models • Process segments: • Code: set of instructions • Resource: external resources needed (files, printers, …) • Execution: current execution state • ...
Migration and Local Resources • Problem: what if resources are not available at target? • Type of resources: • Fixed: it cannot be migrated • Fastened: it can but it will cost you a lot • Unattached: easy to move Resource-to machine binding Process-to-resource binding MV: just move it GR: Establish global systemwide refer CP: Copy the value of the resource RB: Re-bind to a locally available resource
Migration in Heterogeneous Systems • Main problem: • Target machine may not be suitable to run it • The def. of process/thread/processor context is highly dependent on HW/OS/Runtime system • One solution: use abstract machine • Current solutions: • Interpreted languages running on virtual machine • State the migration points
What’s an Agent? • Def.: Autonomous process that can react/initiate changes in its environment, possible in collaboration • Collaborative agents • Mobile agents • Interface agents • Information agents
Agent Technology • Management: Keeps track of where the agents on this platform are • Directory: Mapping of agents names and attributes to agent IDs • ACC: Agent Communication Channel – used to communicate with other platforms
Agent Communication Languages • ACL is application-level protocol making distinction bet/ purpose and content of msg.