计算机组成原理学习笔记(一)

Basic Concepts overview

By LiPtP

This is a summary note of the course “Computer Organization and Architecture” by Professor William Stallings.

The remaining contents is organized as:

  • Chapter 1
    • Concepts
    • History of Computer Evolution
  • Chapter 2
    • Strive for performance!
  • Chapter 4
    • Computer Memory System
    • Locality
  • Review Questions

Chapter 1

Concepts

Now we will introduce the basic concepts of the course. All the contents in the future chapters will be based on these concepts.

  1. Computer Architecture: Attributes visible to a programmer, or attributes have a direct impact on the execution of a program.
  2. Organization: Operational units and their interconnections that realize the architectural specifications.
  3. Structure: The way in which the components are interrelated.
  • Top level structure of the computer:
    HLS of the computer
  • Major Elements of a Multi-core Computer:
    HLS of a multi-core computer
  • CPU Structure:
    • Control Unit (CU): Controls the operation of the CPU.
    • Arithmetic and Logic Unit (ALU): Performs arithmetic and logical operations.
    • Registers internal to the CPU: Hold intermediate results.
    • CPU Interconnections
  1. Function: The operation of each individual component as part of a structure.
  • Main functions:
    • Movement
    • Storage
    • Control (星形结构的中心)
    • Processing

History of Computer Evolution

  • Vacuum tubes: IAS Structure
  • Transistors: Add data channels to process I/O instructions.
  • Integrated circuits: Add Gates and Cells to process digital signals, with the use of Multiplexor.
  • VLSI, ULSI, Microprocessors

Chapter 2

Strive for performance!

There are 3 major ways for achieving high performance in the current workflow.

  1. Microprocessor Speed, by pipelining and Branch Prediction,etc.
  2. Performance Balance, by tuning the COA to compensate for the mismach between capabilities of the components.
  3. Improvement in COA directly: by enhancing the hardware speed of the processor, improving the size and speed of the caches, or even change the overall structure of the processor.

Chapter 4 (Part I)

Computer Memory System

The complex subject of computer memory is made more manageable if we classify it according to its characteristics.

Here are the main characteristics of computer memory. Note that they are only a part of the whole picture.

  • Overview of the Major Characteristics of Computer Memory System:
    • Location
    • Capacity
    • Unit of Transfer
    • Access Method
    • Performance
    • Physical Type
    • Physical Characteristics
    • Organization

Now we will move on to the details of each characteristic.

Location

There are many different types of memory locations, but generally it can be classified into two types: - Internal Memory, including main memory, cache, internal memories at processor and control units, etc. - External Memory, consists of peripheral storage devices, such as disk and tape, that are accessible to the processor via I/O controllers.

Capacity

Measured in bytes or words, according to the type of memory. The concept of word will soon be introduced.

Unit of Transfer

这里有几个概念需要区分:word,address unit,unit of transfer.
对于Word,是最基础的存储单元,一般是 32bit 或者 64bit。和“32 位、64位系统”里的概念等同
对于Address unit,很多系统已经支持按位寻址,即地址是以字节为单位的,所以地址单元就是一个字节。但是,有的系统支持按字寻址,即地址是以字为单位的,所以地址单元就是一个字。
对于Unit of transfer,一般和外部设备交换是以block为单位的,可以一次读取多个字。

Access Method

This specifies how to access the unit of memory. There are four main access methods(顺序、直接、随机、相连内存访问):

  • Sequential Access: The data is accessed in a linear fashion, one word at a time.
    • Devices using this method: Tape
    • Time to access a given location: Not Constant

Memory is organized into units of data, called records. Access must be made in a specific linear sequence. Stored addressing information is used to separate records and assist in the retrieval process. A shared read– write mechanism is used, and this must be moved from its current location to the desired location, passing and rejecting each intermediate record. Thus, the time to access an arbitrary record is highly variable.

  • Direct Access: The data is accessed directly by its address.
    • Devices using this method: Disk
    • Time to access a given location: Not Constant

Individual blocks or records have a unique address based on physical location. Access is accomplished by direct access to reach a general vicinity (附近区域) plus sequential searching, counting, or waiting to reach the final location. Again, access time is variable.

  • Random Access: The data is accessed randomly, without any specific order.
    • Devices using this method: Main memory and some caches
    • Time to access a given location: Constant

Each addressable location in memory has a unique, physically wired in addressing mechanism. The time to access a given location is independent of the sequence of prior accesses and is constant. Thus, any location can be selected at random and directly addressed and accessed.

  • Associative: Memory using such access method uses a random access type of memory that can make comparison of desired bit location rather than a word location. So it is a more delicate access method compared to random access.

    • Devices using this method: Some Types of Cache
    • Time to access a given location: Constant

Performance

Mainly contains these aspects:

  • Access Time, or latency
  • Memory Cycle Time
  • Transfer Rate

We will discuss them with random-access systems and non-random-access systems separately.

For Random-Access Systems

  1. Access Time: 地址给到内存到被使用的时间。
  2. Memory Cycle Time: 一次内存访问的时间,包括 Access Time 和 Data Transfer Time。
  3. Transfer Rate: 单位时间内从内存到外部设备的传输速率。值为1/Memory Cycle Time,单位为 bps。

For Non-Random-Access Systems

  1. Access Time: 读写寻址的时间。
  2. Memory Cycle Time: 无此概念。
  3. Transfer Rate: 单位时间内从内存到外部设备的传输速率。值为\(R\)。满足下面的式子:
\[T_n = T_{Access}+\frac{n}{R}\]

Memory Hierarchy

The memory hierarchy is a hierarchical organization of memory devices, with each level providing faster access to the memory than the previous level.

The highest level (usually Registers),followed by Caches and main memory has the fastest access time, however they are expensive and limited in size. They are overall named as inboard memory.

Inboard memory is followed by disks and tapes, which are slower but have higher capacity and are suitable for long-term storage. External, nonvolatile memory is also referred to as secondary memory or auxiliary memory. They are visible to the user as files or records.

Locality

Locality of references states that memory references tend to cluster.

Reasons:

  1. Except for branch and call instructions, which are just a small portion of instruction set, the instructions are executed sequentially.
  2. A program remains confined to a rather narrow window of procedure invocation depth.
  3. Most iterative loops have a small number of instructions.
  4. Data structures like array tend to cluster in the main memory.

There are two types of locality: Spatial Locality and Temporal Locality.

  • Spatial Locality: The memory addresses used in the instruction tend to cluster.
  • Temporal Locality: A processor tend to access the most recently used address. (e.g. Loop instructions)

Review Questions

Questions

  1. What are the differences among sequential, direct, and random access methods?
  2. What is the general relationship among assess time, memory cost and capacity?
  3. How does the principle of locality relate to the use of multiple memory levels?

Answers

Question 1:

Sequential access: Memory is organized into units of data, called records. Access must be made in a specific linear sequence. Direct access: Individual blocks or records have a unique address based on physical location. Access is accomplished by direct access to reach a general vicinity plus sequential searching, counting, or waiting to reach the final location. Random access: Each addressable location in memory has a unique, physically wired-in addressing mechanism. The time to access a given location is independent of the sequence of prior accesses and is constant.

Question 2:

As access time becomes faster, the cost per bit increases. As memory size increases, the cost per bit is smaller. Also, with greater capacity, the access time becomes slower.

Question 3:

Memory reference tend to cluster, and it has spatial locality and temporal locality. So it’s possible to organize data across the memory hierarchy such that the percentage of accesses to lower level is less than higher level. So we can put the data cluster to higher level storage, such as caches and registers in order to improve the average access speed.

Share: X (Twitter) Facebook LinkedIn