The CPU fetches instructions from memory, decodes them, and executes them. It has components like the ALU for arithmetic, registers for temporary storage, and a control unit for coordination. The program counter tracks the location of the next instruction to execute. Linkers incorporate subroutine addresses into programs. DLLs allow programs to access common code libraries to perform tasks like printing without loading the full code. Compilers translate to machine code for faster execution, while interpreters identify errors in real-time but run slower.
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
CPU Role Fetch Execute
1. The role of the CPU in the
operation of software
Mary Ramsay
2. Fetch and Execute Cycle
instruction and decoding of software solutions
3. Fetch-Execute Cycle:- describes the manner in which
the processor works. That is, it fetches the instruction
from primary storage, decodes the instruction, executes
the instruction and stores the result.
4. The CPU is made up of different parts including:
ALU – performs the arithmetic and logical operations
carried out by the processor.
Registers – (memories) which provides areas to store
results, locations of instructions. An Accumulator is one
register which stores the data currently being processed.
(like the display of a calculator)
Control unit – This coordinates all the actions of the
processor.
5.
6. Specific CPU components – Program
counter
Is a type of register that stores the location of the next instruction to be processed.
The program counter is just like a counter used in an array.
(used to located an array element)
The program counter is used to locate the next the instruction and then the counter is
increased (incremented) to point to the next instruction. See page 149 of text book.
7. Linking
When
a
program
requires
a
par0cular
sub
program,
its
address
is
incorporated
into
the
program
by
a
transla'on
system
called
a
linker.
Many
programs
are
complied
at
a
modular
level
(mainline)
and
sub
modules.
A
linker
is
used
to
join
these
compiled
modules
together.
A
linker
is
like
calling
a
module
that
needs
to
be
processed
by
the
CPU.
For
example
1. A
program
is
complied
and
translated
into
machine
code
(exe)
2. The
machine
code
is
loaded
into
main
memory
to
be
executed.
3. The
mainline
is
executed
first
–
with
the
use
of
a
linker
only
the
modules
required
are
loaded
into
RAM.
(This
reduces
the
amount
of
instruc0ons
loaded
into
RAM
at
one
0me)
4. The
linker
also
used
for
library
rou0nes.
If
the
program
calls
a
library
rou0ne
it
is
only
called
and
loaded
into
main
memory
when
required.
Again
this
saves
memory
resources.
8. DLL’s (Dynamic Linking Libraries
Is
a
collec0on
of
programs
in
machine
code
which
can
be
accessed
by
other
programs
to
perform
a
specific
task.
E.g
prin0ng
–
when
a
user
chooses
to
print
the
CPU
will
look
in
the
DLL
file
to
get
the
saved
machine
code
(instruc0ons)
to
print
rather
than
searching
the
translated
code.
The
DLL
file
is
loaded
into
RAM
instead.
As
a
result
processing
and
RAM
resources
are
minimsed.
10. Advantages of a compiler
} Compiled
programs
will
run
faster
than
those
that
have
been
interpreted
as
they
are
already
in
a
form
that
the
processor
understands.
} Compiled
programs
hide
the
code
from
view
so
that
it
is
more
difficult
to
determine
the
algorithms
used.
} A
compiled
program
is
oTen
a
lot
smaller
that
the
high-‐level
code
that
generated
it.
} A
compiled
program
cannot
be
easily
modified
by
an
inexperienced
user.
11. Disadvantages of a compiler
} Run-‐0me
errors
are
not
apparent
un0l
the
program
has
been
completely
compiled.
} When
a
compiled
program
is
modified,
the
whole
of
the
program
has
to
be
re-‐compiled,
regardless
of
the
nature
of
the
modifica0on.
Even
if
a
minor
modifica0on
is
made,
the
whole
program
has
to
be
re-‐compiled.
This
can
make
the
tes0ng
process
tedious.
12. Advantages of an interpreter
} • During testing, both run-time and translation errors
become apparent as the code is
} being executed. These errors may then be corrected as
they are found. This allows the
} programmer to more quickly debug a program, as the
code does not need to be
} completely translated after the changes have been made.
} • The process of interpretation also allows the
programmer to quickly add and remove
} debugging aids such as flags and debugging output
statements.
13. } Disadvantages of an interpreter
} • Programs that are interpreted will run far more slowly
than those that have been
} compiled, as each line of code has to be translated before
it is executed.
} • The code of an interpreted program is easily accessible
to any user or other programmer.
} This means that the illegal use of modules is easier.
} • Programs that are interpreted will generally take up
more storage than a similar program
} that has been compiled.
14. Advantage
of
an
incremental
compiler
} Programs
will
run
faster
than
those
of
an
interpreter;
however,
the
incremental
compiler
retains
the
advantage
for
a
programmer
that
both
run-‐0me
and
syntax
errors
can
be
iden0fied
as
they
are
reached.
Disadvantages
of
an
incremental
compiler
} Programs
are
not
executed
as
quickly
as
for
a
compiled
program.
} Code
is
s0ll
accessible
to
users
and
others.