13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

206 File Structures Chapter 6early version of the Ada programming language separated these marks, but the currentdesign does not.) If several processes have the same file open for reading, each has itsown read mark; operations undertaken by one process do not affect the behavior of theother one.The read/write mark of an open file is therefore part of the context block of a processand is not part of the file itself. Context blocks can be designed to contain an arrayof open-file records. (The same array can be used for open-device descriptors.) Eachrecord contains information describing the file that is open, the intent of the process(whether to read, write, and so on), the read/write mark, and information about where thefile is stored on the physical disk. The index of a particular open-file record is a convenientnumber to return to the process as the result of the Open service call. The processcan use this file number in its subsequent requests regarding the open file.Sequential access might allow each operation to transfer an arbitrary number ofbytes, or there might be a fixed-size increment (a block) that must be transferred on eachoperation. Fixed-size increments can be a characteristic of the installation, the file, or theinstance of the open file. If the increment is fixed, the read/write mark may be expressedby the number of full increments from the start of the file.3.2 Direct accessSome applications need to move the read/write mark to specific places without reading orwriting the intervening parts of the file. They might even want to move the read/writemark backward in the file. For example, a program that traverses a large data tree storedin a file might need to move to an arbitrary place in the file to find the next node of thetree. We can use a Position service call for files just as we did in Chapter 5 for devices.Position(file number, where). This call tells the file manager to position theread/write mark in the file represented by the given file number. The ‘‘where’’parameter might be specified by its location from the start of the file, the end of thefile, or the current location of the read/write mark. The distance from that locationis given as a number of fixed-size increments (perhaps bytes).3.3 Mapped accessThe Tenex and Multics operating systems provide a novel form of file access calledmapped access. When a process opens a file, the entire file is mapped into the virtualspace of the process. Instead of returning a file number, the Open service call returns asegment number. This number refers to a new segment that contains only the file. Similarly,the Dynix operating system for the Sequent Balance computer allows files that havealready been opened to be mapped into virtual store.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!