Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 54

Software categories

• Software is categorised into system software


and application software
• System software is further categorised
into operating systems and utility software

Software

System Application
software software

Operating Utility
systems software
System software
• System software provides the
services that the computer requires
• This software enables the computer or
device to work, or helps to maintain the
good working order of the computer
• Operating systems
• An operating system is responsible for important functions
such as how a file is written to a hard drive or a program is
loaded into RAM
• Utility software
• Utility software helps in configuring and maintaining
the computer or device
Application software
• Application software
provides services that
the user requires
• Apps on smartphones
and tablets get their name
from application software
• Application software includes:
• Traditional computer software such
as word-processors and spreadsheets
• More modern apps such as social media
apps or video players
• Business software such as accountancy programs
System Software: Utility software
• The following are examples of utility software:
• Compression tools
• Backup software
• Disk clean-up
• Disk defragmentation
• Antivirus
System Software: Disk
defragmenter
• When files are saved to a magnetic hard disk they
are stored in the next available space
• This can lead to files being split into fragments which take
longer to access as the drive head has to move more
• Defragmentation software puts each file back into one
contiguous location
File A
File B
File C
File D
System Software: Disk clean-up
• Disk drives do not need actual cleaning as they
are sealed
• However disk clean-up tools help to improve free
space and system performance by:
• Deleting temporary files
• Clearing cached files for a web browser
• Removing unnecessary
program files
System software: Backup and
antivirus utility software
• Hard drives sometimes fail and may also be stolen
• Regular backups are made to external drives or
cloud backup services
• Antivirus software scans computers to
make sure that they don’t
contain viruses
System Software: Operating system
• An operating system is responsible for managing the
hardware and software in a computer including:
• Managing files
• Providing an interface
• Managing peripherals and drivers
• Managing memory
• Managing multitasking
• Providing a platform for running applications
• Providing system security
• Managing user accounts
OS provides User interface
• Without a user interface we would have
no way of communicating with a computer
• The user interface allows
the user to tell the
computer what to do.
OS Provide a platform for running applications
• When you open a program the operating system
loads the program into RAM
• The operating system provides a platform for each program
that is running on the computer
• The operating system deals with where the program and data
goes in memory (memory management), the saving of files
and how much time each program has to use the CPU
(task management)
• This is why software is released for a particular operating
system as well as a particular computer architecture
OS does Memory management
• To run a program, the Main memory (RAM)
computer must copy each File A
program from storage into Program D
main memory
Program A File C
• Data used by the program is also
copied into main memory
Program A
• The operating system keeps a Program B

record of where each program and


its data are located OS

• The operating system also makes


sure that programs do not Array Program E
overwrite existing programs
OS Helps Multi-tasking
• People use their computers to run several programs
at the same time
• Each program is given a short time on the CPU
before it is paused by the
operating system
• The operating system then allows
the next program to make use of
the CPU for a short time
• By switching quickly between
different programs (tasks), it appears
to the user that all of them are
happening at the same time
OS helps Managing peripherals
• Peripheral devices include keyboards, mice
and printers
• Digital cameras and webcams
• Graphics tablets
• Microphones
• Solid state media (USB sticks and SD cards)
• Bar code reader
• Optical drives (CD, Blu-ray and DVD drives)
OS Helps to install and update
Device drivers
• Each peripheral device requires a device driver
to operate
• The device driver allows the operating system (and therefore
programs) to access the device
• The device driver must be installed before the device may
be used
• Device drivers will be written in assembly language or a
language that can access low level instructions – this is
because they have to precisely control the hardware devices
Managing files
• Operating systems contain a file system
• This allows both users and programs
the ability to copy, save and rename files
• Files may also be placed in folder which
are also known as directories in
text-based systems
• Saving files is often a complicated process,
but for the programmer it is easy as they
just ask the operating system to do it
• Why is it hard for an operating system
to save a file?
OS does Disk and file
management

• The operating system


must manage the
following
• Which platter to save to
• Which track to send the
drive head to
• Which sector needs to be
accessed
• Make sure that files don’t
write over existing ones
OS helps Managing security
• The operating system is responsible for the security
of the computer system
• Authorised users are checked with a
username and password combination,
PIN, fingerprint or facial recognition
• Access to certain programs may
be restricted
• Individual files may be protected
• Other rights may be restricted,
such as the ability to
install software
OS allows Access rights
• Access rights:
• If a computer is used by more than
one person, users need to be
restricted as to which files they
may see
• A user may be given access to just
the files they have made, whilst a
system administrator may have
access to all files
• Some users may be allowed to
read files but not edit them
Firmware
• ROM on a computer stores programs that cannot be
changed as they are stored on Read Only Memory
Firmware
• Hardware is named after the fact it is physically hard
• The term is used for all physical components of a computer or
peripherals
• Software isn’t a physical object, so it is given the opposite
name (soft rather than hard)
• Firmware/ Bootlader (between hard and soft)
contains programs that are stored permanently in
hardware
• The BIOS stored on a computer
is stored on a flash ROM
• It can only be updated by flashing
the ROM
• Other peripherals may have their own firmware
Role of Bootloader , a firm ware
• When you first turn on a computer it starts running
firmware/boot loader stored in the ROM
• These instructions then load the
first instructions from the hard disk
telling the computer what tasks
to do
• The part of the hard disk that stores
these instructions is the boot sector
• Turning on a computer is
known as ‘booting’ after
“pulling yourself up by
your bootstraps”
Running applications
• Applications run on the computer’s Applications
operating system
• If they need to access hardware, they do
this via ‘calls’ to the operating system or
Operating system
device drivers
• The operating system itself runs on
top of the firmware Firmware
• The bootloader and other firmware runs
on the physical hardware itself

Hardware
Get attention/ Interrupt
When you need to get the
attention of someone who is busy
you need to interrupt them
• In the same way, peripheral devices /
software
also need to get the attention of the CPU
• An interrupt is a signal to the processor to
stop its current processing and service the
interrupt first and then go back to the
original task.
How Interrupt is serviced
Once the CPU has been interrupted, it needs to process the interrupt. The
current process will need to pause, but it will need to be restarted later.
• Processor runs the interrupts program code known as an Interrupt
Service Routine (ISR). This is also known as an interrupt handler.
• Saves the status of the current process to return later to this.
• The ISR needs to execute the interrupt as quickly as possible as it
has interrupted the CPU from the task it was working on
• For instance, if a key is pressed, the ISR may save the key that was
pressed. Later, a word-processor task can process it further

Interrupt service
Interrupt routine (ISR) Processor returns to
generated previous task
To identify that the processor's attention is
required // to stop the current process/task

− To allow the processor to multitask

Purpose of − To allow for efficient processing //


the Interrupt prioritizing actions

− To allow for efficient use of hardware

− To allow time-sensitive requests to be


dealt with
Hardware interrupts
• Hardware devices send interrupt signals to the CPU
• if a key on a keyboard is pressed, an interrupt will be sent
(actually an interrupt is sent when the key is pressed and
another is sent when it is released)
• When a mouse is moved, constant
interrupts are sent to the
computer so that it
is able to update
the location of
the pointer.
• If there is paper jam in the printer, interrupt is sent to the
processor.
Software interrupts
• Software interrupts are generated by programs that
are running
• If a program tries to divide by zero, a ‘division by zero’
interrupt will need to stop this infinite loop
• If two programs trying to access same memory location at the
same time.
• An application terminates
Programming languages
• High Level Language
• Low level language
Machine code and high level
code
Computers represent everything in binary, whether it is
text, numbers, sound, graphics or instructions
• Instructions written in a language such as Python, Delphi or
Java are known as high level code, they are high level
languages
• Program instructions, once converted to binary, are known as
machine code
High level language code
• Typical instructions in high level code read in a
similar way to English and Maths
• High-level code is easier to read and write than
machine code or low-level languages
• For example:
input(Mark1, Mark2, Mark3)
Total = Mark1 + Mark2 + Mark3
print("Total Mark =", Total)
Machine code instructions
• A typical machine code instruction looks like this:

0010110001101011
• This makes it very difficult for people
to understand as a full program
would appear as follows:
0010011001000111
1100100010010110
1100101101000010
1011001001011011
1110100010000011
1110111011101110
0010111111000011
1011001000110010
Machine code / instruction set
• Each different type of processor has its own set of
machine code instructions
• A typical machine code instruction in a simple
processor might occupy two bytes:
Opcode Register Operand
001000 10 0001 0000
• The opcode is the instruction/ Mnemonic to be
processed, e.g. ADD, SUB, LOAD, STORE
• The operand is either a value to be operated on or the
address of the value to be operated on
Machine code/ low level language
• Machine code is sometimes called a ‘first
generation language’
• In the early days of computers, the binary itself was entered
through a set of switches on the computer
• The ‘second generation’ of programming
languages was assembly code, which used
mnemonics to represent each opcode, and a denary
number or identifier for the operand
Opcode Register Operand Mnemonic Register Operand

001000 10 0001 0000 ADD ACC 16

Machine code Assembly language


Assembly language / Low level language
• An assembly language program looks something like
this:
MOV A [17] ;Move contents of memory address 17 into
Register A
MOV B [18] ;Move contents of memory address 18 to
Register B
ADD A B ;Add Register A and Register B and store in
Register A
MOV [19] A ;Store contents of Register A in location 19
• Compare this with a high-level language
statement:
Total = Mark1 + Mark2
Translators translate code to
machine code/ binary
• Compiler
• Assembler
• Interpreter
Compiler
• A compiler is a program which translates a high level
language program (the source code) into
machine code
• The compiler produces an executable file which means the
file can be executed (run)
• The machine code created by a compiler is also known as
object code ( if there are no errors in the program)
• If the compiler encounters a syntax error, it cannot
translate the statement so no object code
is produced
• It provides an error report for all errors that are detected in
the code
The assembler
• The computer cannot process assembly language
instructions directly as it only processes binary
machine code
• The assembler is a program which translates
assembly code into machine language
• This is a relatively simple process as in general, one assembly
code statement translates into one machine code instruction
MOV A [17] 0010011001000111
MOV B [18] 1100100010010110
ADD A B 1100101101000010
Assembler
MOV [19] A 1011001001011011

Assembly code Machine code


Compilation process
• The compiler translates the entire program at once
• It produces an executable file which can be run
• This is the file that is usually distributed to the customer
• The compiled file will be created for a specific computer
architecture and operating system
1110100010000011
if errorCode:
1110111011101110
print("Error")
NumErrors = NumErrors + 0010111111000011
1
Compiler 1011001000110010
0010101011100001

High-level language Executable file


Interpreter
• An interpreter is a type of program which translates
a high level language program into machine code
• It translates a line and then, if it has no syntax errors,
executes it
• It continues like this, translating and executing the code
line-by-line.
• Doesn’t produce executable machine code for the full
program
• If a syntax error is encountered, it displays an error
message and stops executing the program
Compiler or interpreter? Why
used them
Interpreter Compiler

Slower execution as every line is translated Fast execution as the whole program is
before it is executed already ready to execute
A user has to have the interpreter on their The program runs on the computer without
computer in order to run the program the need for an interpreter or compiler as if it
is already compiled to an executable file
Interpreter does not produce an object After the machine code is produced and
/machine code for the whole program original source code is not available then
changes can’t be made to the program if
required.
For any future changes, original code is to
be changed and compiled again
Why use assembly language
• Device drivers need to control specific parts of hardware so
are usually written in assembly
• Other common uses for assembly are the bootstrap stored in
ROM, control programs in embedded systems such as a
dishwasher, washing machine or car
• As the programmer has complete control of the hardware
when they use assembly, they are able to make key parts of
programs more efficient in processing speed and the use
of memory
• Assembly code allows the direct manipulation
of hardware
Comparison of Assembler,
Compiler
Assembler Compiler Interpreter
Advantages Direct manipulation Easier for Easier for
of hardware such as programmers to programmers to
needed in device understand as it’s a understand as it’s a
drivers; high-level language; high-level language;
Used to make Code only needs to
efficient code be compiled once;
The user doesn’t
need a compiler
Disadvantages Difficult for people to Slow translation to Slower than compiled
understand, learn, machine code. If code as the
read and write program source code translation occurs
needs to be changed line by line every
then program should time the program is
be complied again run
High- and Low-Level Programming
languages
High Level Language- Python, Java, Low Level Language- Assembly , Binary
C#, PHP ( machine code)
• Machine dependent instructions , this makes
• Easy to learn , read and understand by the it not portable , can be run on a specific
programmers because it is closer the human machine
language ( similar key words, math operators).
• Code takes less time and space in memory to
• Can be written and constructed in shorter time due
to structures in the language ( loops, selections) execute. Perform tasks quickly.
• Instructions are not specific to any hardware that • It can be used to directly access and
makes it portable. manipulate the hardware in the computer,
• Less chances of errors, due to similar language that is why they are used to construct device
keywords and operators ( if, for, + , -) driver, system program ( OS)
• Debugging and troubleshooting is easy because of
similar keywords , structure and operators the we
use in English and Math.
• Easy to maintain and extend ( libraries )
IDEs Syntax highlighting
• The following screenshot
shows some of the
features of an IDE

Line numbers

Breakpoints

Code folding

Variable watching
Code editors
• The editor provided in an IDE contains additional
facilities to a basic text editor, such as:
• Line numbers
• Syntax highlighting
• Prettyprint
• Auto-completion
• Auto-correction
Line numbers
• Line numbers allow a programmer to clearly see
each new line of code
• When errors are found, the line number that they occur on will
also be stated
• In some IDEs, parts of the program that the programmer
doesn’t need to see can be folded

Notice the line numbers change


where the code has been folded
Syntax highlighting
Booleans (false, true), Keywords (while, not, if, else)
Type conversions (str, int)
Strings – e.g. "Are you higher or lower in age? "
All other operators, variables and functions names
Prettyprint
• Prettyprint applies indentation and formatting to code
• This makes it easier for other programmers to read
• It also makes code consistent across different programmers

Original code Code after Prettyprint


Class Main{public static void Class Main
main(String[] args) {
{system.out.println("Sum of 5 and Prettyprint public static void main(String[] args)
10"); int firstNum = 5; int {
secondNum = 10; int sum = first + system.out.println("Sum of 5 and 10");
second; system.out.println("Sum: int firstNum = 5;
" + sum);}} int secondNum = 10;
int sum = first + second;
system.out.println("Sum: " + sum);
}
}
Error diagnostics
• Error diagnostics help a programmer to find where
they have made a mistake
• Errors are identified along with the line number that they
occur on
• The code may be
underlined or highlighted
to show the error
Debugging code
• Breakpoints are set by the programmer so that the
IDE stops the program mid-way through running
• The programmer can the step through code line by line
• They can watch
variables as
they change
• The breakpoint was
set to line 18
• What do the
variables contain
at this point?
Variables watching
• ageGuessed = false
• oldestAge = 120
• youngestAge = 0
• currentGuess = 60
• correct = null (it hasn’t yet been assigned a value)
• args = {string[0]}
These are arguments
sent to the program
when it is called
Run-time environment
• The run-time environment allows a programmer to
test their program while it is running
• If the program crashes the run-time environment can see
what happened and give useful information to
the programmer
Translators
• IDEs will contain the necessary translators to run
and test the code
• The IDE may compile the code or
interpret it by running it line by line
– this is very helpful when
debugging the code
Auto-completion and correction
• Auto-completion gives the programmer suggestions
for variable names and keywords as they type
• This may improve the speed that a programmer writes code
• Tabs, brackets and braces may also be added automatically
to the code to save the programmer time
• Some IDEs have auto-correction which fixes
mistakes such as those
made in keywords
• Some programmers may not
like these tools as they could
introduce a mistake to their
code without them realising

You might also like