mm

advertisement
CAMBRIDGE IGCSE
COMPUTER SCIENCE
0478
2
Unit 2: Numbers, processors and operating systems
This unit looks at the way in which numbers are represented within a computer system, the
structure of the central processing unit and its functions, and the role of the operating system
in managing the components of a computer system and interactions with the user.
Contents
Understand binary notation and to convert denary numbers to and from binary
Recognise the use of binary numbers in computer systems
4
Understand hexadecimal notation and to convert hexadecimal integers to and from binary and
denary
5
Understand the significance of hexadecimal in computer systems
7
Show understanding of the basic Von Neumann model for a computer system and the stored
program concept
7
Describe the stages of the fetch-execute cycle
10
Describe the purpose of an operating system
11
3
Understand binary notation and to convert denary numbers to and
from binary
Computers are made up hardware that stores and processes data. If you break a computer
down into its most basic components you have millions of circuits that either allow electricity
to flow, or not. The computer uses electronic circuits to store one of two values using a switch
— the switch is either on (1) or off (0). Using a number of these switches provides us with many
possible combinations of Is and Os which we can use to represent numeric values. This is called
Binary.
A single 1 or 0 is called a binary digit or bit for shot. A group of eight bits is called a byte. Four
bits, half a byte, is called a nibble.
Denary: A system of numbers using ten digits, O and 1-9 (also called base-IO system)
Binary: A system of numbers using only 2 digits, 0 and 1 (also called base-2 system)
x2
x2
x2
128
64
32
2x2x2x2x2x2x2 2x2x2x2x2x2 2x2x2x2x2
16
2x2x2x2
24
27
x2
26
To convert Binarv to Denarv
25
x2
x2
x2
2x2x2
4
2x2
2
2
1
1
23
22
21
10
8
4
Recognize the use of binary numbers in computer systems
In base 10 we have some important numbers we give names to: for example 1
Ox10x10 is 1000 which we call a thousand; and 1 thousand multiplied by 1 thousand
which we call 1 million; and so on. In base 10 we are also used to the metric system
which uses kilo to mean a thousand, for example kilometre or kilogram. In binary we
also have names to describe key values.
The basic unit is 0 or 1 — this is a binary digit or a bit.
A group of 8 bits IS called a byte and half a byte (4 bits) is called a nibble.
We also use the kilo prefix to represent the same sort of scale as we do in base 10. But 1000 is
not correct in binary which is 2 10 or 2x2x2x2x2x2x2x2x2x2 = 1024. Using this approximation to
1000 we can now define a whole set of names commonly used to describe
binary numbers
8 bits
1024 bytes
1 byte
1 kilobyte
1024 kilobyte
1
megabyte
1024 megabytes
1024 gigabytes
1 gigabyte
1 terabyte
5
Registers
Registers are also used in most digital instruments to represent the numbers.
Consider the following example in a digital display of a car.
A car has a speedometer with a digital read out. Each digit can be represented by a 4-bit register.
1
Digit
2
9
2nd
3rd
Digit
Digit
Can be represented1 st
nd
Digit
8
o
o
1
4
o
o
o
2
o
1
1
Digit as:2
1
o
o
1
3rd Digit
Understand hexadecimal notation and to convert hexadecimal
integers to and from binary and denary
Humans are not very good at remembering long strings of numbers so, to make it easier
for us, we can represent every group of 4 bits with a single digit.
6
base 10 we have 10 symbols 0 to 9, if we use the 16 symbols for 0 to 15 we can use a
system based on place values of 16 rather than 2 or 10. We call this hexadecimal (or hex
for shorn. We do. however need to have svmbols for the numbers 10. 1 1 12. 13. 14 and
15.
Converting denary to hex is the same process we have used before with column
values, using the values 1 and 16 except this time we need to work out how many
groups of 16 there are in the denary number.
Let's convert 182 to hex:
182/16 = 1 1 remainder 6
Represent this using the table and replace the denary with its corresponding Hex value.
16
1
6
6
To convert a Binary number to Hex
7
To convert from Binary to Hex you first need to represent the binary using two nibbles. For
example, the binary number 00101101 can be represented in 2 nibbles as shown below. Then
replace the values with the corresponding Hex digits.
Split into 2 Nibbles
8
Understand the significance of hexadecimal in computer systems
The close relationship between binary and hexadecimal is why hexadecimal is used so
extensively by programmers. The data on the computer is in binary, if the programmer
needs to examine this data then pages of Is and Os are not much help, but the
hexadecimal equivalents are much easier to work with. As with binary numbers,
hexadecimal numbers are stored in registers and main memory.
Hexadecimal is used in the HTML code for colours. Light blue on an HTML page has the
hexadecimal value ADD8E6, and brown is A52A2A. Working with hexadecimal numbers
is much easier than working with the binary equivalent 101011011101100011100110.
Hexadecimal numbers are also used in MAC addresses. Media Access Control (MAC)
technology provides unique identification and access control for computers on an Internet
Protocol (IP) network. Media Access Control assigns a unique number to each IP network
adapter called the MAC address. A MAC address is 48 bits long. The MAC address is
commonly written as a sequence of 12 hexadecimal digits as follows:
48-3F-OA-91-OO-BC
9
Hexadecimal numbers are used in assembly languages. Assembly languages use a set of
rnnnrnnninc
nneeihln nnnr•hinn nnnrn+innc kA/hinh innll inch-1 in
Registers
Register
Stands for
PC
Program Counter
CIR
Current Instruction Register
MAR
Memory Address Register
MDR
Memory Data Register
Accumulator
Holds Results
Index
Used by programs to adjust the address part of an instruction before
the address is used
Special
Register
Holds the address in PC to be reloaded after the completion of jump
instruction
Status
Holds flags that indicate process status
10
PC - Program Counter (Alternative names; Sequence Control Register "SCR", Instruction
Address Register "[AR", Next Instruction Register "NIR"; the name we shall use forward
is PC):
It contains the address of the next machine code instruction to be executed.
It holds processing results before being transferred to memory data register and
then to memory.
Status Register:
Holds flags that indicate processor status at any time.
The index register:
Is a special purpose register used by programs to adjust the address part of an
instruction before the address is used.
It provide an efficient way of accessing a range of memory locations, such as in an
array.
Use of Special Registers/Memory Addressing Techniques
11
The minimum number of registers needed to execute machine code instructions not highlevel language instructions.
The diagram does not show the control bus and the signals needed for instructions
to be correctly executed.
Accumulator
1
Program Counter
12
Describe the stages of the fetch-execute cycle
Fetch cycle;
Load the address that is in the program counter (PC) into the memory address register
(MAR).
Load the instruction that is in the memory address given by the MAR into the memory
data register (MDR).
13
Describe the purpose of an operating system
The operating system manages all other programs and applications (and hardware). On many
computers, when it is powered up, the first program that runs is stored on a ROM chip. This
program checks system hardware to make sure everything functions normally. The next thing
to check is the CPU, the internal memory and basic input-output system (bios) for errors. If all
proves to be acceptable, the bios activates the memory drives. When the drive is activated, the
operating system is found and is loaded.
The operating system is system software. It is a group of programs that manages the computer's
resources. This includes the following functions:
Memory Management o One of the main duties of an OS o When you open an
application the OS loads the necessary parts into memory o The OS will load extra parts
into memory as they are required o If features haven't been used in a while the OS will
remove them from memory to try to free up space
Peripheral management
Manage the way software interacts with Hardware o A device driver acts as a
go between for other software to 'talk' to the hardware o Most device drivers
are loaded into memory by the OS during booting but some are connected with
the peripheral is connected to the computer When you have finished with the
application, the OS will remove it from
14
Show understanding of the need for interrupts
Peripheral devices such as keyboards and printers must be controlled and responded to by the
operating system. Commun i cation between the computer and peripherals must be controlled
and errors detected.
When a device is required by a program, a signal called an interrupt is generated. Interrupts
allow for more efficient operation of a computer system. It interrupts the operating system and
tells it to stop running the current program and switch the CPU's attention to a different
program that is looking after the peripheral. The interrupts have code numbers and these are
different for each operating system. When the job with the peripheral is finished, the CPU is
directed back to the original program, to the point where it was interrupted.
The alternative method of communicating with peripherals is polling where the operating
system is responsible for periodically interrogating each peripheral device in turn to discover its
status. The disadvantage of this method is that the operating system has to devote significant
processing time to polling all the peripheral devices, even when the devices are not active.
Download