Next: Clusters
Up: Client/Server Systems
Previous: Middleware
A Client Server Framework for Parallel Applications
Figure 4:
Supervisor workers model in client server.
|
- Parallel applications can be designed using the client/server model.
- A client may divide a big application into several smaller problems that can be processed by multiple servers simultaneously. All the servers compute the solution to their respective problems and send their results to the client. The client assembles the results
from each server and outputs the final result to the user.
- The client acts as the master (supervisor) while the servers act as the slaves (workers) in the master-slave (supervisor?workers) model as shown in Fig. 4. The steps taken at the client and each server are summarized as follows.
- Client (Supervisor);
- Client creates an array of sockets and input/output data streams with all the servers. Optimally, the client should spawn a thread for each available server, which would then make connections with an individual server.
- Client passes control to the client body, which contains the code specific to the
application being executed in parallel. Mainly, it divides the main task into smaller portions and passes one small portion of the task to each server. It then waits for all the servers to send back the result of their smaller computations. Finally it merges the results of each server and computes the final solution to the big problem.
- Client closes all the streams and sockets with all the servers.
- Server (Worker)
- Server creates a server socket on an unused port number.
- Server waits for connections on that port. Once it gets a request from a client, it accepts that connection.
- Server creates input and output data streams for that socket. This establishes the foundation for communication between the server socket and the client.
- Server passes control to the server body, which contains the code specific to the application executed in parallel. The main server would accept the connection from the client, create a socket, and invoke the server body thread to handle that client.
- Server goes back and waits for another connection from a client.
Next: Clusters
Up: Client/Server Systems
Previous: Middleware
Cem Ozdogan
2006-12-27