Vous êtes sur la page 1sur 20

Teknologi Virtualisasi dan Cloud

Computing
http://www.unhas.ac.id/amil/S2TE/TVCC_2014/

L#2: Program Execution


Amil A. Ilham
http://www.unhas.ac.id/amil

Computer Organization

CPU and Main Memory


Central
Processing
Unit

Primary storage area


for programs and data
that are in active use
Synonymous with
RAM

Chip that executes


program commands
Intel Pentium 4
Sun ultraSPARC III

Main
Memory

Secondary Memory Devices


Secondary memory
devices provide
longlong-term storage

Central
Processing
Unit

Hard disks
Floppy disks
Writable CDs/ DVDs
Tapes

Hard Disk
Main
Memory
Information is moved
between main memory
and secondary memory
as needed

Floppy Disk

The Central Processing Unit


A CPU is on a chip called a microprocessor
It continuously follows the fetch-decode-execute cycle:
Retrieve an instruction from main memory
fetch

execute

Carry out the


instruction

decode

Determine what the


instruction is
5

Review SAP-1
SAP (Simple-As Possible) 1
Komputer dengan arsitektur yang sangat
sederhana

Arsitektur
SAP-1

Pencacah Program
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
8

RAM 16x8
Alamat
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Isi_memori
???????? (8 bit)
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
????????
9

RAM 16x8
Alamat
0H
1H
2H
3H
4H
5H
6H
7H
8H
9H
AH
BH
CH
DH
EH
FH

Isi_memori
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
10

Instruksi SAP-1
Mnemonik
LDA
ADD

Kode Biner Keterangan


0000
Load the accumulator (Isikan data
RAM ke dalam akumulator)
0001
Tambahkan data RAM pada
akumulator

SUB

0010

OUT

1110

HLT

1111

Kurangkan data RAM dari


akumulator
Isikan data akumulator ke dalam
register keluaran
Hentikan pemrosesan
11

Pemprograman SAP-1
Bagaimana cara memprogram SAP-1 untuk
menyelesaikan persoalan aritmetik ini ?
16 + 20 + 24 32
Desimal

Biner (8 bit)

Hexa

16
20
24
32
12

Pemprograman SAP-1
Bagaimana cara memprogram SAP-1 untuk
menyelesaikan persoalan aritmetik ini ?
16 + 20 + 24 32
Desimal

Biner (8 bit)

Hexa

16

0001 0000

10H

20

0001 0100

14H

24

0001 1000

18H

32

0010 0000

20H
13

Pemprograman SAP-1
(Bahasa Assembly)
16 + 20 + 24 32
Desimal

Biner
(8 bit)

Hexa

16

0001 0000

10H

20

0001 0100

14H

24

0001 1000

18H

32

0010 0000

20H

Mnemonik

Kode Biner

LDA

0000

ADD

0001

SUB

0010

OUT

1110

HLT

1111

Alamat

Isi_memori

0H
1H
2H
3H
4H
5H
6H
7H
8H
9H
AH
BH
CH
DH
EH
FH

LDA 9H
ADD AH
ADD BH
SUB CH
OUT
HLT

10H
14H
18H
20H

14

Pemprograman SAP-1
(Bahasa Mesin)
16 + 20 + 24 32
Desimal

Biner
(8 bit)

Hexa

16

0001 0000

10H

20

0001 0100

14H

24

0001 1000

18H

32

0010 0000

20H

Mnemonik

Kode Biner

LDA

0000

ADD

0001

SUB

0010

OUT

1110

HLT

1111

Alamat

Isi_memori

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

0000 1001
0001 1010
0001 1011
0010 1100
1110 XXXX
1111 XXXX

0001 0000
0001 0100
0001 1000
0010 0000

15

T2

Siklus
Pengambilan
(Fetch Cycle)
T1,T2,T3

T1

Berlaku untuk
setiap instruksi
T3

16

Siklus
Eksekusi
T4,T5,T6

T5

Instruksi LDA
T4

T4
T6 = NOP
(No Operation)
17

Siklus
Eksekusi
T4,T5,T6

T6

T5

T4

Instruksi ADD
T4

18

Kinerja SAP-1
Satu siklus mesin pada SAP-1 memiliki 6 keadaan
yaitu T1 T6 (6 clock).
Setiap instruksi membutuhkan satu siklus mesin.

19

CPU Execution Time


CPU execution time or CPU time is the actual
time the CPU spends computing for a specific
task.

CPU time =
Instruction count x CPI x Clock cycle time
(CPI : Cycles per instruction)

Misalkan processor SAP-1 memiliki frekuensi clock 1


KHz. Hitunglah CPU time untuk memproses program
aritmetika: 16 + 20 + 24 32
20

Vous aimerez peut-être aussi