Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lesson_1-20_9_3.doc
Скачиваний:
55
Добавлен:
07.02.2015
Размер:
2.23 Mб
Скачать

How it works

The CPU in your PC actually contains three parts:

  • Input/Output Unit (I/O Unit)

  • Arithmetic/Logic Unit (ALU)

  • Control Unit

The I/O unit controls interaction between the CPU and all the other parts of your computer. The ALU handles logic and math functions. The control unit basically tells the other parts of the CPU what to do.

Like all things computer, the CPU understands instructions only in terms of ones and zeroes at the core. A change in the electrical signal through a given circuit changes that circuit from a one to a zero or vice versa. When a programmer compiles some code s/he has written, that code is translated into machine language that the CPU can understand.

System cache

The system cache is responsible for a great deal of the system performance improvement of today's PCs. The cache is a buffer of sorts between the very fast processor and the relatively slow memory that serves it. (The memory is not really slow, it's just that the processor is much faster.) The presence of the cache allows the processor to do its work while waiting for memory far less often than it otherwise would.

There are in fact several different "layers" of cache in a modern PC, each acting as a buffer for recently-used information to improve performance, but when "the cache" is mentioned without qualifiers, it normally refers to the "secondary" or "level 2" cache that is placed between the processor and system RAM.

LAYERS” OF CACHE

There are in fact many layers of cache in a modern PC. This does not even include looking at caches included on some peripherals, such as hard disks. Each layer is closer to the processor and faster than the layer below it. Each layer also caches the layers below it, due to its increased speed relative to the lower levels:

Level

Devices Cached

Level 1 Cache

Level 2 Cache, System RAM, Hard Disk / CD-ROM

Level 2 Cache

System RAM, Hard Disk / CD-ROM

System RAM

Hard Disk / CD-ROM

Hard Disk / CD-ROM

--

What happens in general terms is this. The processor requests a piece of information. The first place it looks is in the level 1 cache, since it is the fastest. If it finds it there (called a hit on the cache), great; it uses it with no performance delay. If not, it's a miss and the level 2 cache is searched. If it finds it there (level 2 "hit"), it is able to carry on with relatively little delay. Otherwise, it must issue a request to read it from the system RAM. The system RAM may in turn either have the information available or have to get it from the still slower hard disk or CD-ROM.

It is important to realize just how slow some of these devices are compared to the processor. Even the fastest hard disks have an access time measuring around 10 milliseconds. If it has to wait 10 milliseconds, a 200 MHz processor will waste 2 million clock cycles! And CD-ROMs are generally at least 10 times slower. This is why using caches to avoid accesses to these slow devices is so crucial.

Caching actually goes even beyond the level of the hardware. For example, your web browser uses caching itself, in fact, two levels of caching! Since loading a web page over the Internet is very slow for most people, the browser will hold recently-accessed pages to save it having to re-access them. It checks first in its memory cache and then in its disk cache to see if it already has a copy of the page you want. Only if it does not find the page will it actually go to the Internet to retrieve it.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]