A register is a primitive device for holding and operating on data. Some machines can operate only on data in registers, and many machines operate primarily on registers. Registers may be classified as special or general purpose.
Special-purpose registers are those whose function and identity are bound together. One such register is the current instruction register, which contains the instruction being decoded and executed. Another is the next instruction address register, which contains the address of the next instruction to be fetched, decoded, and executed. There is usually only one such register, and it is used only for this purpose. Because manipulating the contents of special-purpose registers alters the behavior of the machine and the results of the program execution, their use is typically constrained so that they can be used only as intended.
General-purpose registers can be used for several functions. The identity of the register is independent of its function. The current purpose or function is determined by the context or operation; the identity or name of the register is arbitrary. For example, the IBM 360 (IBM Corp.) has 15 general-purpose registers. Depending on the context, these registers may be used for exchanging data between programs, holding address offsets, or inputting or outputting integer arithmetic.
The state vector, or program status word, is a special register (i.e., reserved word and address) in which the system keeps critical information about what it is doing and what it will do next. Multiprogramming machines may have two or more such mechanisms. For example, the IBM 360 has a current program status word, which specifies what it is doing and what it will do next, and a previous program status word, which shows how it got to where it is. By swapping these words, it can return to what it was doing before the current interruption. The address of this program status is the range of normal addresses and can be specified by an application program.
A program might refer to the program status word to learn about its own identity or environment. It might refer to the previous program status word to determine by whom it was called and what it is expected to do. However, only privileged processes can alter the contents of the program status word.
Random Access Memory
Random access memory (RAM) refers to a primitive class of memory in which any portion of the memory can be read from or written to with the same facility and in the same time as any other. That is, each access is independent of the previous one. It is contrasted to sequential memory, in which each access is relative to the previous one. In this sense, a magnetic disk provides secondary RAM storage, whereas magnetic tape provides secondary sequential access storage.
In addition, RAM is contrasted to read-only memory (ROM), from which data can be read but not written. RAM is the kind of memory employed for primary storage (discussed in a later section). Procedures stored in RAM are vulnerable to accidental and intentional change.
ROM looks to a system like RAM; however, its contents cannot be altered by the programmed functions of the system. ROM is typically used to hold stable procedures that are not intended to be altered. Procedures stored in this way are safe from interference and contamination and, to that extent, are reliable.
Compact disk read-only memory (CD-ROM) records information optically on a small plastic disk. The disk is usually reproduced as an entity from a master. Information may be represented by the reflectivity of a spot. For use, the disk is placed into a drive and spun, and the data is sensed by bouncing a laser off of the disk into a photo-sensitive device. CD-ROM is well suited for published and distribution of programs and data bases. Because the data cannot be altered after being applied to the disk, it can be relied on as being the same as when shipped by the publisher.
Write-once/read-many (WORM) storage can be written to only once but read forever. It is usually partly mechanical (similar to CD-ROM) and is often optical or photographic. Once written, the data is not subject to alteration and therefore is very reliable. This class of storage is useful for logs and journals.
The procedures that the computer is to perform, the instructions it is to execute, and the data on which it will operate are stored in primary storage. Information in primary storage can be directly referenced or addressed. Arithmetic and logical operations can usually be performed directly on information in primary storage. (The exception to this rule is the few systems that can do such operations only on information in registers.)
Primary storage is typically all-electronic and very fast. On the other hand, it is also usually small, expensive and volatile. As a rule, the more primary storage that is available to a system, the more concurrent operations it can perform.