1/49
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Stored Programming Concept
A new computer architecture storing both data and program instructions alongside each other in a computer’s main memory.
→ This allows computers to be reprogrammed to carry out out different tasks
Von Neumann architecture
consists of a main memory and a CPU (central processing unit), interconnected by buses
Characteristics Main memory
only holds the instructions that are currently in use by the CPU
volatile: contents are lost when the power is switched off
consists of a collection of storage locations, each with its own unique address (a storage location can hold a program instruction or a piece of data)
referred as RAM(random access memory) because storage locations can be read from and written to in any order
classed as primary storage because CPU has direct, fast access to it
5 Components of the CPU
1) Control Unit
2) Arithmetic logic unit
3) Registers
4) Clock
5) Buses
Control Unit (CU)
fetches program instructions from the main memory one at a time
decodes them
and directs the other components of the CPU to execute it
Arithmetic logic unit
performs arithmetic(mathematical) and logical operations on data
Registers
small, fast memory locations used to store program instructions, intermediate results and data within the CPU
can have general purpose or specific functions
Clock
Regulates the number of fetch-decode-execute cycles carried out per second. The faster the clock, the more cycles per second.
synchronises other components
Buses
3 types of buses work together to transfer program instructions and data between the main memory and the CPU
Address bus
control bus
data bus
Address bus
holds the address of the memory locations that the CPU will read from or write to
unidirectional (CPU → main memory)
Control bus
carries signals between the CPU and other components of the computer system so they know whether to read or to write
bidirectional
Data bus
transfers program instructions and data between the CPU and the main memory
Fetch-decode-execute cycle: Fetch
CPU puts memory address of the next instruction on the address bus,
CU sends read signal along control bus.
Program instructions and data are transferred from main memory along data bus to the CPU, stored in registers
Fetch-decode-execute cycle: Decode
The CU looks up the program instruction the CPU’s instruction set
Fetch-decode-execute cycle: Execute
The CU coordinates operations of other components in the CPU to execute the instruction, e.g. ALU
Why is primary storage needed?
Primary storage (such as RAM, computer’s main memory) provides the CPU with fast, direct access to program instructions and data that’s currently in use. It only contains its contents temporarily.
Why is secondary storage needed?
Secondary storage is needed because it is non-volatile and provides long-term storage for data and program instructions that are not currently in use.
Types of Secondary Storage
Magnetic Storage
Optic Storage
Solid-state Storage
Magnetic Storage
Consists of a stack of circular, metal platters that spin at a high speed
Both surfaces of platter are coated with a substance that can be magnetised
Each platter has its own read-write head
Write: An electromagnet in the read-write head magnetises surface into one of two polarities : north, south which represent 1 or 0 in binary
Read: An electromagnet in the read-write head detects the magnetic state of the surface of the platter
Examples: Hard disk drives, magnetic tape drive
Advantages:
relatively cheap
infinitely rewritable
high capacity
lasts a long time
FAST DATA ACCESS
Disadvantages :
contains moving parts so is easily damages when dropped or banged
noisy
Optical Storage (CD’s, DVD’s)
Write : Laser burns marks into the reflective surface of the disk, called pits. Pits are less reflective and represent 0. Lands are reflective and represent 1.
Read : Laser beam is shone onto the surface of the risk and light sensor detects if light is reflected.
Advantages:
small, portable
cheap
lasts a long time
Disadvantages:
easy to scratch
limited reusability
slow to access
Solid-state storage (SSDs, USB sticks, portable and mobile devices)
Write: Electrons are trapped into pools,
a full pool represents 0 and an empty pool represents 1
Read : A voltage is applied, if the pool is empty the transistor turns on and a 1 is read out. If the pool is full the transistor does not turn on and a 0 is read out.
Advantages:
reliable, no moving parts
very fast data access
low power consumption
quiet
Disadvantages:
expensive
limited number of read-write cycles
Embedded systems + Characteristics
A small computer that performs a specific task within a larger system.
1) they work in real-time, they respond immediately to requests
2) they have minimal user interface
3) They are responsive to their environment
4)They have limited memory
5) low power consumption
6)wireless connectivity
7)single purpose
Hardware components of an embedded system
Operating system
provides interface between the hardware and the software of the computer, also provides interface for the user
Main tasks:
User management
File management
Process management
Peripheral management
User management
Access control: The OS uses biometrics or password to authenticate users and control who can log on in shared computers
provides an user interface, enabling them to interact with the computer
GUI- Graphical user management, uses WIMP(windows, icons, menus, pointers)
CLI- only allows user to type in commands, lighter and more efficient, used by experts who want more control
File permissions (Read, write, execute, delete)
OS enforces the file permissions associated with each user.
Process management (processes are programs loaded into the CPU)
oversees the execution of instructions, allocates each of them a share of CPU time(since it can only execute one instruction at a time) and main memory
The OS uses a scheduling algorithm to do this
Round Robin
Each process gets time slices. The process with higher priority gets more time slices.
The processes wait in a queue. The process at the front of the line gets to use the CPU next
During its time slice, a process has exclusive use of the CPU
If it’s still unfinished, it goes to the back of the queue waiting for its next turn
Peripheral management
peripheral = additional piece of hardware such as printer, keyboard, mouse,…
The OS uses device drivers to communicate with the peripherals. The device drivers are installed on a computer’s hard drive and must be kept up to date to keep the peripherals functioning.
Memory management
Process that’s loaded into main memory from 2ndary storage gets allocated a block of addresses called pages.
When a computer’s memory becomes full, the OS uses a paging algorithm to move inactive processes out of main memory into an area of the hard drive called virtual memory. This frees up space.
File management
OS manages and tracks files stored on a computer’s hard drive. Files are stored in a hierarchical tree structure. The top node is the root directory (a directory is a folder containing other items). The nodes further down are either sub-directories or files.
2 types of important softwares
utility software
robust software
Utility softwares
data compression software
disk defragmentation software
backup software
file repair software
anti-malware software
Data compression software
Repackages (lossless compression) or removes (lossy compression) some of the file’s data to reduce its size.
This frees up space in the secondary storage and makes the files quicker to be transferred across networks.
Disk defragmentation software
happens only in magnetic storage due to moving parts
rearranges individual file blocks into sequential order which speeds up access to files on a magnetic hard drive
Backup software
Backup of files are made at regular intervals and stored in a different location to the current working environment, possibly the cloud.
This keeps a copy of the file so the most recent backup can be restored when a file gets lost or damaged.
File repair software
Scans the damaged file and extracts as much data as possible and stores it in a new usable file.
It aims to recover data from and repair files that has been corrupted by a cyberattack or computer malfunction.
Anti-malware software
Protects computer systems from damage caused by malware, such as viruses, worms, and spyware
Some use a data base of malware signatures(patterns) to detect malware and quaratines or eventually deletes it if it’s the case.
Some use heruristic analysis to detect suspiscious behaviour, such as a program that remains in memory after it has finished executing.
Robust software
A program that is able to handle unexpected actions without crashing or producing incorrect output, free from vulnerabilities that can be exploited by criminals
Code vulnerabilities
Hidden weaknesses in a program/code that could pose security threats and be exploited by criminals to cause damage and gain access to confidential information.
Things programmers can do to make their program robust:
Good programming practices
Carry out regular code review
Keep an audit trail
(Bad programming practices include: insufficient planning, insufficient testing, poorly structured code, quick fix rather than well-considered solutions, …)
Code reviews
Check that software adheres to agreed standards
to find any instances of inefficient code
Find any instances of bad programming practices
identify potential vulnerabilities
carried out by other programmers or a specialised software
Audit trails
helps improve accoutability by keeping track who made what changes during what process.
when a problem is discovered, it can tracked back to its source ad rolled back to a version before the flaw was introduced
Characteristics of low-level languages
one line is one instruction only
they are machine-specific, so they can manipulate the hardware directly- but this also means they are platform dependent and cannot be run on a computer with a different type of CPU
interact directly with the hardware, enabling the memory to be used efficiently
Machine code / Assembly language
Example: device drivers and embedded systems
Machine code
written in binary so it can be directly processed by the CPU without translation
extremely hard to debug and to write
Assembly code
uses short, memorable keywords called mnemonics to represent the instructions, making it easier for humans to understand
must be translated to machine code before they can be executed by the CPU
High-level langauges
Java and Python etc.
use keywords in english, easier to write and debug
problem-oriented, allow programmers to focus on logic
has libraries with pre-set funtions
must be translated before it can be executed by a CPU
not platform dependent, can be used on computers with a different type of CPU
used in softwares
Compilers
takes in the source code as a whole and translates it into object code in one go
produces an executable file that hides the source code, protecting the original code from competitors
the program runs more quickly when it’s executed because it is already translated into machine code
translation is only done once as a separate process
Errors are reported at the end of the translation
changing the program requires going back to the the source code and recompiling the code to execute it
machine-dependent, cannot be run on computers with a different type of CPU
Interpreters
translates and runs the program one line at a time
as the source code is translated line by line while execution is happening, the program runs more slowly
stops translating and reports the error as soon as one is encountered, (so the programmer know where exactly the error is)
code is not platform-specific and can be run on any computers with a suitable interpreter
the program can be easily edited as it alwys exists as source code, but this exposes the source code to competitors
Assemblers
translate mnemonics of Assembly languageto machine code. There is one assembly language instruction for each machine-code instruction
Differences between Interpreter and Compiler
A compiler translates the whole source program in one go before execution and produces an executable file, while an interpreter translates and executes the program line by line.
Errors are reported at the end after a compiler has finished translating, whereas errors are reported by the interpreter as soon as they are encountered. The interpreter will stop translating.