Unit 3 - Computer Architecture and Storage
Unit 3 - Computer Architecture and Storage
T1 - CPU Architecture
CPU DEFINITION:
Processes them
1
Outputs the result
When you run a program, the CPU will process the data and instructions that are inputted,
the results from the input passed over to the processing CPU is the output.
- Main memory
- CPU (central processing unit)
- Secondary storage
- Output devices
- Input devices
Program was not stored back then, (before about 1943), instructions were input one at a
time using switches, or read in punch cards and executed one at a time.
The stored-program counter was when Mathematician Von Neumann developed the idea
of storing program instructions as well as the data, into the memory.
Von-Neumann architecture:
Program instructions and data the programs are using are stored into the same memory.
Both the CPU and the RAM store instructions as well as data.
The CPU has two major components called the control unit (CU) and the Arithmetic Logic
unit (ALU)
There are also registers that are used to carry out these operations
2
- Cache is located on the CPU, but is much slower to access than registers but faster
than RAM.
MAR - Memory Address Register = holds the memory address of the current instruction,
and then the data that it uses, so that these can be fetched from the memory
MDR - Memory Data Register = holds the actual instruction, then the data that have been
fetched front the memory.
CIR - Current Instruction Register = holds the instruction currently being executed or
decoded.
ACC - Accumulator = holds the result of the instruction before it is transferred to memory.
Control Unit (CU) -> It coordinates and controls all the other activities taking place within
the CPU. such as: (basically also manages the fetch-decode-execute cycle)
Program Counter (PC) - holds the address of the next instruction to be executed
Accumulator (ACC) - is where arithmetic and logic results are temporarily stored, much
like the M+ function on a calculator.
What is the Arithmetic Logic Unit for: (ALU - what does it do?).
It is where the actual arithmetic operations are done. (also carries out logical operations,
e.g AND, OR and NOT.
So it will come from the main memory, passing the ALU and to the Accumulator
3
The FETCH-DECODE-EXECUTE CYCLE: (F-E cycle)
1. FETCH - causes the next instruction and any data involved to be fetched from the
main memory
2. DECODE - decodes the next instruction
3. EXECUTE - the instruction is executed
- The address of the instruction to be executed is copied from the Program Counter
(PC) to the Memory Address Register (MAR)
- Remember- the MAR holds the memory address of the next instruction and the data
that it uses
- The instruction at that address is fetched from memory and copied to the Memory
Data Register (MDR)
- Remember - the MDR holds the actual instruction currently being executed and
decoded.
The Control Unit (CU) decodes the instruction and decides if data needs to be fetched.
If so, the MAR is then used to hold the address of the data to be used in the instruction.
The Two work together, the MAR knows where to look for the data in the RAM, and the
MDR keeps hold of that data until it is ready to be used in the CPU.
The current instruction register holds the instruction that is being executed or decoded at
the moment.
4
Once the instruction is loaded from memory, it is stored in the current instruction register
(CIR), so it will be stored there.
How instructions and data are fetched from the MAR into the CPU , how they are processed
by each component and then how they are executed.
5
11.The ALU then sends back the data back to the MDR, then written into the RAM
T2 - CPU PERF’(Performance)/BUSSES
- Understand the following terms and how they affect the performance of a CPU:
- Cores
- Cache
- Clock
- Understand the purpose of buses including:
- The address bus
- The data bus
- The control bus
- Clock Speed
- Cache size
- Number of cores
Clock speed:
One cycle per second = 1 Hertz (Hz) = 1 instruction carried out each second.
Cache Size:
6
- There are 2-3 of cache memory, the fastest cache with the smallest capacity is Lvl 1.
- It will come from a cycle of CPU -> cache -> main memory , then back from the main
memory to the CPU.
- RAM is relatively slow memory to access and it is further away from the processor
than cache.
- Program instructions and data that are fetched are stored in cache in case they are
needed again soon.
- It takes longer to retrieve data or instructions from RAM than from cache
- Having instructions in the loop in cache will speed up execution, e.g a while
loop
Level 1 - extremely fast but small, located on the CPU - each core will have their own Lvl 1
cache.
Level 2 - is also usually given to each core, it is very fast but a little slower than Level 1
cache.
Level 3 - is the slowest type of cache, but still faster than RAM. Is usually located on the CPU
and is shared between all the cores on the processor.
7
Number of Cores:
Multi-core processors:
- A dual core processor has 2 processors in the same integrated circuit, linked
together.
- It has the potential to perform 2 processors at the same time
- It allows twice as many instructions to be executed, but doesn’t always
perform at this rate as it cannot take advantage of both of the cores.
- Then there's quad core processors
More instructions that can be processed by the cores mean much faster processing time.
BUSSES:
A bus is a set of parallel wires connecting two or more components of the computer.
- When a computer wishes to access a particular main memory location, it sends the
address requested (from PC or MAR) to memory on the address bus.
- The data in that location is then returned to the CPU on the data bus (to MDR)
- Control signals are sent along the control bus.
System Bus:
Address Bus: stores the address of the memory or device controller to be read from or
written to
Control bus: uses control signals to control all activities within the CPU
8
+ The system bus also connects the CPU to other external input-output devices.
CPUs use very simple instructions known as machine code or assembly language.
- Harder instructions are broken down into simpler assembly code instructions.
Processors execute machine code, the binary instructions which the computer can
respond directly to perform a task.
INSTRUCTION SETS:
Instruction sets are all the possible instructions that are able to be decoded and executed
by a CPU
- Each type of processor will have a specific list of commands written in machine code
that can be understood and executed by the CPU (otherwise called an instruction
set).
- A particular CPU will have its own instruction set.
- Programs written for one type of CPU won’t work on another.
In ordinary Maths and programming, we use the words operator and operand.
9
Assembly codes:
- The program is then assembled into a binary form known as machine code- this is
what is run by the processor.
- The assembly code (and machine code) make use of the opcodes and operands
- The opcode is the instruction and the operands are the values that the instruction
works on.
Microprocessor:
- CPUs are a type of microprocessor, they include Pentium microprocessors and ARM
microprocessors.
- Microcontrollers contain not only the microprocessor, but also the RAM and the
ROM (Read only memory) or flash memory, for volatile and non-volatile storage- this
allows for an entire computer to be contained into one chip.
EMBEDDED SYSTEMS:
An Embedded system is used to control the function of electronic devices such as those
commonly found at home.
They perform limited functions and very specific tasks (as their inputs are by a button or
switch).
OR
10
- Washing machines
- Security systems
- Automatic lighting systems
- Vending machines
- Traffic lights
- Cooling systems
Software Has only one purpose and New software can be installed
cannot install a new
software
T4 - Memory:
11
FOUR TYPES OF MEMORY USED IN COMPUTER SYSTEMS:
- RAM
- ROM
- Virtual memory
- Cache memory
Primary Storage:
Main memory (RAM/ROM) is directly accessible by the CPU. It is also known as the
primary storage.
There are many types of memory used in computers. (In the Von Neumann architecture,
primary storage is directly linked to the CPU and is needed to store programs that are
currently running.)
RAM (Random Access Memory) is required to temporarily store the instructions and data
the computer needs whilst it is in operation.
They are copied from the hard disk into main memory when they are required, because it
would be too slow to access everything directly from the hard disk.
All your programs and data are stored permanently on your hard drive. (This would then
be only known as non-volatile, as it doesn’t lose the data when it is turned off)
12
+ When the computer is first turned on, no data is stored in the RAM
+ Operating system: the computer first loads the operating system from your hard
drive into RAM.
When applications or programs are loaded, they are copied into RAM from the hard drive.
- Documents and files (data) that are used with those programs are also opened by
copying them into RAM.
RAM starts to fill up as all these programs, documents and files are copied.
However, what happens when you want to access a program such as a brower,
however it needs more memory than what you have in the RAM?
VIRTUAL MEMORY:
Virtual memory is used when there isn’t enough space in RAM for all the programs and
data you are currently working on.
- It is a part of a hard drive. (a small section of the hard drive is reserved to act like the
RAM).
- This can cause your computer to noticeable slow down since the access from the
hard drive is slower than the RAM.
- A page of data is a fixed-length block of virtual memory.
- When pages of data are removed between RAM and hard disk this is known as
swapping or paging
When the RAM is full, it would freeze or crash due to the large amount of programs and
data stored in the memory.
This can cause programs to crash, the system to freeze and show “out of memory” errors.
And will be unable to open any more programs as the system may refuse to open new
programs or be very slow.
13
Advantages of Virtual Memory:
ROM Stores instructions and data that never need to be changed. Some data needs to be
permanently held in primary storage, even when the computer has no power.
- The initial program that is run when the computer is turned on, known as
bootstrap
- It tells the computer where it will find the operating system (when the hard drive
copies data to the RAM) on the hard drive.
- The BIOS can run without a hard drive or other secondary storage being present. It
controls basic technical configuration of the computer such as the processor
speed and system time.
14
Volatility Volatile - all data is lost Non-volatile - data is
when the power is turned permanently retained
off without power
Memory Speed:
The speed that data can be accessed changes through the different components in a
computer.
- The slower components are far cheaper for each byte of data stored.
15
T5 - Secondary Storage:
Secondary storage:
Secondary storage is not directly accessed by the CPU and is needed for permanent
storage of data.
It is needed for longer term storage of files and data because it is non-volatile.
Primary storage:
16
- ROM (Read-only memory)
Secondary storage:
- Magnetic = Mechanical parts move over the disks surface to read and write data
magnetically, or a drive head reads a magnetic tape
- Optical = lasers read and write data using light
- Solid State = Data is recorded onto solid memory chips without any moving parts.
SSDs, require very little power and create little heat owing to the lack of moving parts,
making them suitable for laptop and tablet devices.
The lack of moving parts make them small and reliable - perfect for small portable devices
with built-in storage like cameras and smartphones.
They are also used in desktop and laptop computers, they can be 100 times faster than
hard disks and do not require cooling systems.
Hard disk drives (HDD) are cheaper and commonly found in desktop computers. SSDs may
be used as a sole alternative or in conjunction with HDDs to store operating systems and
other software that needs to be executed as fast as possible
17
CDs, DVDs are useful for videos and music data in the short to medium term with a life
expectancy of 10-12 years. USB flash drives are much more reliable and effective for
regular back up of small files as they are more durable.
Magnetic Disks:
Basic features:
A disk that has a solid platter is a “hard” disk. Soft plastic disks are known as “floppy” disks.
HARD DISKS:
18
Actuator Controls the precise positioning of the read/write
head, allowing it to access data on spinning platters
Drive spindle It is a central shaft which holds the platters and spins
them at high speeds, the faster the speed the more
data that can be read/written
Platter These are circular disks coated with material. Data is
stored in these platters in binary (0s and 1s) using
magnetism. There can be multiple platters to increase
storage capacity.
Track Track is the circles in the disk.
Sector Tracks which are divided into sectors.
Interface controller Connects the hard disk to the rest of the computer,
managing the flow of data to/from the drive.
Fixed magnetic disks (hard) are still used in many PCs and laptops
Advantages
Disadvantages:
19
- Lots of mechanical parts, durability an issue, sealed unit due to disk head and
platter precision and not very portable
Uses:
Capacity:
An optical drive uses a laser to reflect light off the surface of the disk. One long spiral track
contains pits and land.
When the laser beam hits the covered start or end of a pit, the light is reflected and a 1
is recorded.
Where light is reflected back directly from the flat bottom of the pit, or from the track
with no pit (a land) a 0 is recorded.
A CD has bigger pits and lands than BluRay as red light has a larger wavelength.
The smaller BluRay pits and lands allow it to store more data
Basic Features:
Advantages;
20
- Highly durable, no moving parts, very fast read/write speeds, no noisy fan or drive
arm, faster start up times
Disadvantages:
- More expensive than magnetic hard disks, similar storage capacity as magnetic disks
Uses:
Capacity:
100GB - 16TB
FLASH MEMORY:
- Cameras
- Mobile devices
- USB memory sticks (hard drives)
If no electrons are present in the floating gate, the current will flow, representing a 1
If electrons are stored in the floating gate, the current doesn’t flow, representing a 0.
21
The Isolation layer:
- In order to write to the flash memory cell, the electrons need to pass through the
isolation layer.
- The electrons will only move through this layer when writing
- Normally, they remain trapped in a floating gate, representing a 0.
- High voltage is used to force electrons through an insulating layer into the floating
gate.
- Reading Data:
- The system checks if current can flow through the cell.
- If electrons are trapped, current is blocked = 1 value.
- If no electrons, current flows = different value.
- Erasing Data:
- Another voltage is applied to pull the electrons back out, resetting the cell.
22
The control gate is used to move electrons into or out of the floating gate.
In order to increase the storage density of memory chips, the number of floating gates in a
flash cell is increased.
- NOR
- NAND
Memory computer = it is responsible for the communication between the flash chips and
the computer, which also controls the read and write operations on a hardware level.
23
T6 - Cloud Storage:
Cloud storage refers to remote file storage on someone else’s servers. Often this is with a
major third-party company such as Google, Microsoft, or Dropbox. Physical servers and
storage are needed to store data in cloud storage.
The Cloud:
The cloud is another name for services offered via the Internet (the cloud symbol
represents the Internet)
- Cloud storage
- Cloud computing
Cloud Storage:
Cloud storage allows users to store files and data on the Internet.
24
- Redundancy
- Multiple file versions
- Only pay for storage used
- Scalability
Redundancy:
- In local storage this is normally carried out by having multiple copies of files on 2
different hard drives in 1 server.
- In cloud storage, the locations that store redundant files may be anywhere in the
world.
Scalability:
Scalability is the ability of the storage system or cloud computing resources to increase in
size
Data Centres:
Data centers are buildings that are dedicated to to storing physical servers
Privacy:
If data is stored in the cloud, the security and privacy of the data is controlled by an
external company.
25
- Both cloud storage and local storage may be hacked, however, typically cloud
storage will be more secure.
- Companies and organisations will need to consider the level they trust an external
company to hold their data.
- With a fast connection and a small office document this may happen in a few
seconds
- However, with files such those used in video editing it may take may hours to open
or save files to cloud storage.
Cloud storage differs from local storage as local storage consists of hard drives that are
owned and maintained by the user or organization themselves.
Pros: of cloud storage in comparison to local Cons: of cloud storage in comparison to local
26