Hierarchical Storage structure


1.hierarchical storage structure
     This notion of inserting a smaller, faster storage device (e.g., cache memory)
between the processor and a larger slower device (e.g., main memory) turns out
to be a general idea. In fact, the storage devices in every computer system are
organized as a memory hierarchy similar to Figure 1.9. As we move from the top
of the hierarchy to the bottom, the devices become slower, larger, and less costly
per byte. The register file occupies the top level in the hierarchy, which is known
as level 0, or L0. We show three levels of caching L1 to L3, occupying memory
hierarchy levels 1 to 3. Main memory occupies level 4, and so on.
     The main idea of a memory hierarchy is that storage at one level serves as a
cache for storage at the next lower level. Thus, the register file is a cache for the L1 cache. Caches L1 and L2 are caches for L2 and L3, respectively. The L3 cache
is a cache for the main memory, which is a cache for the disk. On some networked

systems with distributed file systems, the local disk serves as a cache for data stored on the disks of other systems.

Hierarchical Storage structure_第1张图片

     The same data may appear in different levels of the storage system.For instance, data transfer from cache to CPU and registers is usually a hardware function, with no operating-system intervention. In contrast, transfer of data from disk to memory is usually controlled by the operating system.

     In a hierarchical storage structure, the same data may appear in different
levels of the storage system. For example, suppose that an integer A that is to
be incremented by 1 is located in file B, and file B resides on a magnetic disk.
The increment operation proceeds by first issuing an I/O operation to copy the
disk block on which A resides to main memory. This operation is followed by
copying A to the cache and to an internal register. Thus, the copy of A appears
in several places: on the magnetic disk, in main memory, in the cache, and in an
internal register (see Figure 1.12). Once the increment takes place in the internal
register, the value of A differs in the various storage systems. The value of A
becomes the same only after the new value of A is written from the internal
register back to the magnetic disk.
     In a computing environment where only one process executes at a time,
this arrangement poses no difficulties, since an access to integer A will always
be to the copy at the highest level of the hierarchy. However, in a multitasking
environment, where the CPU is switched back and forth among various
processes, extreme care must be taken to ensure that, if several processes wish
to access A, then each of these processes will obtain the most recently updated
he situation becomes more complicated in a multiprocessor environment
, where, in addition to maintaining internal registers, each of the
CPUs also contains a local cache. In such an environment, a copy of A may

exist simultaneously in several caches. Since the various CPUs can all execute

concurrently, we must make sure that an update to the value of A in one cache
is immediately reflected in all other caches where A resides. This situation is
called cache coherency, and it is usually a hardware problem (handled below
the operating-system level).
       In a distributed environment, the situation becomes even more complex.
In this environment, several copies (or replicas) of the same file can be kept
on different computers that are distributed in space. Since the various replicas
may be accessed and updated concurrently, some distributed systems ensure
that, when a replica is updated in one place, all other replicas are brought up
to date as soon as possible. There are various ways to achieve this guarantee,
as we discuss in later.

 

你可能感兴趣的:(struct)