1.2 Software Flashcards
What does OS stand for?
Operating System
What is an OS?
A consistent platform for all software to run on, which manages the hardware, software, security and memory resources of a computer
What are examples of personal desktop PC OSs?
Microsoft Windows
Linux
MacOS
What are examples of mobile devices OSs?
Android
iOS
What are examples of server OSs?
Linux
Windows Server
What is layering?
When the user doesn’t need to worry about how application software interacts with the hardware, they just ned to know how to interact with the application software
Is an OS an example of layering?
Yes
What are three categories of OS functionality?
Hardware
User Interface (UI)
Security
What is hardware functionality?
Performs functionality to manage processes that need to be executed by the CPU
Deals with storing and retrieving data and using device drivers to communicate with I/O devices
What are some examples of hardware functionality?
Processor scheduling
Handling interrupts
Peripheral management
Memory management
Secondary storage management
How does the OS manage processes?
Determines order processes are passed to the CPU and amount of time a process will be allowed before switching to another
OS receives processing requests and sends them to the CPU when they need to be executed and tells the CPU when interrupt is received and pause the current process whilst interrupt completed
Why is processor management needed?
CPU needs to execute a large number of processes every second which need to be queued and sent to the processor in the correct order
What is an interrupt?
Signal sent to the processor to request immediate attention
How does the OS handle interrupts?
Determines if the current process should be paused for interrupt to be executed
If it is, OS stores current contents of registers and loads address of first instruction in ISR for interrupt to be dealt with
When interrupt completed, original process loaded and continued
How does the OS manage peripherals?
Manages I/O devices
Communicates with input devices using device drivers and sends data to correct part of computer
Takes data in memory or output from CPU and communicates with output devices using device drivers
How does the OS manage memory?
Records how memory in a computer is divided (paging/segmentation) to ensure data allocated fairly
Data needs to be loaded from HDD into RAM when in use and removed from RAM when no longer needed
Ensure enough space in memory to store data requried
Keeps track of where data stored
How does the OS manage secondary storage?
Ensures enough space to be able to store required data
Keeps track of where data stored so can be retrieved again
Keeps track of free space
What is a UI?
Way of the OS allowing the user to communicate with the device
Can take many forms, type depending on device being used and level of experience of user
What are some examples of an UI?
Graphical User Interface (GUI)
Natural Language Interface
Command Line (CLI)
What is a GUI?
Way of a user interacting with the device using a series of icons and images
Who is a GUI suitable for?
Novice users
What is a Natural Language Interface?
Where user can interact with a computer using their natural language
What is a CLI?
Method of users being able to interact with a computer where they need to know specific commands to perform actions
Quick if the user knows commands
Who is a CLI suitable for?
Skilled users as they need to know the specific commands
What is security functionality of an OS?
OS supports security of device by ensuring that resources are protected from unauthorised access through use of permissions and passwords
What are some examples of security?
Username and password
User access folders
Restricting access to files and folders
Encryption
Read only
What purpose do username and passwords have?
Ensures only users with suitable usernames and passwords can log into a device
What purpose do user access levels have?
Manages actions a user can perform depending on their user access levels
Determines if they can see folders, change settings, install software
How is access restricted to files and folders?
Password allocated to them, which means the contents are only viewable if the user knows the password
What purpose does encryption have?
Data on hard drive encrypted so if someone gained unauthorised access they wouldn’t be able to understand data stolen
What does setting files/folders to ‘read only’ read?
So user can view, but not edit, files
Enforced via password of user access levels
How does the OS manage network protocols?
Manages network transmission of data and protocols used within, including TCP/IP, HTTP(S), FTP
Establishes connection with device data is being sent to and agrees protocols with device
How does the OS load and run programs?
- Locate where program is stored
- Check if enough space in RAM
- Move required data from secondary storage to RAM
- Send interface to monitor
What are paging and segmentation?
2 techniques enabling OS to make optimum use of memory by splitting the memory into small sections and saving data in non-contiguous data locations
What are memory management operations?
Tracking status of memory allocation
Determining storage requirements
Controlling memory usage
How does the OS track the status of memory allocation?
Memory divided into physical address spaces
OS initially marks each space as free but, when required, OS loads data into spaces and marks them as allocated
When data or instructions are no longer needed, OS marks spaces as free again allowing data to be overwritten
How does the OS determine storage requirements?
Rare that data needed for a process can fit in a single memory locations
Determines how much memory to allocate to each process that’s running, based on requirements of its programming
Reserves blocks of addresses for each process to use
How does the OS control memory usage?
Manages swapping between processes and their memory space to provide memory access as required
Main memory is hardware resources with physical addresses used to locate areas in which data and instructions can be stored
When program executed, logical addresses produced and total of these logical addresses makes up logical address space of that process
Maps logical address space to physical address space and memory usage between processes
What is paging?
Data split up physically into equal size pages, not considering data it’s storing
What is segmentation?
Data split up logically into different size segments, considering data it’s storing
What is virtual memory?
Part of the hard drive which is allocated as an extension of RAM
How does the OS manage virtual memory?
Swaps data between virtual memory and RAM as required
What factors affect the division of processing time?
When task was requested
Importance of task
Length of task
What happens as a computer runs more processes?
Longer it takes for a process to be allocated processor time
Unsuitable for processes that must perform tasks almost immediately
What are the reasons a processor can be interrupted?
Hardware device has signalled it has data to process
Hardware device has completed a task it was asked to do
Software processor needs a service to be provided or OS function to be performed
Allotted amount of time expired and an action needs to be performed
Hardware failure occurred and needs to be addressed
What does ISR stand for?
Interrupt Service Routine
What is an ISR?
Mini program that’s been designed to respond to an interrupt’s request
Can be built into an OS or provided via device driver
What are the stages of an interrupt?
- Processor receives the interrupt
- Processor completes the FDE cycle of instruction that was running when it received interrupt
- Current contents to processor registers (including PC) saved to memory
- Origin of interrupt identified so that appropriate ISR called
- All other lower-priority interrupts put on hold to allow ISR to finish running
- PC updated with address of first instruction of ISR
- ISR completes its execution
- Processor registers reloaded with values saved to memory
- Lower-priority interrupts that were put on hold re-established
- PC set to point to address of next instruction that needs to executed in program that the processor was running when it received interrupt
Rank types of interrupt from highest to lowest
- Hardware commands
- Program/software
- Timer
- Input/output devices
What are hardware commands/interrupts?
Shutdown to start triggered by user pressing off button
Memory parity error (data loaded contains different value than when it was stored)
Internal clock triggers suspending proces
Reset button pressed
Power supply failure
Power-down command (screen off, hibernate)
How does hardware interrupts/commands work?
Send a physical signal to the CPU via the interrupt chip
What is a program/software interrupt?
Software detects an error has occurred and issues software interrupt for CPU to run some instructions to try and clear error
Illegal instruction encountered an interpreted code
Arithmetic overflow (result of calculation exceeds available storage)
What is a timer interrupt?
Data-logger has to read an input sensor every one second
Screen-recording application that has to read next screen update
What are I/O device interrupts?
Devices like the keyboard and mouse demand attention or inputs would never get a look in
Hard disk
Optical disk
Printer
Graphics tablet
What are scheduling algorithms?
For computer to switch tasks, OS must control suspension of process currently running and control subsequent continuation of another process
Current process suspended and saved into memory and then when CPU is ready to service it, state reloaded and process continued
Scheduling algorithms determines order OS will execute processes
What does a scheduler do?
Makes sure time allocated fairly to all processes
Maximises use of CPU and all hardware
Makes applications run as quickly as possible
What are examples of scheduling algorithms?
First Come First Served (FCFS)
Shortest Job First (SJF)
Shortest Remaining Time (SRT)
Multi-Level Feedback Queue (MLFQ)
Round Robin (RR)
What is starvation?
When a process cannot complete its execution because its constantly denied processor time
What is First Come, First Served?
First job to enter ready queue is the first in the running queue
Execute each process in its entirety?
Is FCFS pre-emptive?
No
What are the advantages of FCFS?
Simplest method to implement
Once a job starts, will definitely be completed
Should avoid starvation
What system does a FCFS work well in?
One that only has a few concurrent processes
What are the disadvantages of FCFS?
Can be a long wait before a process can run
What is Shortest Job First?
Process with the shortest/smallest running time is run next
When a process starts to be executed, it’s executed in its entirety
Jobs sorted in the ready queue according to estimated processor time needed
Is SJF pre-emptive?
No
What are the advantages of SJF?
Reduces wait times because shorter processes are removed quickly, meaning that the processor can allocate more jobs to longer times
What are the disadvantages of SJF?
Time estimation of a job could be wrong and this is what is used to determine which job first
Susceptible to starvation as if shorter jobs keep being added, scheduler will keep prioritising these jobs so longer processes won’t be serviced
What is Shortest Remaining Time?
Processor continuously reorders queue during run time
If a process added to the queue has a shorter amount of remaining time, interrupt is raised
Current process suspended in favour of the new one
Is SRT pre-emptive?
Yes
What are the advantages of SRT?
Short processes executed immediately which is useful for higher performance systems running many small concurrent processes
What are the disadvantages of SRT?
Starvation of long-running processes
What is the Multi-Level Feedback Queue?
Processor queue split into multiple queues with different priorities
Processor will execute all processes in highest priority queue first then move down the groups
If a process isn’t getting enough CPU time, will be moved to a higher priority queue
If a process is getting an unfair amount of CPU time, will be moved to a lower priority queue
Is MLFQ pre-emptive?
Yes
What are the advantages of MLFQ?
Eliminates starvation
Can manually flag processes as higher priority to guarantee execution
Processes can be executed very efficiently
What are the disadvantages of MLFQ?
More difficult to implement
What is Round Robin?
Each process is given a maximum length of processor time in the running state after which it’s put back into the ready queue
What are the time period allocated to the processes called?
Time slices
Is RR pre-emptive?
No
What are the advantages of RR?
Ensures every task is allocated processor time without a long wait
Eliminates starvation
What are the disadvantages of RR?
Doesn’t scale well as more processes run, the time slices get smaller
Urgent tasks less likely to be completed quickly
What are the different types of OS?
Distributed
Multi-task
Multi user
Embedded
Real time
What is a distributed OS?
Processing appears to be completed on a single computer
However, task split and processed on multiple devices acting as a single computer
Data shared between devices
What is an example of a distributed OS?
Creating weather satellite imagery
What is a multi-user OS?
Enables computer to perform multiple operations at once, or at least, what appears to be
What is an example of a multi-task OS?
Someone working on a home computer
What is a multi user OS?
Allows multiple users that are on different computers to access single system’s OS resources simultaneously
What is an example of a multi user OS?
School system
What is an embedded OS?
Found inside other devices
Has a dedicated function
What is an example of a embedded OS?
Washing machine / Satnav
What is a real time OS?
Ensures tasks are completed within an agreed period of time
What is an example of a real time OS?
Hospital
What does BIOS stand for?
Basic Input/Output System
Where is BIOS stored?
Non-volatile memory
When is BIOS available?
When the computer starts
What are the jobs of the BIOS?
Initialises and tests hardware in a computer system so it’s ready for use by other software on the computer (POST)
Loads bootloader program (bootstrap) from secondary storage
What does POST stand for?
Post-On Self-Test
What does the bootstrap do?
Starts initialisation of OS
What would happen without the BIOS?
Nothing could be loaded as main memory doesn’t contain any instructions that could start boot process
When do modern systems use BIOS?
Only use it during initial stages of booting up a computer because software design’s become so effective that there’s no need for separate programs to be involved, making process more efficient and easier to control
Where is BIOS stored now?
Used to be stored on non-volatile ROM chip
Now stored on flash memory systems because more convenient and easier to update software in-place
What does CMOS stand for?
Complementary Metal-Oxide Semiconductor
What is a CMOS memory circuit?
Has it’s own battery so it can maintain it’s data between restarts
Any configurable settings are stored on CMOS memory circuit
What is CMOS memory circuit used in?
Modern computer systems to keep track of key functions
What are the stages when a computer is booted up?
- Power turned on
- Only data from ROM can be used at this point
- POST is run, checks all parts that it needs to “come to life” are there and available
- Clears anything that may still be in the registers or the CPU
- Loads address of the first instruction in the boot program into the PC
- Control now passed to boot program that carries out its own checks on the hardware
- Checks for any BIOS on the hard disk or on a storage device called CMOS RAM
- Combines this with the basic BIOS stored on the ROM and then sent to RAM
- This file of information called the boot file
- Computer now ready to load OS
- OS normally found on hard disk but it will look at other locations first such as additional bootable device if told to do so by BIOS
- OS now takes control of the computer and the memory and will load jobs into memory for processing as per the scheduler
What are device drivers?
Small programs that are used to control a piece of hardware, providing an interface between OS and hardware
Where would you find device drivers?
When you install a new peripheral have to install drivers
May be on CD ROM, downloaded from internet or preloaded in OS
How do the OS and device drivers work together?
When OS receives a command (to print) passes this to device driver for that piece of hardware as the device driver knows how to communicate with this piece of hardware
What are the specific device driver functions called?
Routines
What is a virtual machine?
A host system running software that allows other software to behave as if it were running on a hardware system
Can be configured to replicate any combination of hardware so that software running on it acts as if it were accessing certain devices even if they don’t exist
What is virtualisation?
Many VMs running on a single host PC
What are some examples of roles of VMs?
Running alternative OSs
Supporting incompatible software
Creating a test system
Running multiple servers
How does a VM run alternative OSs?
Created to allow installation of one OS within another OS
Legacy OS or OS that wouldn’t normally be able to run on hardware host
VM can emulate different hardware setups so software runs as if running on different hardware platform
How does a VM support incompatible software?
Some older software might not run on newer systems
VM could emulate older system on which user can run older software
How does a VM create a test system?
VMs are closed, controlled environments
“Hardware” of VM only exists as self-contained software process that’s isolated from actual host system
Provides opportunity to run software that’s potentially damaging (malware, early versions of software that needs to be analysed)
How does a VM run multiple servers?
Servers on network are required to fulfil multiple roles
More than one server can run on a VM, allowing for separation of services without need for multiple pieces of hardware
What are some examples of VMs?
Emulators - allow for another system to be used on a PC
Windows VM - used to “make” a PC a MAC
Test environment - enables testing of a game on different systems
What is intermediate/byte code?
For all different programming languages, different version needs to compiled for each of the different machines it can be run on
Different languages partially compiled from source code into intermediate/byte code then run on VMs on same PC
What are the three types of software?
Operating System software
Utility software
Application software
What is OS software?
Manages hardware, software and memory resources of the computer
What are some examples of system (OS) software?
OS
Linux
iOS
macOS
What is application software?
Enables the user to perform tasks
What are some examples of application software?
Word processing software
Graphical editing software
Video editing software
Music production software
Spreadsheet software
Presentation software
Web development software
What is utility software?
Maintains, protects and improves performance of the computer
Analyses, diagnoses problems with and tries to fix parts of your system
How does utility software come?
Pre-installed as part of OS
What are some examples of system (utility) software?
Defragmentation
Decryption
Compression
Anti-virus
Anti-spyware
System info and diagnosis
Firewall
Disk formatting
What is compression software?
Used to both compress and decompress files on a computer
Decreases the amount of data inside of files
What are the reasons to compress files?
Increasing amount of available space on a secondary storage device (if each file takes up less space, have more available space, good for files used infrequently)
Sending files on a network (if file size smaller, less processing and less time required)
When sending a file with an email (restriction of file size that can be sent, ensures maximum file size isn’t reached)
What is defragmentation?
Recognises files on a hard drive
Groups together files so that related data is stored together
Why is defragging necessary?
When data is saved on a hard drive, may be split up if first available space doesn’t have enough memory to store all required data
How are files defragged?
Moves files to temporary empty space on the HDD
Groups together empty spaces on the HDD
Groups together related files
Replaces data on the HDD so all related data stored together
What is encryption?
Process of using an algorithm to convert plaintext into ciphertext
What is the utility software of encryption responsible for?
Applying encryption algorithms
Decrypting data using encryption key
When is encryption used?
Transferring data securely across a network to prevent it being read in case of interception
On files on a secondary storage device to prevent access to files in case of hacking or theft
What is malware?
Malicious software that’s been created with intention to cause damage to a computer
What can malware do?
Corrupt files
Delete files
Change files
Steal files
Cause disruption to service
What are different forms of malware?
Virus
Worm
Trojan
Remote Access Trojan (RAT)
Spyware
Ransomware
What is a virus?
Malicious form of self-replicating software that attaches itself to other programs or files so that it can make copies of itself and spread easily to infect computer system
Remains dormant in the host file or program until the program is run and it’s able to execute
What can a virus be designed to do?
Send spam
Steal data
Infect other computers on the network
Corrupt files
How can a virus arrive?
Via email attachment
Visiting a malicious website
On a removeable storage device
Why can viruses be hard to detect?
They hide themselves in their host’s file
What are worms?
Replicate and cause damage to system
Don’t require a host program to spread, they can replicate and distribute independently
How can worms spread?
Using network features
Email service
What are worms typically designed to do?
Spread quickly and infect as many devices as possible in order to waste system resources
Use up network bandwidth and slow down network significantly
Sometimes use up all system resources causing a DoS attack
What is a trojan?
Piece of software that appears to be legitimate to trick user into executing it but also performs malicious actions
Aren’t self-replicating and don’t infect other files
Only operate if the victim runs the program
What is the main defence against trojans?
Educate users about the risk of downloading and installing software
What is usually the main objective of trojans?
Steal confidential information
Inflict damage
What is a RAT?
Computer may become part of a bot under the remote control of a hacker
What is a botnet?
Network of computers that are under the control of a single operator who can instruct all of the computer to do something at the same time
What can a botnet do?
Send out spam emails
Perform a distribute denial-of-service (DDoS) attack on a chosen target
What is spyware?
Type of malicious software that is installed on a device without the user’s knowledge, which captures data from the device and sends it back to the creator
Gathers information on a person and how they use a computer
What data can spyware gather?
Monitor internet usage
Send harmless but annoying adverts
Taking and reporting back screenshots
How can spyware be installed?
Visiting a suspicious website
Clicking a link in an email
Downloading a legitimate program that’s been bundled with malware
How can spyware be removed?
With a removal tool but user must be alerted to its presence in order to know to run the clean-up tool
Routinely run anti-malware tools
What is ransomware?
Locks a computer or encrypts files and therefore prevents user from accessing their data
Attacker will demand fee is paid before they release the files, although there is no guarantee that the user will get their files back even after they’ve paid the moment
What is anti-malware
Designed to protect a computer system by detecting and blocking threats
Continually monitors files and software being accessed by OS to detect signs of malicious intent
Software can be configured to deal with different threats
What is back up?
A copy of the original data is taken and stored in a different location
What is archive?
Original data is removed and stored in a different location
What are the reasons to restore files from backup?
Accidentally deleted
Virus infects files
Lose the original
Hardware failure (after fire/flood)
Data changed without intent
What are the two types of backup?
Full backup
Incremental backup
What is a full backup?
Backs up everything on the system
What is an incremental back up?
Only updates files that are changed?
What is a disk formatter?
Prepares a secondary storage device to be used to store files
Erases any data currently on the device
Makes sure the settings are correct so that it’s compatible with the OS
What is a file repair?
Designed specifically to recover files that have been corrupted or damaged files that can’t be opened any more
Attempts to repair damage to the file so it can be opened correctly by appropriate software application
Greater range of tools to restore and repair corrupt files
What is a disk checker?
Scans secondary storage device to check for corrupted files
Attempts to fix errors and gives option to delete them if not possible to restore the files
When does a file repair need to be used?
When data in file has gone missing or become disorganised making it unreadable by software attempting to open it
How can a file be damaged?
Bug in the software that wrote data to file
Malware that corrupts file maliciously
What is a file manager?
Provides GUI to enable user to manage files on their computer (rename, copy, paste, delete)
What is a disk repair?
Hard disk drive can develop faults that result in sectors becoming corrupted or unreadable
Software repairs disk by replacing data in bad sections with an empty sector so data can be read by computer
How can the bad sectors be caused?
Sudden loss of power
System crashes
Disk being exposed to static electricity
What can bad sectors cause?
Computer to run slowly
Files to become inaccessible
Whole disk to become unreadable
What is open source software?
Source code can be read and edited
Comes in a readable format
Can be tailored to needs to developer
What are some examples of open source software?
Linux
Libre Office
Firefox
VirtualBox
VLC
What are the advantages of open source software?
Can share software with others
User can modify it
Source code available for all to see
Free licence
New versions must come with same sharing/freedom licences
What are the disadvantages of open source software?
Support must be paid for
Finished quality of software can vary, although some can be very high quality
What is closed source software?
Source code cannot be read, edited or adapted
Applications come as executable format
Usually licence fee charged
Developed by commercial company
What are some examples of closed source software?
Adobe
Google Earth
Microsoft Office
What are the advantages of closed source software?
Support is usually free, although a premium can sometimes be charged
Developer provides free updates for a set length of time
Company obliged to provide software that’s fit for purpose as covered by Trades Description Act
What are the disadvantages of closed source software?
Source code not readily available
Software cannot be altered
Software cannot be shared with others
What are open source applications?
Code available for other parties to see and alter
Who pays the development cost of open source applications?
Spreads cost of development
Often volunteers will improve the code for free
Is code available in open source applications?
Available for other parties to see and alter
Who are open source applications often developed by?
People who do not have full knowledge of all the functionalities and methods used by the software, so solutions may be inefficient
Are there deadlines for open source applications?
No deadlines for development
Software often has ‘quick fixes’ to solve problems rather than full solutions to problems so there is no guarantee that the software will function fully
How are open source applications tested?
Lack formal development methods and testing which can make the software unreliable
Who pays the cost of development of closed source applications?
Wholly funded by the company
Costs recovered through sales
Is code available in closed source applications?
Kept by author
Only executable distributed
Who are closed source applications often developed by?
Professionally developed in-house by the company that produced the program
Technical solution is fully understood and improvement will be able to incorporate this to produce a more efficient solution
Are there deadlines for closed source applications?
Has formal deadlines and timescales for updates and produced with full solutions which the company is accountable for
How are closed source applications tested?
As developed in-house, tested fully and not released until software considered reliable
What is machine code?
List of binary instructions in memory that the CPU fetches one line at a time and decodes what they mean before executing them
What is an opcode?
First binary value
Operation code
What is an operand?
Second binary value
Address in memory of the data to be processed
What is assembly language?
Replaced opcode with mnemonic (one-to-one relationship)
Needs a translator to convert code to machine code
What are the problems with machine code?
Error-prone
Takes a long time to write
Lots of repetitions
Inefficient code
What is an instruction set?
Complete list of instructions supported by processor
What is source code?
Programs originally written in high or low level languages
Can source code be run by a computer?
Not unless it’s translated
What are high-level languages?
Consist of key words and command statements
What are the advantages of high level languages?
Understandable - commands easier to learn, write and debug
Portable - can be transferred and used on different types of computer (translator not source code that handles computer’s architecture)
Problem-focused - focus attention on problem-solving, not dealing with hardware specifics for machine it’s run on
What are the three types of translator?
Assembler
Interpreter
Compiler
What language is an assembler suitable for?
Low level
What is an assembler?
One mnemonic in assembly language equivalent to an opcode
Different assembler needed for each machine or chipset
What language is an interpreter most useful for?
High level
How does an interpreter work?
Code is put onto user’s machine along with interpreter
Translated line by line
Next line only translated if line before has no syntax errors
Once a line translated, code executed by CPU
If there is an error, program won’t run and user will be shown error
With an interpreter, can source code be viewed?
Yes
What are the advantages of interpreters?
Don’t need to recompile software and distribute to different platforms when changing software
Can change code and will be interpreted by relevant interpreter on hardware (compatibility across platforms)
What are the disadvantages of interpreters?
Have to have correct interpreter to run on a different computer
Can be slower to run as being translated one line at a time
What code is a compiler most suitable for?
High level
How does a compiler work?
Translates code written in a high level language to object code
Checks all lines of code for syntax rules then converts entire source code into object coed
Code fully translated into object code and executable file made
Executable file can run on user’s machine but differs depending on the type of machine being used
With a compiler, can source code be viewed?
No
What are the advantages of compilers?
Source code cannot be seen when running the file as it is already translated
Quick to run as already translated
What are the disadvantages of compilers?
Can take long time to translate as all done at once
May find a lot of errors as translating all code at once
What is intermediate code?
When compiler/interpreter only translates code to ‘half-way’ stage (more efficient)
Provides ‘standard form’ of code for translation to machine code
High-level -> intermediate -> machine
Can be run on a VM allowing code to run faster than interpreted code while allowing code to run cross-platform unlike compiled code
What does stages of compilation mean?
Set of stages that source code goes through so that executable object code can be produced
What are parses?
To translate code from source to machine code, translator run through series of parses
Each parse of code designed to carry out certain tasks
What should there be at the end of the parses?
Efficient machine code that can be ru
What are the stages of compilation?
Lexical analysis
Syntax and semantic analysis
Code generation and optimisation
What are the tasks in lexical analysis?
Removes all white space and comments
Turns remaining code into tokens
Creating a symbol table
What is removed in lexical analysis from the code?
Comments
Spaces
Blank lines
How does lexical analysis turn the remaining code into tokens?
Compiler looks for operators, reserved words, variables which are split into tokens
Analyses each line of code and assigns token to each part of the code
Identifiers checked against set of rules
Reserved words (print) only used as keyword tokens
What does a symbol table store?
Identifier or key word
Token class
Data type
Run time address or value
Scope
What are some examples of token classes?
Integers
White space
Identifiers
Keywords
Operator
Individual token classes
What simple error-checking occurs in lexical analysis?
Look for illegal identifiers
x and y would be flagged
Misspelt keywords and undeclared variables NOT detected
Does syntax or semantic analysis come first?
Syntax
What is syntax analysis?
Code is checked against rules of the language
What happens in syntax analysis?
Analysis syntax of the statements to ensure they conform to the rules of grammar for the computer language in question
Abstract Syntax Tree created
What are some examples of syntax rules?
Indentation
Missing brackets
Keywords misspelt
Missing code
Undeclared variables
What is an Abstract Syntax Tree?
Maps structure of program, first dropping the brackets, semicolons, etc that were used by the programmer
If required tokens missing from the tree or in the wrong place, compiler will report an error
What does an AST help identify?
Errors in the structure of the code
What is semantic analysis?
Code is checked to see if it is valid within the given context
What are some examples of semantic errors?
Data type declaration mismatch
Trying to access an array index that is out of bounds
Variables being used before they’ve been declared
Wrong number of parameters passed into subroutine
Trying to access a variable that’s out of scope
Attempting to use a reserved word from the language (e.g. print) as a variable name
What happens in code generation and optimisation?
Separate program is created that is distinct from the original source code
Code generated is object code (binary equivalent of the source code)
What is object code?
Executable version of the code BEFORE LINKED LIBRARIES ARE INCLUDED
What happens in code generation?
AST converted into object code
Major distinguishing feature between compilation and interpretation is interpreters don’t produce a separate executable file
What is code optimisation?
Takes place throughout the process but mainly in the final stage
Attempts to reduce execution time of compiled program
Removes redundant code and makes code as efficient as possible
Reduces amount of memory as some variables may not be required and speeds up the processing as it’s more efficient
What are the advantages of code optimisation?
Some compilers will be better at optimisation that others (what can make a good compiler)
More efficient code
Less memory needed
Quicker processing of code
What are the disadvantages of code optimisation?
Some optimisation may remove code it thinks is redundant and may give unexpected results
Can take a long time to optimise code
What is a library?
A pre-written collection of code that allows the programmers to import functionality into their own programs
What are programming libraries?
Gives you access to many specialised functions
Saves programmers from having to reinvent the wheel when writing a new program
Usually been thoroughly tested and is therefore reliable and efficient
What are some examples of programming libraries?
random - makes random choices
tkinter - creating GUI
pygame - creating Python game
matplotlib - creating graphs
numpy - performing mathematical operations on arrays
pandas - analysing, cleaning, exploring and manipulating data
What are linkers?
Used to combine together compiled code from various sources along with any code being pulled in from pre-written libraries into a single executable program file
What do linkers do?
Resolve all cross-references between the object code files created through compilation and creates a single executable program
Includes any links to any library code required by the object code into an executable file
What are the two types of linking?
Static
Dynamic
What is static linking?
Code needed from the libraries is copied and included in the executable file
What are the advantages of static linking?
Code doesn’t need to access external libraries during run time
Therefore if a library is missing on the client computer, the program will crash
What are the disadvantages of static linking?
However compilation could take a long time
Executable will be large and take up more space in RAM
What is dynamic linking?
Compiled versions of the libraries are stored on the computer and linked with the code by the OS at run time
What are the advantages of dynamic linking?
Less memory needed therefore quicker to process
Less code needed to compile so it is quicker
What are the disadvantages of dynamic linking?
If a library is missing, the code will not run
What is a loader?
A program which is part of the OS which is responsible for loading the correct files and libraries into the main memory when the program is run (used when dynamically fired)
What does SDLC stand for?
Systems Development Life Cycle
What are the stages of a SDLC?
Analysis
Design
Development
Testing
Evaluation
Maintenance
What happens in the analysis stage of a SDLC?
Feasibility study (cost, timescale, possibility)
Research (interviews, observation, data flow, future plans/growth of company)
Processing and defining user requirements so they’re understood
Finding out existing problems software is trying to solve
Working out what data will be in the system and its origin, uses, volumes and characteristics
What needs to be done in systems and what happens if error occurs
What are the outputs of the analysis stage of SDLC?
Problem definition - clear explanation of problem and its domain
System requirements/objectives - clear description of what the systems need to do (specific, measurable, achievable, realistic, time bound)
What happens in the design stage of an SDLC?
System architects oversee design process where they draw attention to specific skills and expertise from UI designers, database designers
Database
Hardware and software required
Test plan
Design specification - document
What are the outputs of the design stage of a SDLC?
UI (design menus and UIs)
System outputs (reports, emails, graphs)
Algorithms (flowcharts, pseudocode, modular structure)
What data structures data will be held in
Security features
What happens in the development phase of a SDLC?
Code solution
Most projects completed in teams with wide range of experience and skills so can specialise in their area of expertise when working
If done by organisation, will be set style and standards that follows company’s in-house conventions
Project manager oversee project through development process
White box testing where each module is tested as it is developed by examining code written and efficiency and alpha testing
What happens in the testing phase of a SDLC?
Testing for robustness and whether it fulfils the criteria
Black box testing where inputs and outputs of systems are examined
Beta testing
What happens in the evaluation phase of a SDLC?
Can be carried out throughout the project but mainly done once project completed
Reviewed in terms of functionality, effectiveness, usability, reliability, maintainability, extendibility
Compared against requirements
Technical documentation - explains how system works and allows for those taking over code in future to understand work done
User documentation - required for more complex parts of the code and for those less experienced
Client signoff
What happens in the maintenance phase of a SDLC?
Agreed maintenance period
Fixing bugs that arise in the system
Changing software where it doesn’t work
What is scope creep?
Additional requirements added during the project
What are the software development methodologies?
Waterfall
Spiral
Rapid application development (agile methodology)
Extreme programming (agile methodology)
What is the waterfall method?
Each stage is completed in turn so stages and COMPLETED SEQUENTIALLY
Next stage doesn’t start until previous one is completed, signed off and documented
Previous stage can be returned to however developers must then complete next stages
CLEARLY DEFINED stages
When is the client involved in a waterfall method?
Analysis stage to help project team work out requirements of system
Then little involvement until project is developed
What are the suitable uses of a waterfall method?
When requirements are very clear and well-defined (at beginning of project)
Large-scale development projects due to ease of management
Not suitable for innovative or complex projects
What are the advantages of the waterfall method?
Everyone is very clear on their responsibilities at each stage
Simplicity makes it easy to manage
Easy to see if project is running to schedule
What type of method is the spiral model?
Iterative method
What is the spiral model?
Always complete a RISK ANALYSIS in a cycle (whether cost is spiralling, timeframe, out of data technology, changing business processes)
In each cycle, prototype is developed, reviewed and evaluated
When is the client involved in the spiral model?
Review with client in EVERY CYCLE to get client feedback
What are the suitable uses of the spiral model?
Large, complex projects where risk is a key factor
Projects containing high level of risk or uncertainty
Large scale problems
What are the advantages of the spiral model?
Risk placed at the heart of this model
Excellent for projects which contain high level of risk or uncertainty
Very suitable for large scale problems
What are the disadvantages of the spiral model?
Risk is SUBJECTIVE (what one person sees as a big risk, may not be considered such a big risk to a project)
Need to have a member of the team skilled in identifying and quantifying risk, which is highly specialised skill
Takes time in the project and costs money
Complex nature of risk analysis adds to expensive
If risk analysis done badly, project will suffer
Which methodologies are classified as agile methodologies?
Rapid Application Development (RAD)
Extreme programming
What are agile methodologies?
Prototypes are created and feedback gained from the client ASAP
Feedback used to inform next prototype
What are the suitable uses of agile methodologies?
Small to medium projects
What are the advantages of agile methodologies?
Can be used for big projects if decomposed into sub-projects
What are the disadvantages of agile methodologies?
Can result in scope creep
What is RAD?
Based on building a SERIES OF PROTOTYPES each of which adds to the previous and is reviewed by the client
Less emphasis on planning and documentation and more on developing something and then using this to inform next stage
Objectives/requirements GRADUALLY REFINED during each stage/prototype
What are suitable uses of RAD?
When client requirements not well defined
Not suitable for projects where code efficiency is important (focus on usability rather than how product works)
Doesn’t scale well for large projects with big teams
What are the advantages of RAD?
Initial prototypes developed quickly
Requirements don’t need to be entirely clear from the start
Continuous feedback from client means end project likely to have excellent usability
What are the disadvantages of RAD?
Poorly written, inefficient, patched code
Regular contact must be maintained at all times
What is extreme programming?
Series of short releases and short cycles
Each release is fully working
Focus on refinement/quality and efficiency of code (completed through PAIRED PROGRAMMING)
Development/feedback loops shorter as prototypes not produced but FULLY WORKING versions produced
When is the client involved in extreme programming?
Continual interaction as member of client team part of development team
What are the advantages of extreme programming?
Efficient, robust code produced
Fewer bugs on release and high performing software
Has a very high emphasis on programming so quality of end code likely to be very high
What are the disadvantages of extreme programming?
Difficult if not all of team and end user can be in same place
Client must be able to commit to having a full time representative working with development team
Requires team of programmers working in close collaboration, unlikely to work well if distributed geographically
What are the types of testing?
Black box testing
White box testing
Beta testing
Alpha testing
What is black box testing?
Tests just inputs and outputs
Not concerned with quality of algorithms
What is white box testing?
Tests logic of a problem
All paths through
Quality of algorithm checked
What is alpha testing?
Tests very early version of software
Restricted to company
Employees provide feedback
What is beta testing?
Tests almost finished version of software
Extended
Invited group of external testers who provide feedback
What is the order of the four types of testing?
Start of development
- white box testing
- black box testing
- alpha testing
- beta testing
End of development
What are programming paradigms?
Used to specify an overall approach to writing program code
What is Turing complete?
Most programming languages in most paradigms are this
Can solve all problems a computer is able to solve
What is the structure of programming paradigms?
Types of languages -> low level, higher level
Low level -> machine language, assembly language
Higher level -> imperative, declarative
Imperative -> procedural, object-orientated
What is imperative language?
Write a sequence of instructions for the computer to perform using sequence, selection and iteration
Focus is on stating HOW A COMPUTER SHOULD OPERATE (TELLING IT WHAT TO DO)
What is a declarative language?
Focus on what the program should achieve, the OUTCOMES OF THE CODE
Used in intelligent systems and makes use of a knowledge base
What is an example of a declarative language?
SQL
What is a procedural programming paradigm?
Where program code is divided up into self-contained procedures/functions (subroutines) which are discrete blocks of code that carry out a single task
Systems built by combining these procedures
Procedures share data by passing data between them or through global variables
Procedures have their own variables not accessible from outside the procedure
What is the programmer responsible for in a procedural paradigm?
Specifies steps needed to execute the programmer and in what order
How is logic of a program expressed in a procedural programming paradigm?
Series of procedure calls
What are some examples of procedural languages?
Pascal
C
Visual Basic
Python
What is an object-orientated paradigm?
Identify the self-contained objects that make up the system and the way they interact with each other
Systems built around objects
Each object contains both program routines (methods) and data being processed
Objects can be easily reused and inherited without having to rewrite code
Because objects are self-contained and simple they are more reliable and easier to program
What is the programmer responsible for in an object-orientated paradigm?
Designed self-contained objects
What are some examples of object-orientated languages?
C++
Delphi
Java
Visual Basic
What are the characteristics of assembly language?
One-to-one relationship with machine code
Use mnemonics (short codes) to represent specific sets of machine code 1s and 0s
Specific to processor
Use symbolic address as labels to reference locations of data in memory
What are low-level languages?
Specific to instruction set of the processor
Defined by processor manufacturer
Makes code written non-portable (only run on processor of same type it was written for)
What are some examples of LMC instruction set?
LDA - load
STA - store
ADD - add
SUB - substract
INP - input
OUT - output
HLT - end program
BRZ - branch if 0
BRA - branch always
BRP - branch if 0 or positive
What modes of addressing is used in high level languages?
Mode of addressing is abstracted from the developer
What mode of addressing is used in assembly language?
Developer would directly use different modes of addressing depending on what they wanted to do
What are the different modes of addressing?
Immediate
Direct
Indirect
Indexed
What is immediate addressing?
Hard coding the value into the instruction
Operand is not a memory address but the value to be used
How fast is immediate addressing?
Fastest method as don’t need to access computer’s memory
What is direct addressing?
Operand is absolute memory address is used and not the value
Relies on value always correctly being at the location specified, which may cause problems if the code is moved
When is direct addressing generally used?
For a computer system that uses only one program that wouldn’t be relocated in memory (on an embedded system)
How fast is direct addressing?
Quick method but not as quick as immediate
What is indirect addressing?
Often used with linkers and loaders
Address of data held in an intermediate location - therefore address of where the data is stored must be looked up
Point to a memory location that contains physical address of where we need to get data from
Data (such as programming library) can be put in memory location and therefore be moved
Address of where to find this stored as intermediate address
Intermediate address location part of instruction
How fast is indirect addressing?
Slower than previous methods but more flexible when loading larger amounts of data
What is indexed addressing?
Final address of data determined by starting address and an offset
Use an index to offset the value and find the appropriate value within an array
What is indexed addressing used for?
Arrays
What is a class?
A template outlining attributes (properties) and methods (actions/behaviours)
What are instantiated from classes?
Objects
What is an object?
Instance of a class
What is an attribute?
A piece of data to store about an object/a property of an object
What is a method?
The action that can be performed on an object
How are methods created?
Adding subroutines to a class definition
What is encapsulation?
Implemented by setting attributes and methods to public/private
Object should bind together attributes and methods that manipulate the data
Does this so that data is protected
What is public vs private?
Attributes and methods can be set to these to determine if code external to the class can call/access the attributes/methods or not
Getter and setter methods are used to access attributes that cannot be directly accessed by code external to the class
What is polymorphism?
A method can perform different actions depending on the object it is called on
How is polymorphism implemented?
By overriding where an inherited method is redefined in a subclass and therefore this would override the inherited method when called
What is over-loading polymorphism?
Implementing a method multiple times to accept different parameters
What is overriding polymorphism?
Implementing an inherited method differently in a sub/child class
What is inheritance?
Where ALL ATTRIBUTES AND METHODS from a parent/super class can be used/called within a child/sub class
What is multiple inheritance?
When a class has two or more parent classes
What is a constructor?
Called when an object is created/instantiated
What is a constructor used for?
Initialising attributes
What is a constructor in Python?
__init__()