190 likes | 297 Views
Processes. Chapter 3. Part II Clients and Servers. Clients. Main role of clients is: User Interface (UI) Client-side software UI: Major task Need not be graphical (GUI) Not all clients have UI?. The X-Window System. The basic organization of the X Window System. Client-Side Software.
E N D
Processes Chapter 3 Part II Clients and Servers
Clients • Main role of clients is: • User Interface (UI) • Client-side software • UI: • Major task • Need not be graphical (GUI) • Not all clients have UI?
The X-Window System • The basic organization of the X Window System
Client-Side Software • UI is a small part of the client-side S/W • Client S/W includes: • Local processing • Communication facilities • Client S/W should provide replication transparency when sever is replicated
Client-Side Software for Distribution Transparency Common interface to Service Client or Server side • A possible approach to transparent replication of a remote object using a client-side solution.
Client S/W - Transparency • Clients can guarantee: • Distribution, • Access, and • Failure transparency • How about: • Concurrency and • Persistence transpareny ?
Servers • A process implementing a service for clients • Server waits for client requests, service them, and repeats • Can be Sequential or Concurrent • Clients send requests to an endpoint (port) at the server machine • What if the server is assigned a dynamic port?
Servers with Dynamic Ports 3.7 • Client-to-server binding using a daemon as in DCE • Client-to-server binding using a superserver as in UNIX
Stateless versus Stateful Servers • Stateless: do not keep information on clients’ state • Stateful: maintain client’s state between different requests: • Context, transactions, user preferences, login? • Cookies
Object Servers • Tailored for distributed objects support • Provides environment for objects • Not a service by itself (government) • Services are provided by objects • Easy to add services
Activation Policies • Decisions on how to invoke objects • All objects are alike • Inflexible • Objects differ and require different policies • Object type • Memory allocation • Threading
Transient Objects • Create at the first invocation request and destroy when clients are no longer bound to it • Create all transient objects when server is initialized • Server resources? • Invocation time?
Memory Allocation • Each object has its own memory segment • Objects can share memory segments • Security? • Memory resources?
Threads • One thread in the server • Several threads in the server • Separate thread for each object • Separate thread for each request • Concurrent access? • On-demand threads or thread-pools
Object Adapters (Wrappers) • A S/W implementation of an activation policy • Generic to assist developers • Group objects per policy • Several objects under an adapter • Several adapters under a server
Object Adapter (1) • Organization of an object server supporting different activation policies.
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.
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.
Object Adapter (4) • The main part of an adapter that implements a thread-per-object policy.