Software and software development Flashcards
What is meant by the term ‘operating system’?
A collection of programs that work together to provide an interface between the computer and the user
Give examples of mobile phone operating systems
Android
iOS
Give examples of desktop operating systems
Windows
MacOS
Name the features that an operating system can provide for a computer system
- File management (moving, editing, deleting files and folders, sorting files into directories)
- Memory management (paging, segmentation, virtual memory)
- Resource management (schedulling)
- User Interface
- Security (firewalls
- Interrupt management
- Utility software (disk defragmentation, antivirus, backup…)
- Input/Output management (using device drivers)
What is meant by paging?
MEMORY MANAGEMENT OS
Memory is split into equally sized sections known as pages
-Programs are made up of a certain number of pages
-These pages can be swapped between main memory and the hard disk as they are needed
Explain memory management by the OS
Computer memory has to be shared fairly between the multiple programs and applications being used
-Often MM is not large enough
-So one of the roles of the OS is to make sure that main memory is shared efficiently through paging, segmentation and virtual memory
What is meant by segmentation?
MEMORY MANAGEMENT OS
Splitting up of memory into variable sized divisions known as segments (which vary in size)
-Segments are representative of structure and logical flow of program as each is allocated to blocks of code (eg. conditional statements or loops)
Segmentation is the process of splitting up memory into equally sized divisions called segments?
TRUE OR FALSE
FALSE
They dont necessarily have to be equal they are ‘logically sized’, which means that they are split depending on the logical structure of the program as each segment is allocated to a section of code
What is meant by virtual memory?
Refers to a memory management technique used by OSs to extend the apparent amount of available memory by using both the computer’s RAM (main memory) and a portion of secondary storage (such as a hard disk or SSD).
VM uses a section of the hard drive to act as RAM when there isnt enough space in MM.
So:
Sections of programs not being used currently are temporarily moved to VM through paging which frees up memory in RAM
Give a disadvantage of paging
Disk thrashing
When the disk freezes as a result of pages being swapped too frequently between main memory and the hard disk
-So more time is spent swapping rather than actually running the program
-This gets worst as virtual memory is filled up as:
In general the system has to swap pages in and out more frequently
VM must continually decide which pages to swap out to make space for others, this adds to overhead
Disk operations are slower than RAM operation
What is meant by RAM?
RANDOM ACCESS MEMORY
Type of computer memory that is used to temporarily store data that is being actively used or processed by the computer
-Volatile memory = it loses its contents when power is turned off
MAIN MEMORY
Split into 2 parts:
RAM= Random Access Memory
ROM = Read only Memory
What is meant by volatile memory?
Requires power in order to retain its contents
What is meant by the term ‘Random Access’ in RAM?
Data in RAM can be accessed in any order without the need to go through other data sequentially.
MEANS THAT it doesn’t need to start from the beginning and go through all previous data to reach a particular piece of data
-Allows for quick and efficient information retrieval
What is meant by the term interrupts?
Signals generated by software or hardware indicating to the processor that a process needs attention
What is taken into account before servicing interrupts?
Their priority / how urgent they are
Interrupts are ordered in a priority queue in a special register known as an interrupt register
Explain the role of the OS in Interrupts
The job of the OS is to ensure that interrupts are serviced fairly (taking into account their priority) by the processor through the Interrupt service routine (ISR)
Explain the Interrupt service routine
1.Processor checks contents of interrupt register at the end of each FDE cycle
- If interrupt exists of higher priority than the process being executed, current contents of the Special purpose registers in the CPU are temporarily transfered into a stack
3.Processor responds to interrupt by loading appropriate Interrupt Service Routine (ISR) into RAM
- A flag is set to signal the ISR has begun
- One ISR is serviced flag is reset, interrupt queue is checked again for interrupts of higher priority than one being executed.
- No more/ lower priority interrupts then contents of stack are placed back into Special PRs and the FDE cycle is resumed
What is disk thrashing?
The excessive swapping of pages between RAM (main memory) and hard disk (secondary storage)
Schedulling algorithms can be:….
Preempt = interrupt
Pre-emptive: If a new job arrives with a shorter remaining time than the currently running job, the CPU will preempt (interrupt) the current process and switch to the new, shorter task.
Non pre-emptive: Once a job starts executing, it cannot be interrupted by other processes. The CPU remains committed to that process until it completes.
What is meant by schedulling?
One of the roles of the OS is to ensure that all sections of program being run (jobs) receive a fair amount of processing time
-This is done by implementing schedulling algorithms (which can be preemtive or non preemptive)
Give examples of pre-emptive schedulling algorithms
-Round Robin
-Shortest Remaining Time
-Multilevel Feedback Queues
Give examples of non pre-emptive schedulling algorithms
-First come first served
-Shortest Job first
Give disadvantages of Round Robin
-Doesnt take into account job priority
-Longer jobs will take much longer to complete as their execution is inefficiently split into multiple cycles
Give an advantage of Round Robin
-Each job is seen to/ carried out
Explain the Round Robin schedulling algorithm
ITS PRE-EMPTIVE
-Jobs are stored in a queue with the first jobs in being the first out
- The first job in the queue gets its time slice. (Each job in queue is given a section of processor time (TIME SLICE) which it is allowed to execute within)
- Once the time slice expires (whether the job is finished or not), the job is paused and moved to the end of the queue.
- The next job in the queue gets its time slice.
- The process repeats for all jobs in the queue.
- If we get a job that has been finished its removed from the queue
Explain the First Come first serve schedulling algorithm
NON PRE-EMPTIVE
-Jobs are carried out in chonological order by which they entered the queue
(so essentially first come first serve…)
Give a disadvantage of the First Come first serve schedulling algorithm
Doesnt allocate processor time based on the priority of each job (as the jobs are carried out in chronological order)
Explain the multilevel feedback queues schedulling algorithm
PRE-EMPTIVE
Makes use of multiple queues, with each queue being assigned different priority levels
-Jobs are executed by the CPU starting from the highest-priority queue to the lowest priority queue, with each job in each queue using a time slice.
-If a job in a high-priority queue doesn’t finish within its time slice, it may be moved to a lower-priority queue and then given a larger time slice for its next turn.
Give an advantage of multilevel feedback queues schedulling algorithms
Takes into account the priorities of the jobs to be completed
Give an disadvantage of multilevel feedback queues schedulling algorithms
Difficult to implement due to the deciding of which job to prioritise based on the combination of priorities
What is meant by processor starvation?
When a process is delayed or unable to access the CPU, preventing it from executing.
*This situation arises when higher-priority tasks continually take precedence over lower-priority ones, resulting in certain tasks being “starved” of processing time.
-Disadvantage which can occur in Shortest Job first schedulling algorithms
Explain the Shortest Job First Schedulling algorithm
NON PRE-EMPTIVE
-Queue storing the jobs which need to be processed is ordered according the time they will take to be completed
-(Longest jobs at the end and shorter jobs are given preference)
Give disadvantages of using the Shortest Job First Schedulling algorithm
-Processor starvation (lower priority jobs dont end up getting done as higher priority/ shorter jobs keep getting added to queue)
-Requires processor to know how long each job takes which is not always possible
Explain the Shortest Remaining time schedulling algorithm
ITS PRE-EMPTIVE
The queue storing jobs to be processed is ordered based on the time each of them have remaining to be completed
(Jobs with less time remaining are prioritised and therefore at the start of queue)
If a new process arrives with a shorter remaining time than the currently running process, the CPU will preempt (interrupt) the current process and switch to the new, shorter task.
Shortest job first is a type of schedulling algorithm most suited for…
batch systems ( a type of OS where jobs or tasks are executed in groups or batches without interactive user input during execution)
Explain the difference between Shortest Job first and Shortest remaining time algorithms
Shortest Job First
Non preepmtive: Once a process starts executing, it cannot be interrupted by other processes. The CPU remains committed to that process until it completes.
It has a priority queue which prioritices the shortest jobs over the longer ones meaning that the shortest jobs will be completed first
Shortest Remaining Time
Preemptive: If a new process arrives with a shorter remaining time than the currently running process, the CPU will preempt (interrupt) the current process and switch to the new, shorter task.
The queue storing jobs to be processed is ordered based on the time each of them have remaining to be completed.
Give a disadvantage of Shortest remaining time schedulling algorithm
Risk of processor starvation for longer jobs if shorter jobs keep being added to the job queue
What are the different types of Operating Systems?
-Distributed
-Embedded
-Multi-Tasking
-Multi-User
-Real Time
There are various types of Operating Systems. Distributed is one of them.
What is meant by a distributed Operating System?
Its run accross multiple devices
Allows the load to spread accross multiple computer processors when running a task
There are various types of Operating Systems. Embedded is one of them.
What is meant by a embedded Operating System?
Designed to perform a small range of specific tasks
-Its catered towards a specific device
-Has limited functionality and they are hard to update
There are various types of Operating Systems. Multi-tasking is one of them.
What is meant by a Multi-tasking Operating System?
Allows user to carry out tasks seemingly simultaneously by using time slicing ( so it uses a pre-emptive schedulling method)
-To switch quickly between programs and applications in memory (so it creates the illusion that they are all ruining at once)
Each application or process is given a time slice to use the CPU for a brief period before the OS switches to another task.
There are various types of Operating Systems. Multi-User is one of them.
What is meant by a Multi-User Operating System?
Multiple users make use of one computer, typically a supercomputer.
A schedulling algorithm needs to be used so that processor time is shared fairly between jobs
There are various types of Operating Systems. Real Time is one of them.
What is meant by a Real Time Operating System?
Used in time critical computer systems
-As its designed to perform a task within a guranteed time frame
Which type of operating system consumes the least amount of power out of all the types?
Embedded
When would a Real Time OS be suitable?
For systems which manage situations where a response within a certain time period this can be crucial to safety (eg self driving cars)
*As they perform a task within a guaranteed time frame
What the BIOS? Explain it
BASIC INPUT OUTPUT SYSTEM
-This is the first program which is run when a computer system is switched on
-Program counter register points to the location of the BIOS when the computer is started up as the BIOS is responsable for doing checks before the OS is loaded into memory (RAM) from the hard disk
*IT IS ONLY AFTER THESE CHECKS THAT THE OS CAN BE LOADED INTO RAM FROM THE HARD DISK)
CHECKS:
-Poweron self test (POST) = ensures all hardware (disk drives, keyboard) are connected correctly and functional
Checks CPU clock, memory and processor
Checking for any external memory devices connected to the computer
What is meant by the term ‘bootstrap’?
The name of the program which loads the operating system from the hard disk into main memory (RAM)
The name of the program which loads the operating system from the hard disk into main memory (RAM) is?
Bootstrap
What are device drivers?
Computer programs which allow the OS to interact with hardware
E.g When a piece of hardware such as a keyboard is used, the device driver communicates this request to the OS
-The OS then produces a relevant output such as displaying a character on the screen
Device drivers interact with the OS. What is the kind of relationship between device drivers and the OS it interacts with?
Device drivers are specific to the operating system installed on the hardware device
Device driver’s are specific to a computer’s architecture
TRUE OR FALSE?
TRUE
Diff device drivers must be used for different device types (e.g smartphones, game consoles, desktop PCs)
What is a virtual machine?
A theoretical computer as it is a software implementation of a computer system
It also provides an environment with a translator for intermediate code to run
Using the example of the user typing in a character into their keyboard. How would the use of device drivers be relevant in dispkaying this on the screen?
A device driver is a program provided by the OS which allows the OS to communicate with hardware
When a piece of hardware such as a keyboard is used, the device driver communicates this request to the OS
-The OS then produces a relevant output such as displaying a character on the screen
What is meant by intermediate code?
Code that is halfway between machine code and object code
Its independent of processor architecture so it can be used across all different machines and operating systems
Give me an advantage of intermediate code
Its independent of processor architecture so it can be used across all different machines and operating systems.
This is because instead of being tied to a specific CPU design (harvard, vonN..), intermediate code targets a virtual machine
Give uses of Virtual machines
-Protection from malware
(as malware will affect the Virtual machine rather than the device being used as VMs operate in isolated environments)
-Running incompatible software
(Programs specific to diff OSs or diff versions to the host OS can be run within a VM instead as VMs are independent of computer architecture)
-Provides a development environment for programmers to test programs on diff OSs (as it saves money having to purchase different devices for testing)
Can you explain why Virtual machines can provide a device protection from malware?
Virtual machines operate in ISOLATED environments. Each VM runs its own operating system and applications independently from the host machine/device and other VMs.
This isolation helps contain malware, preventing them from spreading to the host system or affecting other VMs.
How does a virtual machine help when running incompatible software?
Programs specific to diff OSs or diff versions compared to the host OS can be run within a VM which saves money in having to purchase the required hardware
(e.g games console being implemented on a PC via a virtual machine)
Software can be categorised as…
-Application software
-Systems software
What is meant by application software?
Software designed to be used by the end user to perform one specific task
It requires systems software to run
Give examples of application softwares
-Word processing
-Spreadsheets
-Web browsers
-Desktop publishing
What is systems software?
Software designed to manage and control the hardware components of a computer, as well as provide a platform for running application software.
(So it serves as a bridge between the hardware and user applications)
Give examples of Systems software
-Operating systems
-Library programs
-Utility programs
-Device drivers
-Translator
What is meant by ‘utilities’?
A type of system software which is responsable for the consistent, high performance of the operating system
-Linked to the maintenance of the OS
Disk defragmentation is a type of utility software
Explain it
Disk defragmenter utility rearranges contents of hard disk so that files can be stored in contiguous spaces so they can be accessed faster
-As hard disk becomes full, R/W slow down
This is because files become fragmented as they are stored in diff parts of memory’
(fragmented = scattered)
Give examples of utilities
-Compression
-Disk defragmentation
-Antivirus
-Backup
-Automatic updating
Why does fragmentation occur?
When files are divided into multiple parts (fragments) and stored in different areas of the disk.
Occurs over time as files are created, deleted, and modified.
As files are deleted, small gaps are left on the disk. When new files are saved, they may be broken up and placed into these gaps if there isn’t enough contiguous space available, leading to fragmentation.
Antivirus is a type of utility software
Explain it
Responsible for detecting potential threats to the computer
Automatic updating is a type of utility software
Explain it
Ensures system is up to date ==> tackles security flaws, less vunreable to malware
Updates are automatically installed when the computer is restarted
Backup is a type of utility software
Explain it
Automatically creates routine copies (regularly scheduled backups) of specific files selected by user.
User also specifies how often these are backedup
Good for power failure, malicious attack so files can be recovered
What is meant by a ‘translator’?
A program classed as system software which converts high level source code into MC low level object code which is then ready to be executed by a computer
3 types: assembler, compiler, interpreter
What is the main role of a compiler?
Translates high level code into machine code
How does a compiler work?
Translates entire HL code into MC all at once and produces an executable file
-First checks for errors and reports back if found any
-Then translates whole code at once
-Produces machine code which can only be executed on certain devices
*Compiled code is specfic to a particular processor type and OS(meaning that its platform specific, so they are dependent on the instruction set of the processor(processor) and ensure compatibility with OS)
-Code can be run without need for source code or translator to be present because of the executable file
*If you need to make changes, after that the whole code needs to be recompiled
Assembly code is platform specific
What does this mean?
Instructions used are dependent on the instruction set of the processor as each processor may have a diff instruction set and must be compatible with the OS
Give info on assemblers
-They translate assembly code into machine code
-Each line of assembly code is equivalent to almost one line of machine code (one to one relationship)
-Platform specific as they convert assembly code into machine code, assembly code is tailored to a specific processor as diff processors have diff instruction sets and must be compatible with the target OS
Which translator has the longest initial compilation process and why?
Compilers as they carry out multiple checks to see if there are any errors
Interpreters
Translate HL code into MC line by line
-They stop and alerts there is an error if it detects one ==> Good for debugging as it stops when it gets to an error
-Slower than running compiled code as code must be translated each time its run/executed
-Both interpreter and source code must be present when code is run on different devices, however code can be executed on a range of diff platforms as long as right interpreter is available
Generally which runs faster a compiler or interpreter?
A compiler is generally faster
-A compiler translates the entire source code into machine code (or an intermediate language like bytecode) before the program is run.
This produces an executable file, which can then be executed directly by the hardware without needing the source code or the compiler.
-An interpreter translates the source code line by line while the program is running, and executes each line immediately after translating it.
This means that each line has to be translated every time the program is run, which slows down execution.
Interpreted code is generally more portable
TRUE OR FALSE?
Compiled code: Translates the entire source code into machine code and produces an executable file.
This executable file can run without the compiler or source code because the machine code is directly understood by the CPU.
If the compiler used is not compatible with a given platform, the executable cannot run there unless the code is recompiled for that specific platform.
However:
Interpreted code: Does not produce a standalone executable file.
Instead, it translates and executes the source code line-by-line or in blocks every time the code runs.
As long as the interpreter is compatible to the device/platform you’re using, the same code can run without needing any changes. The interpreter takes care of making the code work on different systems.
When a compiler is used, high level code goes through…. before…
STAGES OF COMPILATION
When a compiler is used, high level code goes through 4 STAGES before IT IS TURNED INTO OBJECT CODE READY TO BE EXECUTED
Stages:
Lexical Analysis
Syntax Analysis
Code Generation
Optimisation
STAGES OF COMPILATION
Lexical Analysis
- Lexical Analysis:
-Whitespace and comments are removed
-Remaining code is analysised for keywords and names of constants and variables
-which are replaced with tokens. Info about each token associated with each keyword or identifier is stored in a symbol table
STAGES OF COMPILATION
Syntax Analysis
- Syntax Analysis
-Tokens are analysed against rules of programming language, if they break these they are flagged up as syntax errors (incomplete brackets, undeclared variable type)
-An abstract syntax tree is produced
-Further details about identifiers is added to symbols table
-Semantic analysis is carried out (logic mistakes are detected)
Representation of source code in the form of a tree
What is this called?
Abstract syntax tree
What is meant by an ‘abstract syntax tree’?
A representation of source code in the form of a tree
What is meant by semantic analysis?
Analysing the code for logic errors such as undeclared identifiers, multiple declaration
Give examples of syntax errors
-Undeclared variable type
-Incomplete set of brackets
Give examples of semantic errors
-Undeclared identifier
-Multiple declaration
STAGES OF COMPILATION
Code generation
- Code Generation
The abstract syntaxt tree produced in the syntax analysis stage is used to produce machine code
STAGES OF COMPILATION
Optimisation
-Looks for sections of code that can be made more efficient
-Aim is to minimise the time taken for the code to execute by:
Redundant parts of code are removed and replaced by with more efficient ones or grouped together which produces the same result
STAGES OF COMPILATION
Optimisation
Give disadvantages of this
X Excessive optimisation may change the way the code behaves
X Adds to the overall time taken for compilation
What is meant by a linker?
Piece of software responsible for linking external modules and libraries included within the code
There are 2 types: Static and Dynamic
What is meant by a static linker?
A linker is a piece of software which links external modules and libraries included within the code
Static:
Modules and libraries are added directly to the program file (this increases size of file as the L and M are part of file).
Any updates made to libraries or modules externally will not affect the program meaning that you can use a specific version of a library
What is meant by a dynamic linker?
A linker is a piece of software which links external modules and libraries included within the code
Dynamic:
Addresses of libraries and modules are included in the program file where they are referenced at points where they are needed at runtime
-When program is run, the loader retrieves these using the specified addresses so program can be executed.
Give advantages of dynamic linkers
-External updates affect the main file so you dont need to rewrite the code (compared to static where any updates to the libraries or modules won’t affect the code)
-File size remains small as addresses to libraries and modules are included in the file rather than the modules and libraries themselves. (so M and L can be retrived when code is run by a loader at the specific addresses when program is run)
What is meant by a loader?
Programs provided by the OS
In static linking: At runtime, the loader loads the complete executable (including the code and library/modules) into memory.
In dynamic linking: Loader loads the program into memory.
Then retrieves and loads the library or module from the specified memory location
What is a library?
Pre compiled, pretested programs which can be incorporated within other programs using either static or dynamic linking