OPERATING SYSTEM DESIGN
indicates a specific machine (
) in a specific department
) at specific university (
) in a specific country (
). The part after the slash in-
dicates a specific file on the designated machine, in this case, by convention,
’s home directory. Note that URLs (and DNS addresses in
general, including email addresses) are ‘‘backward,’’ starting at the bottom of the
tree and going up, unlike file names, which start at the top of the tree and go down.
Another way of looking at this is whether the tree is written from the top starting at
the left and going right or starting at the right and going left.
Often naming is done at two levels: external and internal. For example, files al-
ways have a character-string name in ASCII or Unicode for people to use.
tion, there is almost always an internal name that the system uses.
In UNIX, the
real name of a file is its i-node number; the ASCII name is not used at all inter-
In fact, it is not even unique, since a file may have multiple links to it.
analogous internal name in Windows 8 is the file’s index in the MFT.
The job of
the directory is to provide the mapping between the external name and the internal
name, as shown in Fig. 12-4.
External name: /usr/ast/books/mos2/Chap-12
Internal name: 2
Directories are used to map external names onto internal names.
In many cases (such as the file-name example given above), the internal name
is an unsigned integer that serves as an index into a kernel table. Other examples of
table-index names are file descriptors in UNIX and object handles in Windows 8.
Note that neither of these has any external representation. They are strictly for use
by the system and running processes.
In general, using table indices for transient
names that are lost when the system is rebooted is a good idea.
Operating systems commonly support multiple namespaces, both external and
internal. For example, in Chap. 11 we looked at three external namespaces sup-
ported by Windows 8: file names, object names, and registry names (and there is
also the Active Directory namespace, which we did not look at).
In addition, there
are innumerable internal namespaces using unsigned integers, for example, object
handles and MFT entries. Although the names in the external namespaces are all
Unicode strings, looking up a file name in the registry will not work, just as using
an MFT index in the object table will not work. In a good design, considerable
thought is given to how many namespaces are needed, what the syntax of names is
in each one, how they can be told apart, whether absolute and relative names exist,
and so on.
12.3.5 Binding Time
As we have just seen, operating systems use various kinds of names to refer to
objects. Sometimes the mapping between a name and an object is fixed, but some-
times it is not.
In the latter case, when the name is bound to the object may matter.
is simple, but not flexible, whereas
complicated but often more flexible.
To clarify the concept of binding time, let us look at some real-world ex-
amples. An example of early binding is the practice of some colleges to allow par-
ents to enroll a baby at birth and prepay the current tuition. When the student
shows up 18 years later, the tuition is fully paid, no matter how high it may be at
In manufacturing, ordering parts in advance and maintaining an inventory of
them is early binding.
In contrast, just-in-time manufacturing requires suppliers to
be able to provide parts on the spot, with no advance notice required. This is late
Programming languages often support multiple binding times for variables.
Global variables are bound to a particular virtual address by the compiler.
exemplifies early binding. Variables local to a procedure are assigned a virtual ad-
dress (on the stack) at the time the procedure is invoked. This is intermediate bind-
ing. Variables stored on the heap (those allocated by
in C or
are assigned virtual addresses only at the time they are actually used. Here we have
Operating systems often use early binding for most data structures, but occa-
sionally use late binding for flexibility. Memory allocation is a case in point.
multiprogramming systems on machines lacking address-relocation hardware had
to load a program at some memory address and relocate it to run there.
If it was
ever swapped out, it had to be brought back at the same memory address or it
would fail. In contrast, paged virtual memory is a form of late binding.
physical address corresponding to a given virtual address is not known until the
page is touched and actually brought into memory.
Another example of late binding is window placement in a GUI.
In contrast to
the early graphical systems, in which the programmer had to specify the absolute
screen coordinates for all images on the screen, in modern GUIs the software uses
coordinates relative to the window’s origin, but that is not determined until the
window is put on the screen, and it may even be changed later.