Topic 2 Computer Organization

Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

TOPIC 2

COMPUTER ORGANIZATION
WAQAR ALI
https://i.ytimg.com/vi/jFd1qvCS6lM/maxresdefault.jpg
GROUP ACTIVITY
TIME: 08:00 MINS
• Group 1
• Maheen, Hassan, Faizan, Urooj
Q: what are applications of Binary Number System in our Daily
Life. And how it links with the routine decimal number system.
• Group 2
• M. Musa, M. Saad, S. Usman, Ezzah Ali
Q: what are applications of Octal Number System in our Daily Life.
And how it links with the routine decimal number system.
• Group 3
• M. Ali, M. Ibrahim, Abdul hanan, Aisha Abid
Q: what are applications of Hexadecimal Number System in our
Daily Life. And how it links with the routine decimal number system.
DECIMAL TO BINARY CONVERSION
BINARY TO DECIMAL CONVERSION
DECIMAL TO OCTAL CONVERSION
OCTAL TO DECIMAL CONVERSION
DECIMAL TO HEXADECIMAL CONVERSION
HEXADECIMAL TO DECIMAL CONVERSION
HEXADECIMAL TO BINARY

https://www.inchcalculator.com/wp-content/uploads/2021/09/how-to-convert-hex-to-binary.png
https://res.cloudinary.com/witspry/image/upload/witscad/public/content/courses/computer-architecture/data-representation.jpg
INTEGER REPRESENTATION

https://www.electronics-lab.com/wp-content/uploads/2022/07/sign_and_magnitude.png
CHARACTER AND STRING
ASCII → 7 bits used to Unicode→ 8 bits/16 bits
represent only Text • used to represent
• A-Z (26) • Text
• a-z (26) • Non English Characters
• 0-9 (10) • graphics and mathematical symbols
• Controls/punctations (04) • includes characters from almost all of the
living languages of the world
• Others special symbols (62)

• Max Representation:
• UTF(8) 2^8=256
• Max Representation: 2^7=128
• UTF(16) 2^16=65536

String: Sequence of Characters


1Characcter store in 1 byte(8 bits)→ if word is of 5 Character then Storage =5*8=(40 bits)
COLORS REPRESENTATION
• Pixel:
• Smallest controllable elements in a display.
• Resolution:
• 1024 x 768(width x height in pixels)
• 1 pixels produces 1color that is a combination of 3 colors
• Red, Green and Blue
• Each of three color is represented with 2 hexadecimal digits from 00 to FF

A little red (112), a lot of green


(239) and a little of blue (90)
combines to
make a "lime" shade of green
https://i.ytimg.com/vi/AT_GjUjNFpo/maxresdefault.jpg
INTRODUCTION
• Computer systems use binary
system to store and represent data
• Logic gates are electrical circuits
that receive binary numbers, and
produce a single output.
• Logic gates use the rules Boolean
logic (all values are either true or
false)
• OFF : 0
• ON: 1

file:///C:/D%20DRive/Resources%20From%20Indian%20Teacher/CS%20logic%20gates%20presentation%20(1).pdf
https://t4.ftcdn.net/jpg/01/28/92/69/360_F_128926904_syD57HGXIbo3TU7sIskTpm6Km9jsT0YB.jpg
AND GATE

Examples:
OR GATE
NOT GATE
EXAMPLE
EXAMPLE

• “Tania won't go to play if it is cold and raining,


or if she has not done her homework”
ACTIVITY
• You all need to Build a Circuit for the Following Expression
XOR GATE
Input Output

A B 𝑨. 𝑩 + 𝑨. 𝑩

0 0

0 1

1 0

1 1
NAND GATE
Input Output

A B 𝑨. 𝑩

0 0

0 1

1 0

1 1
NOR GATE
Input Output

A B 𝑨+𝑩

0 0

0 1

1 0

1 1
• Construct the truth table of the following Circuit?
ACTIVITIES
Draw the logic circuit for the expressions:
1. (A xor B) and not C

2. (P OR Q) AND (R XOR S)

3. (P OR NOT Q) AND NOT (R XOR S)

4. P OR (NOT Q AND P AND Q)

5. (P AND Q) OR (Q XOR(P AND R AND Q))


Machine Instruction Cycle Overview

Fetch

Store Decode

Execute
Have a go with this
Components of the CPU interactive demo
○ You need to be able to reproduce this diagram and discuss
everything in it

CPU

Control MAR Address Bus


Unit Memory

Accumulator
(Registers)
[01]
[02]
[..]
Arithmetic [FF]
Logic MDR Data Bus
Unit

This is quite a useful video (although when he says BR buffer register, replace it
with MDR memory data register)
Registers
○ Registers are the smallest and fastest unit of memory in a computer system. They exist within the CPU 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. [Technically not on the syllabus but
essential to understanding.]
○ Memory Address Register: Stores the address in memory that is to be read or written. When
something happens that involves memory, the MAR stores WHERE it happens. So when a read happens,
the MAR stores the address from which the data will be read and when a write happens the MAR stores
the address at which the data (from the MDR) will be written.
○ Memory Data Register: Stores the data in memory that has been read or is to be written. When
something happens that involves memory, the MDR stores WHAT is read/written. So when a read
happens, the MDR stores the data that has been read and when a write happens, the MDR stores the
information that will be written.
○ Instruction Register: Stores the current instruction that has been transferred to the MDR and is
about to be decoded and executed. Once the data is in the Instruction Register we consider this to be
the end of the Fetch part of the machine instruction cycle. [This register is only mentioned on the HL
syllabus for some reason.]
○ Control unit: The decoder in the control unit is responsible for finding out what the instruction that has
been read does.
○ ALU: The Arithmetic Logic Unit is responsible for executing the instruction.
○ Accumulator: A set of general purpose registers used for storing temporary intermediate results of
the CPU's calculations.
THE CONTROL UNIT AND ALU
Control Unit:
○ The Control Unit decodes instructions
○ The Control Unit contains a component called the decoder, which is
responsible for decoding each instruction into basic opcodes. The
decoder decides what each instruction actually means.
○ It coordinates the other components of the CPU and synchronizes the
movement of data or instructions between registers.
○ It also controls when data is to be read from or written to memory by
means of a read/write signal.
Arithmetic Logic Unit:
○ The ALU carries out instructions to do with arithmetic and logic.
○ The ALU reads operands from registers and writes the results of its
operations into registers.
○ Examples are adding, subtracting, multiplying, complementing (negating),
AND, OR, shifting bits along the register
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. This is carried out by the
decoder, which is part of the control unit.

The Execute Phase


○ The ALU carries out the operation, e.g. ADD, MUL, CMP, JMP, STO, etc.
○ Note the instruction executed may cause a memory read, e.g. LDA 39A7 might mean "fetch the
contents of 39A7 and copy it to the accumulator"

The Store Phase (optional)


○ This is really part of the execute phase, when a STO instruction is executed. 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. [6 marks]
○ Explain why the address bus is shown as a one directional arrow and the data bus
is a two directional arrow. [4 marks]
○ Outline the fetch phase of the machine instruction cycle. [2 marks]
○ Compare the roles of the Memory Address Register and the Memory Data Register.
[4 marks]
○ Outline the role of the Control Unit in the machine instruction cycle. [2
marks]
Operating Systems
○ Operating System: A collection of programs that control the execution of software
applications and that provide services such as resource allocation, scheduling,
input/output control, and data management.
○ How many operating systems can you name?
○ Main functions:

○ Input/Output (IO) control: Interacting with screens, keyboards, mice, printers, etc.
○ File management: How/where data is stored on the hard disk. Folder structures.
○ Software/hardware interface: Brokering the relationship between running processes
and physical hardware, e.g. when a word processing application wants to print
something it asks the OS; it doesn't talk directly to the printer.
○ Memory management: Deciding which parts of memory are being used by which
running processes, and which parts of memory are free to be allocated.
○ User interface: Things like windows, buttons, mouse pointers, icons are part of a GUI
or Graphical User Interface. Older OS's used to have a command-line interface, where
you had to type commands because there were no mouse pointers or buttons. The first
guessing game that you programmed had a command-line interface.
○ Scheduling and program execution control: The OS is responsible for swapping running
processes into and out of the CPU. This gives the illusion of being able to do lots of
things at once, which is called multitasking. It's the reason that you can type your
homework and listen to music and download a file all at the same time.
○ Security: There is a separate slide on this.
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, ie even if you're logged in to
the same machine, I still can't read any file you have open.
○ Built-in firewall
○ Built-in anti-virus and malware detection
Levels of Memory
○ Primary Memory
○ Primary memory is the main working memory. It is generally
volatile (but see ROM) and is directly accessible by the
CPU.
○ 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
Secondary memory comprisesslower but higher capacity
devices that are non-volatile and not directly accessible
by the CPU.
○ Disk storage "Volatile" memory loses its
○ Magnetic tape data when the power is
○ USB flash drives turned off.
○ Cloud storage
SECONDARY MEMORY OPTIONS
Optical disk E.g. CD or DVD. Medium capacity (700Mb - 5Gb). Portable.
Beginning to become obsolete in laptop computers
because of extra hardware required.

Magnetic hard Normal computer hard drive (internal or external). High


disk capacity. Moving parts mean slower access and lower
reliability.
Magnetic solid- Flash memory, thumb drive, memory stick, etc., but also
state disk increasingly used as main storage in laptop computers.
Currently quite expensive/low capacity. No moving parts
increases speed and reliability.

Magnetic tape Extremely high capacity. Used by large organisations to


store offsite disaster recovery data. Sequential access only
(unlike other media listed) so not good for frequent lookups.

Cloud storage Very high capacity. Requires monthly/annual payment.


Back-up managed by third-party. Security considerations as
data moves across public network.
The details of OS memory management are required
Operating Systems and at HL only and are covered in Topic 6. No detail is
Memory Management required at SL of paging or virtual memory but they are
included here for completeness.

○ 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, allowing the OS to run more
processes than there is RAM to hold them.
○ 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 it's probably better not to use proprietary names in your exam.
Say "spreadsheet software" and not "Excel".
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 two main functions of an operating system. [4 marks]
○ Outline three security features of operating system? [6 marks]
○ Identify two features of application software that are
usually provided by the operating system. [2 marks]
○ Compare optical disks and cloud storage. [4 marks]
○ Explain how a multi-tasking operating system can run more
than one program at the same time. [4 marks]

You might also like