1

From Tanenbaum's Modern Operating Systems about operations on files:

  1. Open. Before using a file, a process must open it. The purpose of the open call is to allow the system to fetch the attributes and list of disk addresses into main memory for rapid access on later calls.
  2. Close. When all the accesses are finished, the attributes and disk addresses are no longer needed, so the file should be closed to free up internal table space.

What is "internal table"?

I didn't find "internal table" defined before I read the quote in the book. Is it also called by other name(s)?

Is it in the main memory, and specifically created for a file?

Thanks.

Tim
  • 1
  • 141
  • 372
  • 590

2 Answers2

1

For every open file the operating system maintains a service structure that is used to keep track of that file, it's file position, open mode, etc. Once you close the file that structure is no longer needed and is discarded. That's what that phrasing refers to - on some OSes that will be done using something called internal table space but that's an implementation detail.

Here's a good answer to a related question.

Community
  • 1
  • 1
sharptooth
  • 167,383
  • 100
  • 513
  • 979
  • Is the internal table for a file same as the file descriptor of the file? – Tim Mar 23 '15 at 23:12
  • @Tim Usually no. Descriptor is usually a magic value which you use to identify an open file in your program. Like you ask the OS "could you open that file for me, please" and the OS call returns some `FILE*` or `void*` or whatever which you cannot use for anything else except calls to read-write and "close file" functions. – sharptooth Mar 24 '15 at 07:21
1

Usually, there is support for multiple levels of data structures for accessing a file. In unix there are typically two levels: Operating System and Library. In VMS, there are three levels. System Services, RMS, and Library.

At the system level the file becomes a logical device. (Unix, unusually, keeps track of the read position at the this level).

The Record level access can be found in some systems (IBM, VMS). That is used where the file system supports multiple file structures (e.g., stream, fixed, variable, indexed). Unix only does stream. It may handle buffering as well.

Library access provides the language-specific features. The C-RTL function fopen() returns a FILE* structure that you normally access. The open() function is the Unix system level function (implemented as a library function on some systems).

Each of these layers creates additional data structures that need to be freed.

user3344003
  • 20,574
  • 3
  • 26
  • 62
  • what is RMS and VMS? Do you have some books that mention these levels either in some general sense or specific to some OS (e.g. Linux or Unix)? – Tim Mar 23 '15 at 23:33
  • VMS is an operating system. RMS=Record Management Services. In VMS, RMS operates in EXECUTIVE mode, which is below Kernel and above Supervisor and User (the system has 4 modes, in contrast to the usual two in Unix). – user3344003 Mar 23 '15 at 23:36