Smartphone Operating System (779883), страница 50
Текст из файла (страница 50)
This criterion is perhapsobvious, but it should be stated. Users of communications devicesexpect a level of functionality from their devices. The communications model must support this functionality and be able to address thefuture gracefully.COMMUNICATIONS MODELS231• Communications model components must be exceptionally flexibleto cope with the variety of devices that are possible for each platform.Users of computers demand a mix of connectivity methods andcommunications platforms.
The communications architecture musteasily adapt itself to the changing requirements of configuration andconnectivity. Even on-the-fly reconfiguration, for example, from a dialup connection to a wireless network, must be easy and straightforward.• Communications components must be organized to accommodatethe constant restructuring and rebuilding of communications technology. The communications architecture must be built in a modularfashion so that pieces can be replaced as technology evolves withoutupsetting the entire structure.
In fact, the structure should be able toaccommodate the coexistence of old and new pieces.• The communications components must adapt to the RAM and CPUconstraints of their intended target platforms. While they must doa great amount of work, the components of the communicationsarchitecture must not consume a burdensome amount of resources.The resources of a communications device are to be targeted at anapplication, not consumed by communications methods.This is a difficult job: support all functionality possible in a flexible,modular fashion in what can be a limited computing environment!Clients and ServersThe way computers interact – especially in a network environment – isoften characterized as a client–server type of relationship.
The client isthe computer taking advantage of a service; the server is the computerproviding that service. The client typically utilizes the service by sending requests to the server; the server provides the service, typically byresponding to those requests. The requests and responses take the formof messages sent back and forth between client and server.We have seen this relationship in many places already.
The client–server model describes a relationship like that on which a system calldepends, where the ‘client’ is a user-level application and the ‘server’ isthe kernel, providing a set of services for the kernel-level request. Theclient–server model adequately describes the server approach taken bythe design of microkernels, where taking advantage of a service meansconnecting to a server and making a request.232MODELING COMMUNICATIONSRequestEncoded RequestClientGateway ServerWAPMicrobrowserEncoding anddecoding serviceEncoded ResponseFigure 11.1HTTP ServerResponseHTML pagesCGI scripts,etc.A client–server relationshipA good communications example is a micro-browser in a WAPenabled mobile phone.
Figure 11.1 shows how this works. The phonecalls up a WML page for viewing by sending an encoded request to acomputer at the company that provides the service. This computer iscalled a gateway server, because it provides a gateway to the Internetfor the mobile phone. This server, in turn, becomes a client by passingthe request from the mobile phone on to the actual Internet server thathouses the WAP page in question. This server happens to be providinga HTTP service and answers the request by sending a web page to thegateway server.
The gateway server then translates the HTML page intoWML and encodes the response using the encryption scheme the mobilephone expects. Finally, the gateway server sends the response to themobile phone and the micro-browser displays the WML page on thephone’s display.Note that in the example, there were two clients and two servers. Thegateway server was a server to the mobile phone and a client to the HTTPserver. This is an example of a proxy server, a server that represents itsclient on another network by becoming a client itself.Communications StacksAnother way to characterize communications in an operating system isthrough a stack-based model.
A stack-based approach to communicationsrecognizes that there are many different levels that analyze and usecommunications data. Each level has its own functionality and adds itsown unique properties to the communications stream.Let’s use as an example the ISO networking model. This model isshown in Figure 11.2. Each layer in the model has a specific duty andCOMMUNICATIONS MODELSApplication LayerHigh-levelProtocolsPresentation LayerSession LayerInternetworkingProtocols233Provides access for user-orientedapplications to the networkingenvironmentProvides data representationtranslation for applicationsEstablishes and manages virtual‘connections’ betweenco-operating applicationsTransport LayerProvides reliable, transparenttransfer of data betweenendpointsNetwork LayerProvides network connectionestablishment and maintenanceData Link LayerProvides reliable transfer of dataacross the physical hardwarePhysical Hardware LayerTransfers an unstructured streamof bits over a physical mediumNetwork InterfaceProtocolsFigure 11.2The ISO protocol stack modeladds data to the communications stream to carry out that duty.
A packetof information at the application level is sent to the presentation layer.The presentation layer augments the data in some way, usually byadding information to the packet, and sends it on to the session layer.This continues until the packet reaches the bottom layer, the physicalhardware. At this point, the data stream is sent to its destination and thephysical hardware of the destination computer receives the stream. Nowthe process begins in reverse.
As the data packet is received by eachlayer, that layer strips off the data it needs, using the data to performsome function. Then what is left is sent up the stack to the next layer.By the time the packet reaches the application layer, it is comprised ofapplication data only. The effect of this type of data transfer is that eachlayer has the illusion that it is talking directly to its counterpart layer onthe destination computer.There are many examples of this way to characterize system communications. The Wireless Access Protocol (WAP) stack, shown in Figure 11.3,has a stack-based depiction.
The Bluetooth protocol stack, shown inFigure 11.4, has this type of specification as well. In all cases, regardlessof how complicated the protocol stack, the idea of moving through thestack and adding functionality to communications data applies.234MODELING COMMUNICATIONSWAE: Wireless Application EnvironmentWSP: Wireless Session ProtocolWTP: Wireless Transaction ProtocolWTLS: Wireless Transport Layer SecurityWDP: Wireless Datagram ProtocolBearer Layer: GSM, CDMA, CDPD, iDEN, etc.Figure 11.3 The WAP protocol stackThere are several advantages to this stack-based approach.
The first issomething we have just mentioned: each layer can maintain an illusionthat it is communicating solely with the same layer on another computer.Another advantage is modularity. Each layer in the communicationsmodel can be implemented by a module of some sort. That module canbe built to serve only a specific function, implementing a specific layer inthe stack. As with all modular software components, this type of designTCSBINOther transportprotocolsSDPRFCOMMLMPL2CAPAudioBasebandBluetooth RadioFigure 11.4 The Bluetooth protocol stackCOMMUNICATIONS MODELS235enhances the ability to modify only certain parts of the communicationsstack without affecting other parts. If, for example, an operating systemwere to start using IPv6 instead of IPv4 in the implementation of Ethernetnetworking, the network layer could be removed and reworked, leavingthe other layers alone.Communications AbstractionsAnother way to look at communications is to consider the abstractionsthat operating systems employ to address it.
Abstractions are often usedby operating systems to allow users to encapsulate many details into aconcise model. This concise model, while hiding many details, helps tounderstand operating system functions better.SocketsWe looked at sockets in Chapter 6 as a means of interprocess communications. Sockets are often used in general to depict the communicationsbetween computers.By way of review, sockets were invented by the designers of BerkeleyUnix and were first used as an ‘endpoint for communications’ to accessnetwork protocols. As an endpoint, a socket is not very useful.
Butwhen connected to a socket on another computer, the pair becomes acommunications channel that uses a protocol to transfer data. You canthink of sockets as two ends of a conversation and the protocol as thetranslator.Sockets assume a client–server model. The client connects its endof the socket and makes a request to the server for connection. Theserver either connects up its end and replies positively or replies thatno connection can be made. Then, if the socket has been successfullyconnected, data is exchanged across the socket.The socket model is useful as a communications model because of itsabstractness and its depiction of translation abilities.