Computer Organization IB Computer Science Topic 2.
-
Upload
shanon-harrison -
Category
Documents
-
view
314 -
download
14
Transcript of Computer Organization IB Computer Science Topic 2.
Computer OrganizationIB Computer Science Topic 2
Outline the four phases of the machine instruction cycle. [8 marks]
Draw a block diagram showing the basic components of the CPU and how they interact with memory. [8 marks]
Machine Instruction Cycle Overview
Fetch
Decode
Execute
Store
Components of the CPU
You need to be able to reproduce this diagram and discuss everything in it
ControlUnit R
egiste
rs
ArithmeticLogicUnit
Memory
[01][02][..][FF]
Address Bus
Data Bus
MAR
MDR
Registers
Registers are the smallest and fastest unit of memory in a computer system, and are used to store information that the CPU is working on at that exact moment.
Registers you need to know about: Program Counter: Stores the address of the next instruction
Memory Address Register: Stores the address in memory that is to read or written.
Memory Data Register: Stores the data in memory that has been read or is to be written.
Instruction Register: Stores the current instruction being processed.
Accumulator: A set of general purpose registers used for storing temporary intermediate results of the CPU's calculations.
The Fetch Phase The PC (Program Counter) stores the address of the next instruction in memory.
The contents of the PC are copied to the MAR and the PC is incremented.
The address is put onto the address bus.
The data at that address is read into the MDR.
The data returns on the data bus.
The Decode Phase The instruction carried by the MDR is copied to the IR (Instruction Register)
The instruction is translated into a format that the ALU can understand.
The Execute Phase The ALU carries out the operation, e.g. ADD, MUL, CMP, JMP, STO, etc.
The Store Phase (optional) This is almost exactly the same as the Fetch phase, except that the control bus carries a
"write" signal instead of a "read" signal. Therefore, instead of reading the data stored at the MAR address into the MDR, the data stored in the MDR is written to the location at the MAR address.
Questions
Draw a block diagram showing the basic components of the CPU and how they interact with memory. [8 marks]
Explain why the address bus is unidirectional and the data bus is bidirectional. [4 marks]
Outline the four phases of the machine instruction cycle. [8 marks]
Compare the roles of the Memory Address Register and the Memory Data Register. [4 marks]
Operating Systems
Operating System: Software that controls the execution of programs and that may provide services such as resource allocation, scheduling, input/output control, and data management.
How many operating systems can you name?
Main functions:
A collection of programs
Input/Output (IO) control
File management
Software/hardware interface
Memory management
User interface
Scheduling
Program execution control
Security
Operating Systems and Security
User management: login with password
System of privileges, determining which user or process can do what, eg delete files, shut down the system, etc
Permissions for files and directories, eg read-only
Memory management: keeping one process’s or one user's memory space separate from another’s
Built-in firewall
Levels of Memory
Primary Memory Registers: Smallest, fastest memory, used to hold data that the CPU is
currently working.
Cache: Small, fast memory, used to hold very frequently used data.
RAM: Random Access Memory. Holds data and instructions from running programs.
ROM: Non-volatile memory, used to hold the operating system's bootstrap loader (small start-up program) or BIOS.
Secondary Memory Disk storage
Magnetic tape
USB flash drives
Operating Systems and Memory Management
Multi-tasking environment: keeping the memory space of each process safe from other running processes (see Security)
Multi-user environment: keeping the memory space (primary and secondary) of each user safe from other users (see Security)
Allocating and deallocating memory for each process
Paging: Dividing virtual memory up into equal-sized blocks (pages)
Paging allows OSs to allocate non-contiguous chunks of memory to the same process, thus reducing fragmentation problems
Virtual memory: The use of secondary memory as if it were primary memory.
By creating virtual memory, the OS make it easier for programs to reference memory because they don’t need to worry about the complications of the underlying physical structure of memory and disk (another example of abstraction)
Applications
An application is a computer program that allows a user to perform some useful activity. Examples are:
Word processor: Text document management
Spreadsheet: Mathematical and financial calculations
Database: Organisation of information
Email: Electronic mail
Web browser: Viewing HTML pages
Graphics processing: Editing, cropping and enhancing images
Computer-Aided Design (CAD): Creating and editing designs for engineering or manufacturing
Note that you are not allowed to use proprietary names in your exam. So you say "spreadsheet software" and not "MS Excel", etc.
Common Features of Applications
The IB Guide refers to features:
"Including toolbars, menus, dialogue boxes, graphical user interface GUI) components.
Students should understand that some features are provided by the application software and some by the operating system."
Operating systems make services available to applications:
I/O (input/output) operations
File system manipulation (reading/writing files)
Frameworks of GUI components
Program execution
Hardware interface
Error detection
All applications need these services, so it makes sense to centralise their provision.
They make the development of software simpler because potentially complex interaction with hardware is avoided.
Questions
Outline the main functions of an operating system. [4 marks]
Explain the advantages of virtual memory. [4 marks]
In what ways can an operating system improve information security in a computer? [4 marks]
Binary Representation
Definitions
Bit: The smallest amount of data that can be represented. Short for "binary digit". Represented as either a 0 or 1.
Byte: 8 bits
Denary/Decimal: The base 10 counting system. The normal place-value counting system in which a new column is created when a power of 10 is reached.
Hexadecimal: The base 16 counting system. Requires six new symbols in addition to 0-9, which are A-F. Since 24 = 16, one Hex digit can be used to represent 4 bits, and two Hex digits can be used to represent a byte.
Data Representation The Guide mentions: Strings, integers, characters, colours.
The most basic point is that more bits allows more different values to be stored.
01
00011011
000001010011100101110111
0000000100100011010001010110011110001001101010111100110111101111
0000000001000100001100100001010011000111010000100101010010110110001101011100111110000100011001010011101001010110110101111100011001110101101111100111011111011111
No bits No diff values
1 2
2 4
3 8
4 16
5 32
n ?
More bits means:
• More different values• Data is larger
Raster images
Also called bitmaps, raster images use a grid of points of colour
But how many different colours can one point be?
Colour depth is the number of bits per pixel (generally "bit depth")
(The number of pixels makes a difference too.)
Obvious tradeoff between picture quality vs file size
Questions
An image file is made up of a grid of 200 x 300 pixels and has a colour depth of 8 bits.
How many different colours can each pixel represent? [2 marks]
What is the size of the file? [2 marks]
A friend argues that if you increase the colour depth of this file, you will improve its quality. To what extent is he correct? [4 marks]
General knowledge!
What does RGB stand for?
How many colours can RGB represent?
What are the RGB values for: white?
black?
What colour is: 888888?
00FFFF?
Why is ASCII vs Unicode relevant to this topic? Explain one advantage and one disadvantage of Unicode over ASCII.
Logic Gates
The Guide mentions
AND, OR, NOT, NAND, NOR, XOR
Which of these are binary operators and which are unary operators?
Construct truth tables for each.
Look at the logic diagram below. Construct a truth table for X given the inputs A, B and C.
AND
NOT XOR
A
B
C
X
Redraw each of these diagrams using fewers gates
NOT
NOT
AND
A
B
X
NOT
NOT
ANDA
X
ANDB
OR
Harder
NOT
OR
AND
A
BX
C
Write a boolean expression for the following logic diagram
Construct its truth table
Construct a logic diagram for the following boolean expression: A AND (B OR NOT C)
IB Example
Maria won’t go to school if it is cold and raining or she has not done her homework
Draw a logic diagram
Construct a truth table
Huh?! Think…What are the inputs?
What is the output?
What are the Boolean operators?
IB Example: Maria won’t go to school if it is cold and raining or she has not done her homework.
Inputs• Cold• Raining• Done Homework
Outputs:• Go to School
and
or
not
C
R
H
Snot
C R H C and R Not H C and R or Not H S = Not(C and R or Not H)
0 0 0 0 1 1 0
0 0 1 0 0 0 1
0 1 0 0 1 1 0
0 1 1 0 0 0 1
1 0 0 0 1 1 0
1 0 1 0 0 0 1
1 1 0 1 1 1 0
1 1 1 1 0 1 0