💻
Chapter 3
Central Processing Unit (CPU)
What is the CPU?
circuit that executes instructions of a computer
processes instructions and data
what is the purpose of the cpu?
control the signals in the computer to process data and execute instructions
responsible for carrying calculations and logical expressions
CPU ⇒ controls, process, execute, does calculations
Parts of the CPU
—> CPU is made up of many registers to temporarily hold data and instructions
—> internal memory in CPU
—> high speed
—> move data around
Arithmetic Logic Unit (ALU)
carries calculations in data
arithmetic (addition, subtraction, etc.) & logic (AND,OR,NOT, comparisons)
Chapter 3 1
Immediate access store (IAS)
memory in the CPU to hold data and instructions needed to process
*data+instructions loaded into main memory —> then to IAS —> processed
Memory Unit
—> aka. primary / main memory
—> RAM
—> directly accessed by the CPU
faster access speed (compared to accessing data from permanent memory)
Buses
‘highway’ for information (like routes/pathway)
parallel transmission
→ DATA BUS
→ ADDRESS BUS
→ CONTROL BUS
Data Bus
carries the data
bidirectional (two direction)
wider the bus → larger the word length → better performance
Control B su
Chapter 3 2
Fetch-Decode-Execute cycle
CPU fetches data and instructions from memory
stores in registors
via address + data bus
instructions decoded
then executed
Fetching
data and instructions stored in MDR
next instruction needs to be fetched stored in MAR (address of next instruction)
this fetched instruction stored in MDR
data in MDR copied in CIR
PC increment
Decode
CPU needs to understand the instruction fetched
hence, decoded
uses instruction sets to decode
Execute
decoded instruction passed (signals) to different components to process
eg. arithmetic calculations
Chapter 3 3
Instruction set
set of operations which are decoded in a sequence
list of commands that are processed
made up of opcode and operand
opcode → limited
informs CPU what operatin to do
operand
data that needs to be acted on
data that is transferred from register to register
System Clock
produces timing signals on the control bus
so that computer operation is synchronized (transmit in order and rhythm)
clock speed increase == processing speed increase
unit → GHz
factors for high speed computer sys
higher clock speed =/= computer performance increase
what effects is:
width of address bus
width of address and data bus increase = performance increase
overclocking
changing the clock speed to smth higher than recommended setting
more clock speed == increase speed of computer
via accessing BIOS + altering settings
problems of overclocking
unsynchronized operations
computer is unstable and will crash
overheating of CPU
using cache memory
memory in CPU for fast data access (stores frequently used instructions)
more cache memory == better cpu preformance
different number of cores
core made up of ALU,CU,registors
more cores = increase clock speed
doubled core =/= doubled performance
Chapter 3 4
Composition of computer
software
application → provides service that user requires
spreadsheet
game
browser
office
system → provides service that computer requires
OS
utilities
drivers
hardware
CPU, printer, HDD
Features of System software
programs that control and manage operation of hardware
provides platform (so software can run)
provides human computer interface
allow hardware and software to run without problems
Utilities software
examples:
virus checkers
defragmentation software
back-up software
file compression
screen savers
supply moving imagines when user is afk on computer
to protect older screens
can be used in security system
Application software
perform apps on computer
can execute software
Chapter 3 5
Operating Systems
framework that allows users to communicate with computer hardware interactively
functions of an operating system:
manages hardware and peripherals
manages transfer of programs
divides processing times
multitasking
file handling
manages security
manages utility software
Graphical User interface vs Command line Interface
Graphical User Interface (GUI)
interact that allows users to interact w/ computer using pictures or symbols
WIMP (windows icons menu pointing device)
advantages:
doesn’t need to learn commands
user-friendly
simpler than typing in commands or touch screen (pointing device used)
disadvantages:
uses more memory than CLI
limited to the icons
need an operating system
Chapter 3 6
Command Line interface
need to type in different commands
has direct communication with the computer
no restricted options
advantages:
direct communication with computer
not restricted to pre-determined options
can alter computer configuration settings
use small amount of memory
disadvantages:
needs to learn a number of commands
commands needs to be typed (error prone)
format and spelling but be typed correctly
who would use:
CLI → a programmer, analyst technician
GUI → end-user who doesn’t have great knowledge of how a computer works
Embedded systems
It is a physical product
combination of both hardware and software
carry out specific set of functions
electronic, electrical or electro-mechanical
has inputs, processing power, memory and output
can be programmable and non-programmable
eg.
microcontrollers
has a CPU, RAM, ROM
all peripherals are embedded on one chip
microprocesser
integrated circuit which has CPU on the chip
system on chop
contain a microcontroller, I/O ports, secondary storage, CPU, memory
Chapter 3 7
Interrupts
signal
signal that is received to inform software that something have happen
what can cause an interrupt?
key pressed on keyboard
printer connected to computer
paper jam
out of ink
how is the interrupt signal processed?
interrupt sent to CPU
identify interrupt type and level of priority
CPU stops the task it is currently processing to service the interrupt
an interrupt service routine is used
interrupt handler priorities the interrupt signals
once the interrupt is serviced message pops up
interrupts allow program to multitask
Integrated Development Environment (IDE)
suite of programs used to write/test/debug a computer program written in high-level language for programmers
Roles/features of IDE
code editors
translator
environment set up with debugger
error diagnostics
auto-correction
auto-completion
pretty print
High-level and low-level languages
high-level language: Low-level language:
closer to what humans recognize in terms of language computer’s native language (can directly access the hardware)
easier to read, debug, understand difficult for humans to understand
eg. Python, Java, Javascript eg. assembly language, machine code
translator = compiler, interpreter translator = assembler
one line of code does several things one line of code does one thing
Chapter 3 8
Compiler and interpreter
translator to translate high-level language to low level language
Compiler Interpreter
translates whole source at one go translates the source code line by line
run through the program and produce a report of all it detects can make debugging easier (tracks error line by line)
faster slower
more efficient less efficient
less time consumption more time consumption
larger in size smaller in size
output an executable file can’t produce exe file
Chapter 3 9