0% found this document useful (0 votes)
136 views

Hardware and Virtual Machines

Uploaded by

Mal Eficent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views

Hardware and Virtual Machines

Uploaded by

Mal Eficent
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

AS & A LEVEL COMPUTER SCIENCE 9618

HARDWARE AND VIRTUAL MACHINE

1 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

HARDWARE AND VIRTUAL MACHINE


Every computer uses a Von Neumann Architecture. But due to advancement in
computer technology, it led to more complex processor design.

CISC ( COMPLEX INSTRUCTION SET COMPUTER)


1. It is designed to carry out a given task with as few lines of assembly code as
possible.
2. CISC processor is based on single instruction set but complex with need to be
converted by the processor into a number of sub instruction to carry out the
required operation.
Example 1 2 3
ADD X, Y 1
2 X
3 Y

Memory

2 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

DIFFERENCE BETWEEN FIXED LENGTH INSTRUCTION AND


VARIABLE LENGTH INSTRUCTION

Instruction 1 Fixed length instruction

Fix the amount of memory it will consume for example 16 bits, 4 bits

Instruction 2 Variable length instruction

It can take as much space as it wants


PROGRAMMING CONTROL UNIT
HARDWARE CONTROL UNIT
Uses programs, code will
1. Uses logic circuits
compile, run and generate
2. Flip flop
output

3 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

FEATURES OF CISC
1. CISC has more instructions
2. CISC has fewer registers: because most of the processing is done in memory
3. CISC instructions are more complex
4. CISC has many instruction format: One thing can be done in another format as
well
5. CISC uses multicycle instruction: One instruction breaks down in more
instruction
6. CISC uses variable length instruction
7. CISC has poor pipelinebility
8. CISC require more complex circuit : To deal with complex instruction
9. CISC has more addressing modes for example immediate, direct, indirect and
index
10. CISC makes less use of RAM
11. CISC has programmable control unit

Note: CISC emphasizes on HARDWARE

4 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

RISC ( REDUCED INSTRUCTION SET COMPUTER)


Less instruction hence better performance from the processor
Does not need to break complex instruction
Assembly code is broken into a number of single cycle instruction

Load A, X : Load value of X into register A 1 2 3


Load B, Y 1
ADD A, B
Store Z 2 X
3 Y
A B Z
X Y X+ Y

5 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

FEATURES OF RISC
RISC has fewer instructions
RISC has many registers
RISC instructions are simpler
RISC has few instruction format
RISC usually uses single cycle instructions
RISC uses fixed length instructions
RISC has better pipelineability
RISC requires less complex circuit
RISC has fewer addressing modes
RISC makes more use of RAM
RISC has hardwired control unit

Note: Emphasizes on software

6 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
It is a way of improving computer performance
Example
Lets assume that we are doing Laundry
1. One washer (takes 30 mins)
2. One drier (takes 40 mins )
3. One folder ( takes 20 mins )

It takes 90 minutes to wash, dry and fold 1 load of laundry


How long does 4 loads take ?
360 minutes

7 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
THE SLOW WAY

If each load is done sequentially it takes 6 hours

8 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
LAUNDRY PIPELINING

9 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
What is meant by pipelining ?
Pipelining is instruction level parallelism ( multiple operations are performed in
single cycle )
Execution of an instruction is split into number of stages
When first stage for an instruction is completed the first stage of the next
instruction can start executing
Another instruction can start executing before the previous one is finished
Processing of a number instructions can be done simultaneously
5 STAGES PROCESSOR
1. Fetch instruction
2. Decode instruction
3. Execute instruction
4. Access operand in memory
5. Write results to register
OPCODE: What do we need to do ( Decoded instruction)
OPERAND: What do we need to do it to (Data)

10 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
Qtn: Given 4 instructions ABCD Demonstrate how the are handled with pipeline
and without pipeline with in a processor.

Means the instruction will take 5 cycles each


So if therefore are 4 instructions 5 X 4 = 20 cycles

11 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

PIPELINING
WITH PIPELINING.

By the help of pipeline only 8 cycles were used


Number of cycles saved
20 -8 = 12 cycles

12 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

INTERRUPT
1. In pipelining there is one added complexity: As the interrupt is received, there
could be a number of instructions still in the pipeline.
2. The usual way to deal with this is to discard all instructions in the pipeline
except for the last instruction in the write back stage.
3. Then interrupt handler routine can then be applied to the remaining
instruction and they are serviced. The processor can restart with the next
instruction.
ALTERNATE METHOD
1. The content of five stages can be stored in register
2. Then the processor can be restored to its previous state once the interrupt has
been secured

13 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

FOUR BASIC COMPUTER ARCHITECTURE


FLYNN’S CLASSIFICATION: Based on number of instructions and data

PROCESSOR

Instruction
Data
Instruction Stream : Sequence of instructions executed by the processing unit
Data stream: Sequence of data or temporary result called by instruction stream
TERMINOLOGIES

1. SISD: Single Instruction Single Data


2. SIMD: Single Instruction Multiple Data
3. MISD : Multiple Instruction Single Data
4. MIMD : Multiple Instruction Multiple Data

14 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

SINGLE INSTRUCTION SINGLE DATA

DATA
PROCESSOR INSTRUCTION
SOURCE

There is only one processor


The processor executes one set of instruction on one set of data
Note: Each task is processed in a sequential order does not allow parallel
processing

15 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

SINGLE INSTRUCTION MULTIPLE DATA


Uses many processor
Each processor has several ALU
Each ALU executes the same set of instruction on different set of data at the same
line

Processor

Processor
Data Data
Source Processor Source
Processor

16 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MULTIPLE INSTRUCTION SINGLE DATA


Processor
Data
Processor Instruction
Source

Processor
There are several processors
Each processor executes different sets of instruction on one
Set of data at the same time

17 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MULTIPLE INSTRUCTION MULTIPLE DATA


Processor
Data
Processor Instruction
Source

Processor
There are several processors
Each processor executes a different sets of instruction.
Each processor operates on different set of data

18 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MASSIVELY PARALLEL COMPUTERS


Massive: Large number of processors
Parallel : To perform a set of coordinated computations simultaneously

Massively Parallel Computers About


Large number of processors
Working collaboratively on the same program
Working together on the same program
Communicating via message interface

19 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MASSIVELY PARALLEL COMPUTERS

20 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MASSIVELY PARALLEL COMPUTERS


ISSUES IN MASSIVELY PARALLEL COMPUTERS
Hardware
1. Processors need to be able to communicate so that data can be
transferred from one processor to another.
2. This makes it a very challenging topology
Software
 Appropriate programming language should be used Which allows data to
be processed by multiple processor simultaneously
Hardware issues in massively parallel computers
 Communication between the processors is the main issue as each
processor needs a link to every other processor. This makes it a
challenging topology
Characteristics of Massively Parallel Computers
1. Large number of processor
2. Collaborative and simultaneous processing
3. Network Infrastructure
4. Communicate by sending messages

21 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MASSIVELY PARALLEL COMPUTERS


Conditions For Massively Parallel Computers
No single processor
Should have separate buses

22 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

MASSIVELY PARALLEL COMPUTERS


Qtn: What changes would be required to the program code in order to transfer it
into massively parallel computer

1. Split into blocks of code so that it can be processed simultaneously instead of


sequentially
2. Each block is processed by a different processor which allows each of the
processor to simultaneously process the different blocks of code
independently
3. Requires both parallelism on coordination

23 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

CONCEPT OF VIRTUAL MACHINE


Virtual machine is a type of software that allows to run an operating system
within another operating system
DIFFERENCE BETWEEN GUEST OS AND HOST OS

Host operating system: The operating system that is actually controlling the
physical hardware or the operating system is running virtual machine software.

Guest operating system: An operating system running in a virtual machine and


controls the hardware

Note:
 Guest OS is running under the host OS software
 A virtual machine is a software that emulates a different computer system
 A virtual machine allows multiple Guest operating systems to run on one
computer using a host operating system

24 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

APP TESTING
ROLE OD VIRTUAL MACHINE SOFTWARE IN TESTING OF AN APP
By virtual machine software you can create and manage virtual machine
Translate instructions used by guest operating system to that required by the host
OS
Emulates hardware
Protect each virtual machine so instances of the App can be tested together

BENEFITS OF TESTING USING VIRTUAL MACHINE


 Multiple OS can exist simultaneously allowing for testing using same hardware
 Only one set of hardware is required
 Reduces cost of producing the app as there will be no need to set up more
than one computer
DRAWBACKS
Execution of extra code therefore performance is degraded and more time taken
to create the app and can not make judgment about response time

25 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

VIRTUAL MACHINE

26 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

VIRTUAL MACHINE
Qtn: Describe the role of the four operating system in the diagram above
1. OS1, OS2, OS3 are guest operating systems secondary to the one installed on
the hardware
2. OS4 is the host operating system which interacts directly with the computer
hardware
3. The virtual machine app need to run all the three guest operating system with
identical results

Note: To identify host OS, look for the OS which is in direct contact with hardware

27 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

SOFTWARE PRODUCTION
Qtn: State the benefit of using VM to produce software
1. Software can be tried on different OS using same hardware
2. No need to purchase different types of hardware
3. Easier to recover if software causes system crash
4. Virtual Machine provides protection to other software

LIMITATIONS OF PRODUCING SOFTWARE BY VM


 Using VM means execution of extra code so processing time is increased due to
which speed of real performance can not be tested accordingly
 A virtual machine might not be as efficient because it might not be able to
access sufficient memory
 VM may not be able to emulate same hardware because some hardware can
not be tested using a virtual machine

28 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

VIRTUAL MACHINE
Qtn: What happens if guest OS receives the data request from an application

Guest OS handles the request as if it were running on its own physical machine and
Guest OS is not aware that it is running on virtual machine.

HOW GUEST OS HANDLE THE REQUEST


1. I/O request are translated by virtual machine software into instruction
executed by host OS.
2. Host OS retrieves the data from the file
3. Host OS passes the data to virtual machine software
4. The virtual machine passes the data to the guest OS
5. Guest OS passes the data to the application
TASKS PERFORMED BY VIRTUAL MACHINE SOFTWARE
1. Creates virtual machine
2. Hardware emulation: Existing hardware is made available to Guest OS
3. Controls virtual hardware
4. Ensures each vM is protected from actions of another VM

29 Davis_Kazibwe@2023KIS
AS & A LEVEL COMPUTER SCIENCE 9618

VIRTUAL MACHINE
USES OF VIRTUAL MACHINE BY WEBSERVER COMPANY
1. Could be used as alternative OS to identify possible problems and it is much
easier to create a VM with a new operating system rather than creating a new
computer system
2. Provides a safe environment during testing which does not disrupt the web
server services
3. Can be used as an alternative replacement web-sever software to identify
possible problems in the web server on different OS
4. It is easier to try different webserver and OS combinations

30 Davis_Kazibwe@2023KIS

You might also like