2 Message passing
2.1 Protocols
Message passing is the simplest form of development paradigm. For example, the way that a client running a browser communicates with a web server is via message passing.
Message passing is based on the idea of a protocol: a language which embodies the functions required by one entity in a distributed system (usually a client) which another entity provides (usually a server). As an example of a protocol consider Table 1. It shows the protocol associated with a naming service. This is a service in a distributed system which associates a name with some resource in the system. For example, it might associate the location of a file within the distributed system with some symbolic name.
Table 1 An example of a simple protocol for a client of a naming service
Function | Meaning |
---|---|
Find Name | Finds the resource identified by Name |
Delete Name | Deletes the resource identified by Name |
Add Name, Resource | Adds a new resource identified by Name |
Modify Name, Resource | Changes the resource identified by Name |
Table 2 An example of a simple protocol for a server which implements a naming service
Function | Meaning |
---|---|
DeleteOK | Deletion of a resource has been carried out successfully |
AddOK | Addition of a resource has been carried out successfully |
ModifyOK | Modification of a resource has been carried out successfully |
Error Errorcode | An error has occurred, the nature of the error can be found within the error code value |
Resource Resourcedetails | A find has been carried out successfully and the resource returned by the client and associated with the name provided |
Effectively a naming service provides a lookup service for a distributed system. A client using the naming service detailed in Table 1 would communicate with the server implementing the naming service using sockets. It would send messages such as
to delete a name/resource pair identified by the string DepartmentX and
to find details of the resource(s) identified by the string DepartmentY.
Table 1 shows only one half of a protocol: that associated with client messages; most protocols will also contain the messages sent by a server. For example, Table 2 shows a selection of messages which could be sent by the server implementing the name service.
For example, if a client asked for a resource associated with a name using a message and that resource was successfully identified by the server implementing the name service, then the server would return with the string
where was the details of the resource associated with the name provided by the
message that was issued.
The best known naming service is the domain naming system in the Internet which associates domain names with IP addresses. However, many distributed systems contain their own naming service for resources such as files and collections of data. Such a service provides a simple way of insulating a distributed system from changes in physical details, for example when a file is moved from one computer to another. For example, a naming service might provide lookup for the symbolic names of files which are stored at a server in a distributed system. Every program which accessed files would consult the naming service before carrying out any processing. If a file location changed then all that would change would be the data held by the naming service, the programs which accessed the files would not need to be changed.
Naming and directory services
You will often come across the term ‘directory service’ in the literature. Such a service is a type of very flexible, naming service which contains data about the resources and users of a distributed system. For example, if you want to write a program which discovers what the fastest printer is in a distributed system then the program will consult a directory service. Almost certainly one of the most popular directory services is LDAP (Lightweight Directory Access Protocol). Its roots lie in the development of the OSI Reference Model when a standard called X500 was developed as a part of the OSI effort. Unfortunately X500 was far too complicated and heavy in terms of facilities, even for large distributed systems, and a number of much lighter directory services have emerged over the last decade and become popular. These include LDAP, Novell Directory Services (NDS), Sun's Network Information Services (NIS and NIS+) and the Windows NT Domains from Microsoft. Java has a standard API known as JNDI (Java Naming and Directory Interface) which is able to interface with all these directory services.