Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processes Chapter 3.

Similar presentations


Presentation on theme: "Processes Chapter 3."— Presentation transcript:

1 Processes Chapter 3

2 Chapter Outline Processes versus threads Client Organization
Server Organization Code Migration

3 Why Threads? Implications
Granularity of processes in existing operating systems not sufficient for efficient processor utilization. Threads do not attempt to achieve a high degree of concurrency transparency A thread context is very small in comparison to a process Implications performance of a multi-threaded application usually better than a single threaded counterpart. Threads are not automatically protected against each other so development of multi-threaded applications slightly harder

4 Thread Usage in Nondistributed Systems
Context switching as the result of IPC

5 Thread Implementation
User-level threads Cheap to create and destroy threads Switching thread context involves only switching thread stack Invocation of a blocking system call blocks the entire process Kernel-level threads Every thread operation carried out by kernel Switching thread context is expensive Light weight processes (LWP) A hybrid between user-level and kernel-level threads Executes in the context of a process, and there can be several LWPs per process

6 Thread Implementation
Combining kernel-level lightweight processes and user-level threads.

7 Clients X Window System Client side transparency
Performance and correctness Location transparency Migration Transparency Relocation Transparency Replication Transparency Concurrency Transparency

8 The basic organization of the X Window System

9 Client-Side Software for Distribution Transparency
A possible approach to transparent replication of a remote object using a client-side solution.

10 A multithreaded server organized in a dispatcher/worker model.
Concurrent Servers A multithreaded server organized in a dispatcher/worker model.

11 Servers: General Design Issues
3.7 Client-to-server binding Globally known end points End point Table Super Servers Server State

12 Object Adapter (1) Organization of an object server supporting different activation policies.

13 Object Adapter (2) /* Definitions needed by caller of adapter and adapter */ #define TRUE #define MAX_DATA 65536 /* Definition of general message format */ struct message { long source /* senders identity */ long object_id; /* identifier for the requested object */ long method_id; /* identifier for the requested method */ unsigned size; /* total bytes in list of parameters */ char **data; /* parameters as sequence of bytes */ }; /* General definition of operation to be called at skeleton of object */ typedef void (*METHOD_CALL)(unsigned, char* unsigned*, char**); long register_object (METHOD_CALL call); /* register an object */ void unrigester_object (long object)id); /* unrigester an object */ void invoke_adapter (message *request); /* call the adapter */ The header.h file used by the adapter and any program that calls an adapter.

14 The thread.h file used by the adapter for using threads.
Object Adapter (3) typedef struct thread THREAD; /* hidden definition of a thread */ thread *CREATE_THREAD (void (*body)(long tid), long thread_id); /* Create a thread by giving a pointer to a function that defines the actual */ /* behavior of the thread, along with a thread identifier */ void get_msg (unsigned *size, char **data); void put_msg(THREAD *receiver, unsigned size, char **data); /* Calling get_msg blocks the thread until of a message has been put into its */ /* associated buffer. Putting a message in a thread's buffer is a nonblocking */ /* operation. */ The thread.h file used by the adapter for using threads.

15 Object Adapter (4) The main part of an adapter that implements a thread-per-object policy.

16 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.

17 Models for Code Migration
Alternatives for code migration.

18 Migration and Local Resources
Resource-to machine binding 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) GR RB (or GR) Process-to-resource binding Actions to be taken with respect to the references to local resources when migrating code to another machine.

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

20 References Lecture slides of Distributed Systems principles and paradigms by Andrew Tannenbaum and Van Steen, Prentice Hall India, 2002.


Download ppt "Processes Chapter 3."

Similar presentations


Ads by Google