The cache memory

The cache is a technique that allows us to combine the characteristics of two different types of memory (for instance main memory and disk). The technique uses a high-speed buffer placed in between the two type of memory. Every time a piece of information is requested from the disk, this piece of information will be placed in the buffer. The technique relies on the fact that, if a piece of information was necessary at a given moment in time t, it will also be necessary at a later moment t+d. Thus, next time it is needed, the information will be available in the high speed buffer which will save the time necessary for a second reading from the disk.

The technique combines the low cost per byte of the cheaper memory (disk in this example) with the high speed of the more expensive memory (internal memory in the example).

The two main problems associated with the use of cache are: consistency and coherency. The difficulties come from the fact that in a cached system, the same piece of information is stored in different places (e.g. main memory, cache buffer and disk). If the information is modified, this modification has to be propagated through all level before anybody else is allowed to access it again. If this is not done, one can read an old version of it and problems can arise.

Also, if the information is modified every time, caching becomes rather inefficient because you have to copy things which will be changed and trashed every time. Fortunately, that only happens extremely seldom.

Protection mechanisms

 

You have to (at least):

1. explain the necessity of each protection mechanism

2. explain what it is and how it works

3. explain its connection with other mechanisms

 

Example for the dual-mode operation:

 

1. The need:

Multiprogramming means you have programs belonging to different users active at the same time. The system cannot allow one user to damage programs or data belonging to the system itself or other users. There are various way this damage can be inflicted: memory overwrites, I/O damage, etc. Some instructions are potentially more dangerous. The execution of these instructions should be allowed only to the system. Therefore, there is a need for a protected mode.

2. What it is and how it works:

The instructions are divided into privileged and non-privileged. All potentially dangerous instructions must be privileged. There is a hardware bit which can be set to 0 or 1. One value means the system is in kernel mode and can execute any instruction; the other value means that the system is in user mode and can only execute non-privileged instructions.

3. Connection:

This mechanism does not need any other mechanism in order to work properly.