Concepts with Symbian OS (779878), страница 47
Текст из файла (страница 47)
Additional hardware is required toresolve this race condition.Another way to distribute memory is to allow each computer inthe network to have its own memory, but all processors can accessa large, conceptually shared memory. This shared memory can be aphysical-storage medium or can be distributed amongst all the processors. In the former case, cache flushing and synchronized accessbecome very important.
In the latter case, the abstraction of having alarge memory is implemented by passing requests for memory betweenprocessors.In all cases of shared memory, memory coherence is an importantissue. Memory coherence has the same issues that multiple processeshave when updating memory: computers that access shared, distributedmemory must be properly synchronized. In the distributed case, however,proper synchronization involves a lot of message passing to ensurememory updates.Networked File SystemsNetworks extend file systems by implementing distributed file systems(DFS). A distributed file system adds a new implementation under thetypical abstraction of a file system.
A DFS is certainly implementeddifferently from a local file system but it looks the same to the user of thefile system.In order to be shared, a file system must be implemented and housedon a computer. This file server would be the source of the files and wouldprovide the interface through which other operating systems wouldaccess them. Other operating systems that need to access such shared filesystems are the clients in this arrangement.
As we have discussed before,abstraction is heavily used here, which enables the file server to make fileservice available from a number of different sources. Any number of filesystems – with any number of local implementations – could be sharedthrough a file-service interface.To maximize the abstract qualities of distributed file systems, namingis an important issue to consider. There are two properties of namemappings for a DFS that we need to pay attention to:EXTENDING COMPUTERS IN A CONNECTED ENVIRONMENT223• location transparency: the name of a file does not reveal the locationof the file’s physical storage• location independence: the name of the file does not need to bechanged when a file’s physical location changes.Most DFS implementations provide for location transparency but notfor location independence. Consider, for example, the way that MicrosoftWindows maps a file. Windows associates a drive letter with a filesystem from a local storage medium or a DFS, providing location transparency.
It is impossible to tell from the name whether E:\ProgramFiles\Warrant\playit.exe comes from a local drive or a file serverover the network. However, for a file to change its location – that is, itsdrive letter – a user must disconnect the drive letter from the file system,then remap the drive letter to a new file system. It is not possible for afile to migrate between storage locations in Windows and not notice thatmigration in the DFS implementation.Storage-free computersDistributed file systems make it possible to get files from servers housedremotely on a network. What would happen if a system were to get all itsfiles remotely from file servers?Such diskless computers are in wide use today.
They have no diskbased storage of their own; they get all their storage from servers on anetwork. This configuration has ramifications for operating systems. Forexample, where is the operating system stored if there is no local storage?Usually there is a small amount of boot code stored locally in the device’sROM that directs the system to find the remainder of the operating systemcode on a file server. Security also becomes a very important issue here.Not only is user security important but machine security is important. If acomputer can masquerade as another on the network, it can boot as theother computer and access its files.As with memory, caching is a way to speed up the relatively slowpaced storage I/O.
And, as with memory, caching poses a problem withshared storage: caching must be flushed rapidly to provide consistencybetween all the computers that are sharing data. This flushing is controlledby the operating system, which can adopt any of a number of differentpolicies. Write-through caching is the simplest approach, where data iswritten to the storage medium immediately it is placed in the cache.
Thisis a reliable approach but has poor writing performance, as cache writes224NETWORKSmust endure the latency of writing to a remote file server. Delayed-writecaching delays writing to the remote file server until multiple writescan happen or latency can otherwise be minimized. Delayed writes arebetter in that writes can happen more quickly (on average), but theseschemes can have reliability problems, since unwritten data can belost if the local computer crashes. Write-on-close caching writes datawhen the file is closed. This speeds up access even more, allowing forrecent writes to overwrite old data in a cache and saving all sloweraccess for times after a file is not being accessed.
However, files thatare open for longer periods of time suffer coherency problems from thisscheme.File replication is a way for remote file servers to increase performance.When file servers replicate files between many locations, multiple clientscan choose where to get files from (presumably the closest server for fastestaccess).
Again, abstraction of replication details away from the user meansthat the user has no idea where a file comes from. Allowing the operatingsystem to make the choice adds overhead to the implementation as well.The operating system must keep track of performance measures, such as‘distance’ of a file (measured in time taken to obtain it) and response timeof the file server. In addition, updating a file in this environment is evenmore of a problem than with caching. Replicating a file means that theversion of a file written to a file server must immediately be replicatedand sent to all file servers holding duplicate copies. This action takestime, yet the abstraction used means that file updating is immediate. Thissituation is often remedied by influencing clients to get updated copies ofa file from the file server on which it was last updated until all the copieshave propagated.A stateful file service is one where the file server traces each file beingaccessed by a client, keeping track of file positioning and how muchdata has been read from that file.
A stateless file service is one whereany block on a storage medium can be requested and sent without anyfurther semantic understanding as to the organization of the block ina file. There are two big differences between these two services. First,this determination affects which side keeps track of the file position foroperations. If the file server maintains all the information about a file andwhich data in the file has been read or written, the client does not haveto and the protocol used can be minimized. In a stateless environment,the client is responsible for maintaining an understanding of files andhow much data has been read.
The other difference is in reliability. If astateful server crashes, all information about the file and its updates areEXTENDING COMPUTERS IN A CONNECTED ENVIRONMENT225lost.2 If a stateless server crashes, minimal information is lost and servicecan simply pick up where it left off when the server comes back online.While stateless service might seem to be more robust, stateful servicemight be warranted under certain situations.
For example, some implementations of file replication implement cache writes and validation uponthe server’s request. In this case, stateless service cannot be used, sincethe server would maintain knowledge of the files being updated andwould have to determine when to request cache writing.Implementations of DFSThere are several DFS implementations available for modern operatingsystems. By far, the two most widely used are Server Message Block (SMB)and Network File Services (NFS).SMB is a protocol for sharing files, printers, serial ports and communications abstractions such as named pipes and mail slots betweencomputers.
It debuted in 1985 as a sharing protocol from IBM and wasfurther developed by Microsoft as the Microsoft Networks/OpenNET-FileSharing Protocol from 1987. SMB has seen several different implementations: Samba is an open-source implementation and CIFS is the mostrecent implementation of the protocol by Microsoft.NFS is a protocol originally developed by Sun Microsystems, debutingaround 1984. NFS is one of many protocols built on the Open NetworkComputing Remote Procedure Call system (ONC RPC).Other DFS implementations include the Andrew File System (AFS),designed for the Andrew distributed-computing system at Carnegie Mellon University and AppleTalk, a sharing protocol designed for MacOS.Communicating with Networked DevicesNetworks have extended input/output mechanisms by allowing remotedevices to communicate in abstract ways and to share any kind ofinformation.
There have been several extensions to generalize I/O usingnetworks.General communication has been enhanced by the use of the socketnetwork abstraction. As we described in Chapter 6, sockets were inventedby the designers of Berkeley Unix as ‘endpoints for communication’. As an2There are systems that can prevent a stateful crash from losing data. Fault-tolerantsystems implement continuous update and refreshing of file systems.226NETWORKSendpoint, a socket is not very useful. When connected to another socketon another computer, the pair becomes a communication channel thatuses a protocol to transfer data. Sockets are two ends of a conversationand the socket protocol is the translator.The beauty of the socket model is in its abstractness and its translationabilities. The abstractness of the model can be seen in how it is used:each side simply writes data to and reads data from a socket as if itwere any other local I/O device.