caching in the sprite network file system  this paper describes a simple distributed mechanism for caching files among a networked collection of workstations. we have implemented it as part of sprite, a new operating system being implemented at the university of california at berkeley. a preliminary version of sprite is currently running on sun-2 and sun-3 workstations, which have about 1-2 mips processing power and 4-16 mbytes of main memory. the system is targeted for workstations like these and newer models likely to become available in the near future; we expect the future machines to have at least five to ten times the processing power and main memory of our current machines, as well as small degrees of multiprocessing. we hope that sprite will be suitable for networks of up to a few hundred of these workstations. because of economic and environmental factors, most workstations will not have local disks; instead, large fast disks will be concentrated on a few server machines.  in sprite, file information is cached in the main memories of both servers (workstations with disks), and clients (workstations wishing to access files on non-local disks). on machines with disks, the caches reduce disk-related delays and contention. on clients, the caches also reduce the communication delays that would otherwise be required to fetch blocks from servers. in addition, client caches reduce contention for the network and for the server machines. since server cpus appear to be the bottleneck in several existing network file systems [saty85, lazo86], client caching offers the possibility of greater system scalability as well as increased performance.  sprite uses the file servers as centralized control points for cache consistency. each server guarantees cache consistency for all the files on its disks, and clients deal only with the server for a file: there are no direct client-client interactions. the sprite algorithm depends on the fact that the server is notified whenever one of its files is opened or closed, so it can detect when concurrent write-sharing is about to occur.  sprite handles sequential write-sharing using version numbers. when a client opens a file, the server returns the current version number for the file, which the client compares to the version number associated with its cached blocks for the file. if they are different, the file must have been modified recently on some other workstation, so the client discards all of the cached blocks for the file and reloads its cache from the server when the blocks are needed. the delayed-write policy used by sprite means that the server doesn't always have the current data for a file (the last writer need not have flushed dirty blocks back to the server when it closed the file). servers handle this situation by keeping track of the last writer for each file; when a client other than the last writer opens the file, the server forces the last writer to write all its dirty blocks back to the server's cache. this guarantees that the server has up-to-date information for a file whenever a client needs it.  the file system module and the virtual memory module each manage a separate pool of physical memory pages. virtual memory keeps its pages in approximate lru order through a version of the clock algorithm [nels86]. the file system keeps its cache blocks in perfect lru order since all block accesses are through the "read" and "write" system calls. each system keeps a time-of-last- access for each page or block. whenever either module needs additional memory (because of a page fault or a miss in the file cache), it compares the age of its oldest page with the age of the oldest page from the other module. if the other module has the oldest page, then it is forced to give up that page; otherwise the module recycles its own oldest page.  we used a collection of benchmark programs to measure the performance of the sprite file system. on average, client caching resulted in a speedup of about 10-40% for programs running on diskless workstations, relative to diskless workstations without client caches. with client caching enabled, diskless workstations completed the benchmarks only 0-12% more slowly than workstations with disks. client caches reduced the server utilization from about 5-18% per active client to only about 1-9% per active client. since normal users are rarely active, our measurements suggest that a single server should be able to support at least 50 clients.  we also compared the performance of sprite to both the andrew file system [saty85] and sun's network file system (nfs) [sand85]. we did this by executing the andrew file system benchmark [howa87] concurrently on multiple sprite clients and comparing our results to those presented in [howa87] for nfs and andrew. for a single client, sprite is about 30% faster than nfs and about 35% faster than andrew. as the number of concurrent clients increased, the nfs server quickly saturated. the andrew system showed the greatest scalability: each client accounted for only about 2.4% server cpu utilization, vs. 5.4% in sprite and over 20% in nfs.  m. nelson b. welch j. ousterhout