1/77
Looks like no tags are added yet.
algorithm
process or set of rules to be followed or calculated to solve problems, especially by a computer
decomposition
breaking down a large problem into smaller, more manageable parts
abstraction
removing unnecessary details from a problem to allow focus on essential components
pseudocode
step-by-step descriptions of an algorithm written in simple english words using a code-like structure
why use pseudocode
planning before writing actual code
makes the logic easier to understand
reduces logical errors before implementation
characteristics of a good algorithm
(CITEE)
clear and precisely stated steps
allows invalid inputs (without crashing)
terminates at some point, when needed
efficient, and in as few steps as possible
easy to maintain and understandable by others (for modification)
sorting algorithms (3 types)
merge: splitting and rejoining in order
insertion: having two lists: unordered and ordered list
bubble: comparing adjacent values and swapping if needed
searching algorithms (2 types)
linear: comparing each value, one by one
binary: compares middle value, then uses > or < to half the number of values, repeat→ MUST BE IN ASCENDING/ALPHABETICAL ORDER FIRST
CPU
process data and instructions by constantly repeating the FDE cycle
CU
coordinates the activity of all other components and the flow of data and instructions
ALU
performs all arithmetic, logic and shift operations in the cpu
register, and all 5 dedicated registers
super-fast memory that temporarily store data
PC
CIR
MAR
MDR
ACC
PC (register)
stores the memory address of the next instruction to be fetched from RAM
MAR
stores the memory address to be fetched from RAM, may be instruction or data
CIR
holds current instruction, splitting it into opcode and operand
MDR
holds the data instruction that was fetched from main memory into the cpu
ACC
stores data currently being processed and the result of calculations or logical operations
CPU buses
a series of connectors between internal components
→ typically consist of 8,16,32,64
3 types of buses
control bus
data bus
address bus
5 different types of bus signals
memory read
memory write
bus request
bus grant
clock
computer
electronic device that takes input, processes data and delivers output
(FDE CYCLE) fetch stage
PC is checked
address stored in the PC is copied to the MAR
address is sent along address bus to main memory → waits to receive signal from control bus
CU sends a specific signal (e.g. read, plus, etc) along the control bus to main memory
data is then sent along the data bus to MDR
data in MDR copied into CIR
PC incremented by 1
→ fetch stage complete
operode and operand
operode: what to do
operand: what to do it to
(FDE CYCLE) decode stage
the instruction is decoded (which could be to load, plus, etc) and is to be stored into the acculumator
(FDE CYLE) execute stage
carries out the decoded instruction
may involve:
→ ALU for calculations or logical
→ data movement
→ branching / jumps
how a magnetic disk drive operates
a HDD contains many platters (disks), where they can spin at very high speed, and divided into sectors
read/write heads move across the disk to read and write data
data is written/read from the disk by magnetising different microscopic regions on the disk
one magnetic orientation represents a 1, and the other a 0
a whole block is read in one go
how cd’s operate
a disk such as a cd have bumps and flats on their surface, where they form a spiral from the centre to the outside
cd is spun so all data can be read
a laser is shone on the disk
the laser is reflected, and a sensor detects changes in reflectivity
bumps and flats represent the two possible bit values (1s and 0s)
clock speed and how it impacts performance
number of fde cycles per second
increased clock speed = more instructions can be executed per second
number of cores and how it impacts performance
number of processors in the CPU
more cores = more instructions can be executed simultaneously = improved multitasking
cache size and how it impacts performance
small, very fast memory inside the CPU that stores frequently used instructions
more cache = reducing the number of times CPU needs to access RAM (accessing ram is slower)
pipelining and how it impacts performance
allows overlapped processing of multiple instructions
one instruction can be fetched, whilst another is decoded, and another is executed → this overlapping increases overall speed
von neumann architecture
uses a single main memory (RAM) that stores both program instructions and data, that travels along the same buses
→ can lead to congestion
harvard architecture
separates the storage of program instructions and data, having two different memory locations
→ so they can be fetched simultaneously, improving performance
contemporary architecture
has included features such as onboard graphics, performance boosting mode and virtual cores
instruction set
complete list of machine code instructions a CPU is designed to execute
two types processors
CISC
RISC
CISC (complex instruction set computer) - type of processor
CISC CPU’s have a large set of complex instructions so tasks can be achieved in fewer lines of code
→ but some take multiple clock cycles
RISC (reduced instruction set computer) - type of processor
RISC CPU’s have a smaller set of simple instructions, each designed to be executed in one clock cycle
→ makes execution faster but may require more instructions overall
GPU (graphics processing unit)
co-processor with thousands of smaller cores designed for parallel processing
GPU uses (graphics related)
games and multimedia (rendering, animations, etc.)
GPU uses (not graphics related)
machine learning
scientific simulations
data anlysis
cryptocurrency mining
GPU vs CPU (number of cores)
GPU → thousands of small cores
CPU → small number of powerful cores
multicore processor and its pros and cons
has multiple independent cores on a single CPU chip, where each core can carry out its own FDE cycles
tasks can be split up, allowing multitasking and faster processing
HOWEVER, not all softwares are designed to use multiple cores
parallel system and its pros and cons
uses multiple processors or cores, working together on the same problem at the same time
greatly improves performance for tasks that can be split into sub-parts
HOWEVER, some problems cannot be parallelised because they must be executed sequentially
operating system
performs essential functions to keep a computer running efficiently
→ also managing hardware like the CPU
location of the OS
OS is a part of the boot strap in the ROM
when the computer is switched on: ROM loads the boot strap loader → boot strap loads the OS into RAM
4 parts of the OS
user interface
memory management
processor scheduling
interrupt handling
OS: user interface
hides the complexity of the hardware from the user by providing GUI or command line interface
OS: what does GUI stand for
graphical user interface
OS: memory management
managing the allocation of RAM to different programs
OS: paging and contiguousness
a memory management method that splits memory into equal-sized blocks called pages, each page having an address
→ it may be contiguous or not, meaning processes may be stored sequentially or randomly depending on free spaces available
OS: why is paging used in modern computers over segmentation
more efficient memory use as programs don’t need to be stored sequentially
→ but, some space may be wasted inside a page
OS: segmentation
divides memory into segments of different sizes based on program structure
OS: why is segmentation inefficent
leaves small unused gaps in memory that can’t easily be fulle dby other data
OS: what happens to performance if pages must be swapped between RAM and VM too much?
slows down the computer as VM access is slower than RAM access
disk thrashing
OS: interrupts + examples
a signal that tells the CPU to pause its current task and respond to something more urgent
printer runs out of paper
error occurs in program
scheduled interrupt from internal clock
OS: how interrupts happen
CPU checks for interrupts at the end of current fde cycle
CPU saves its current state by placing current register values into a stack
CPU runs an interrupt service routine (ISR) to handle the interrupt
after, the CPU restores its state by retrieving values from the stack back into registers
processing resume
(true/false) interrupts dont have different priorities
false
processor scheduling
method by which the OS allocates CPU time to completing processes, ensuring multiple tasks appear to be running simultaneously
OS: why process scheduling is important
ensure fairness between processes
provide acceptable response time
maximise CPU utilisation
scheduling type: how round robin works
all jobs are allocated a time slice for when it can use the CPU
CPU takes first job in a first-in-first-out (fifo) basis
if the job is not completed by the end of the time slice, the remainder is moved to the end of the queue
→ next job
scheduling type: how “shortest remaining time” (SRT) works
the time completion for each job is estimated as it arrives
the job with the shortest remaining time is executed but this means that a shorter new job can take over from the current one
scheduling type: how “shortest job first” (SJF) works
→ similar to “shortest remaining time”
the time completion for each job is estimated as it arrives
the job with the shortest remaining time is executed but a shorter new job CANNOT take over from the current one, so the current is fully executed
scheduling type: how “multi level feedback queues” (MLFQ) works
OS creates multiple queues with different priority levels
if a job has a high CPU time, its moved to a lower priority queue
if a job has been sitting in a low priority queue for a long time, its automatically promoted to a higher priority queue
what does BIOS stand for
basic input output system
BIOS
boots up a computer by checks hardware for faults, runs a bootstrap loader, and loads the OS into RAM
→ stored in ROM
device driver
a program that provides an interface that allows communication between the OS and an external device
why are device drivers needed?
allows the operating system to communicate with (inputs and outputs) and control hardware devices
virtual machine
software that is used to emulate a machine
→ runs one OS inside another, to emulate (imitate) different hardware
5 types of OS
distributed (DoS)
embedded
multi-tasking
multi-user
real-time
TYPES OF OS: distributed OS
manages a group of networked computers as a single system, sharing resources and tasks
TYPES OF OS: embedded OS
a specialised, dedicated OS designed to perform a specific, singular task within a larger mechanism
TYPES OF OS: (choose) an embedded OS is stored in ROM / RAM, has a lot of / minimal RAM, and runs with unlimited / limited resources
ROM
minimal
limited
TYPES OF OS: multi-tasking OS
allows a single user to run multiple programs or tasks seemingly simultaneously by quickly switching processor time between them
TYPES OF OS: multi-user OS
allows multiple users to access a single computer and its resources seemingly simultaneously using different terminals
TYPES OF OS: real-time OS
designed to provide guaranteed processing and response time, for time-critical tasks
→ such as medical devices or industrial robots
why is it good that a real-time OS used in intensive-care units is stored in the ROM?
non volatile, so data will not be lost when power is switched off
read-only, so any critical programs or data cannot be changed or deleted