You are on page 1of 179

Topic 2: Computer Organization

Topic 2: Computer Organization 2 / 164


2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

COMPUTER ARCHITECTURE
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the
CU and the registers within the CPU
Reproduce a block diagram showing the relationship between the
elements of the CPU, input and output and storage. The memory
address register (MAR) and memory data register (MDR) are the only
ones that need to be included.
Topic 2: Computer Organization 3 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

Computer systems consist of hardware and software components.


They follow the concept of input, process, output and storage model.
That means that:
1 a computer gets some data as input.
2 process it in a requested manner.
3 outputs the result.
4 during the process, other data apart from the inputted may be
needed. This data exist in the storage of the computer system and
will be used during the processing phase.
Furthermore, any new information that may arise from the processing
phase may also be saved in the storage.
Topic 2: Computer Organization 4 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

Question:
Imagine we have a digital camera which is a sort of computer system.
In order to take a picture the system follows the input, process, output
and storage model.
Explain how this model works.
Topic 2: Computer Organization 5 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

A block diagram describing the input-output process model:


Topic 2: Computer Organization 6 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

Input Devices: keyboard, sensor, digital camera button etc


Output Devices: monitor, speakers, printer etc
Data or instructions are processed by the computer system. It may
be the case that other data or instructions, apart from the input are
necessary during processing. These exist in the storage and may be
loaded and used.
Output is also saved on the storage (memory).
Topic 2: Computer Organization 7 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Central Processing Unit (CPU)

Data or instructions are processed by the central processing unit (CPU).


CPU is a hardware component of a computer system and can perform:
basic arithmetic,
logical and
input/output operations
in order to process data from input devices into useful information.
CPU is also referred as processor or chip.
CPU can retrieve data only from the input or primary memory of the
computer system.
Any data information that is to be saved or retrieved from a storage
medium (hard disk, DVD etc) first has to pass through the primary
memory in order to be accessed by the CPU.
Topic 2: Computer Organization 8 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Central Processing Unit (CPU)

CPU contains the:


Arithmetic Logic Unit (ALU)
Control Unit (CU), which in turn contains:
Memory Address Register (MAR)
Memory Data Register (MDR)
Topic 2: Computer Organization 9 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Central Processing Unit (CPU)

Control Unit (CU)

is responsible for the operation of the CPU.


controls the retrieval of instructions from the primary memory
controls the sequence of the execution of these instructions
is responsible for:
providing the ALU with the data that needs to be processed
providing the instruction of how the data should be processed.

Arithmetic Logic Unit (ALU)


It performs the basic arithmetic, logical operations (ADD, SUBTRACT,
AND, OR, NOT).
Topic 2: Computer Organization 10 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Cores

Sometimes an ALU is referred to a as core, hence computers with dual


core technology have two ALUs to process different calculations
simultaneously.
Since ALU is doing the most important operations in a CPU, a CPU core
is like a CPU’s brain.
In the old days, CPU had just one core. Today, CPUs have been two and
18 cores, each of which can work on a different task.
A core can work on one task, while another core works a different task,
so the more cores a CPU has, the more efficient it is. Many processors,
especially those in laptops, have two cores, but some laptop CPUs (known
as mobile CPUs), such as Intel’s 8th Generation processors, have four.
Topic 2: Computer Organization 11 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

CU contains various registers.

Register
It is a small storage location that can hold data. Registers are the
smallest and fastest units of memory in a computer system and are used
to store the information that CPU is working on at the exact moment.

The basic registers in CU are:


MAR (Memory Address Register)
MDR (Memory Data Register)
Topic 2: Computer Organization 12 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

MAR (Memory Address Register)

It holds the memory address of the data to be used by the ALU, so


that the ALU can fetch the corresponding content from the memory
and process it accordingly.
It holds the memory address of where the data that has been
processed need to be stored.
In order to communicate with the primary memory, a connection is
necessary. This connection is accomplished by the Memory
(Address) Bus

Primary Memory
It is the only storage directly accessible from the CPU. It cosists of RAM
(Random Access Memory) and ROM (Read Only Memory).
Topic 2: Computer Organization 13 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

MDR (Memory Data Register)

holds the data that is to be used by the ALU.


is closely related to MAR, since whichever memory address location
MAR is holding, the corresponding data will be loaded onto the
MDR for processing by the ALU.
after the processing has taken place, the ALU places the result onto
the MDR and that data is copied to the memory address location in
RAM specified by the MAR.

The connection between the MDR and the RAM is accomplished by the
Data Bus.
Topic 2: Computer Organization 14 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

More registers . . .

Program Counter: Stores the address of the next instruction.


Instruction Register: Stores the current instruction being processed.
Accumulators: A set of general purpose registers used for storing
temporary intermediate results of the CPU’s calculations.
Topic 2: Computer Organization 15 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Block Diagram
The following block diagram shows the relationship between the elements
of the CPU, input and output and storage.
Topic 2: Computer Organization 16 / 164
2.1 Computer Organization – Computer architecture
2.1.1: Outline the architecture of the CPU, the functions of the ALU, the CU and the registers within the CPU

Computer Architecture

Questions
Describe the function of the data bus found in a PC.
Outline the function of the ALU.
Topic 2: Computer Organization 17 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

COMPUTER ARCHITECTURE
2.1.2: Describe primary memory.
Distinguish between random access memory (RAM) and
read-only-memory (ROM), and their use in primary memory.
Topic 2: Computer Organization 18 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

Primary Memory

Primary Memory
is the only storage that is directly accessible by the CPU.
holds data that is currently running on the computer system.
holds instructions that are currently running on the computer

Primary memory consists of:


RAM (Random Access Memory)
ROM (Read-Only Memory)
Topic 2: Computer Organization 19 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

RAM (Random Access Memory)

stores the executing program instructions and any data is needed.


is general purpose storage area (data can be stored and
over-written).
is volatile (when the power is switched off all memory disappears).
data can be written and read very quickly.
acts as temporary storage and working space for the operating
system and its applications.
instructions and data are stored in unique memory locations and
each location has an address as well as content

Content
It is where instructions and data reside

Address
It is used by the CU to find, retrieve and access the data in order to send
it to the ALU for processing.
Topic 2: Computer Organization 20 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

ROM (Read-Only-Memory)

holds instructions and data in unique memory locations -every


location has an address as well as content.
is used to store permanent instructions and data that cannot be
changed and are used to boot and operate the computer.
data and instructions cannot be over-written.
is used to store programs and instructions that do not need to be
updated or changed:
BIOS (Basic Input Output System) contains the instructions
necessary to boot the computer.
how the computer reads input and writes output.
Topic 2: Computer Organization 21 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

Primary Memory

Question
Identify some differences between ROM and RAM found in a PC.
Topic 2: Computer Organization 22 / 164
2.1 Computer Organization – Computer architecture
2.1.2: Describe primary memory

RAM vs. ROM


Topic 2: Computer Organization 23 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

COMPUTER ARCHITECTURE
2.1.3: Explain the use of cache memory.
Explain the effect of cache memory in speeding up the system as well as
being able to explain how it is used.
Topic 2: Computer Organization 24 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

RAM has two main types:


SRAM (Static RAM) is faster but more expensive than DRAM.
DRAM (Dynamic RAM) is preferred for the main RAM of a
computer system.
A small amount of SRAM is placed between the main RAM and the
processor and is called Cache Memory.
Topic 2: Computer Organization 24 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

RAM has two main types:


SRAM (Static RAM) is faster but more expensive than DRAM.
DRAM (Dynamic RAM) is preferred for the main RAM of a
computer system.
A small amount of SRAM is placed between the main RAM and the
processor and is called Cache Memory.
Cache Memory
is a smaller and faster RAM (SRAM)
holds the information from RAM that is more actively used and
accessed more frequently.
lies between CPU and main memory.
is used by the CPU to reduce the average memory access times.
there are 3 different types of cache memory: L1, L2, L3.
Topic 2: Computer Organization 25 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

Cache Memory Levels

Level 1 (L1) Cache is extremely fast but relatively small, and is usually
embedded in the processor chip (CPU).
Level 2 (L2) Cache is often more capacious than L1; it may be located
on the CPU or on a separate chip or coprocessor with a
high-speed alternative system bus interconnecting the
cache to the CPU, so as not to be slowed by traffic on the
main system bus.
Level 3 (L3) Cache is typically specialized memory that works to improve
the performance of L1 and L2. It can be significantly
slower than L1 or L2, but is usually double the speed of
RAM. In the case of multicore processors, each core may
have its own dedicated L1 and L2 cache, but share a
common L3 cache. When an instruction is referenced in
the L3 cache, it is typically elevated to a higher tier cache.
Topic 2: Computer Organization 26 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

Question
Since cache memory is faster, why don’t we make all main memory out
of cache memory?
Topic 2: Computer Organization 27 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

Cache Memory

How does cache memory work?


Request made from the CPU.
Cache is checked for the data.
If found -data returned from cache (cache hit).
If not -information returned from main memory (cache miss).
The above actions speeds up the process.
If the data do not exist in the cache memory, the data are first copied to
the cache and then used.
The processor writes to the main memory through cache memory.
Topic 2: Computer Organization 28 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

Cache Memory

Question
State some differences between Cache Memory and RAM.
Topic 2: Computer Organization 29 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.

Memory Types
Topic 2: Computer Organization 30 / 164
2.1 Computer Organization – Computer architecture
2.1.3: Explain the use of cache memory.
Topic 2: Computer Organization 31 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

COMPUTER ARCHITECTURE
2.1.4: Explain the machine instruction cycle.
Include the role of data bus and (memory) address bus.
Topic 2: Computer Organization 32 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Machine Instruction Cycle

Computer programs are stored in the primary memory as series of


instructions in machine code.
Instructions and necessary data have to be moved from the primary
memory into the CPU in order to operate the computer program.
The following steps are followed:
Fetch the instruction from the primary memory to the control unit
Decode instruction in control unit
Execute instruction
Store the result of the execution and check for next instruction
Topic 2: Computer Organization 33 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Machine Instruction Cycle


Topic 2: Computer Organization 34 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Machine Instruction Cycle - Fetch


Fetch the instruction from primary memory to control unit

CPU is responsible for knowing which instruction is next to be operated.


To do that it sends the appropriate address through the memory address
bus to the primary memory.
The instruction that resides in the specific address is then copied into the
data bus and sent to the control unit.
The following steps take place:
Obtain next instruction from memory.
Load instruction into instruction register (IR or CIR, i.e. Current
Instruction Register).
MAR is loaded with instruction pointer.
Instruction is loaded through MDR.
Increment program counter (PC)
Topic 2: Computer Organization 35 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Machine Instruction Cycle - Decode


Decode instruction in control unit

The decoder interprets the instruction. During this cycle the


instruction inside the IR (instruction register) gets decoded.
Decoding an instruction allows the CPU to be aware of any
additional data that are necessary for the execution of the
instruction.
Any required data that need to be loaded from the primary memory
in order to execute the instructions are fetched.
The address of these data are placed into the memory address bus.
The data from these addresses are received by the CPU through the
data bus.
Topic 2: Computer Organization 36 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Machine Instruction Cycle - Execute & Store

Execute Instruction
ALU executes the instruction using the necessary data that have been
loaded and calculates the result.

Store the Result of Execution


After executing the instruction and computing the result, CPU
stores the result in the primary memory.
It specifies the address where the result will reside in the primary
memory, using the memory address bus.
Sends the data through the data bus.

The CPU then checks for the next instruction and repeats the steps
described above by fetching, decoding, executing the next instruction and
storing the result.
Topic 2: Computer Organization 37 / 164
2.1 Computer Organization – Computer architecture
2.1.4: Explain the machine instruction cycle.

Questions
Draw a block digram showing the basic components of the CPU and
how they interact with memory.
Outline the four phases of the machine instruction cycle.
Compare the roles of the Memory Address Register and the Memory
Data Register.
Topic 2: Computer Organization 38 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

SECONDARY MEMORY
2.1.5: Identify the need for persistent storage.
LINK: Consequences of data loss. Why do we need storage?
Topic 2: Computer Organization 39 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Why do we need storage?


Topic 2: Computer Organization 40 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Persistent Storage is only possible in secondary memory.


Secondary Memory
a relatively slow memory.
may be written to (just like RAM).
non-volatile (just like ROM) -contents of the memory are not wiped
if power is lost, but are persistent.
has relatively high capacity to hold data compared to primary
memory.
Topic 2: Computer Organization 41 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Secondary Memory

When a computer starts, RAM is empty.


Instructions and data (such as the operating system) need to be
copied into the RAM in order for the computer system to run.
These are copied from the secondary memory (which provides
persistent storage to computer systems).
If secondary memory did not exist a computer system would be
unable to store instructions and data persistently.
Topic 2: Computer Organization 42 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Secondary Memory

Without the availability of secondary memory only ROM would be


able to store programs and instructions. Since ROM cannot be over-
written, a computer would only be able to perform fixed operations
and any user data would have to be re-inputted every time the user
wished to use them. This would be acceptable for simple devices
such as calculators.
CPU can only access the volatile primary memory that is relatively
fast but moderate in capacity. The primary memory is connected to
the non-volatile secondary memory that is relatively slower but has
higher capacity to hold data.
Topic 2: Computer Organization 43 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Secondary Memory
Devices

Hard Disk Drive (HDD)


CD
DVD
USB Flash drive
Floppy disk
Magnetic tape
Flash memory cards
ZIP drive
Topic 2: Computer Organization 44 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Virtual Memory
is the use of secondary memory as if it was primary memory.
is a common part of most operating systems.
provides a big benefit for users at a very low cost.

Secondary memory is required to hold information that may not be


needed all the time or may be too large to fit as a whole in primary
memory. This makes secondary memory a necessity in most computer
systems.
By creating virtual memory the operating system makes 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.
Virtual memory is an example of abstraction.
Topic 2: Computer Organization 45 / 164
2.1 Computer Organization - Secondary Memory
2.1.5: Identify the need for persistent storage.

Memory (primary & secondary)

Questions
State some differences between primary and secondary memory.
Explain the advantages of virtual memory.
Topic 2: Computer Organization 46 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

OPERATING SYSTEMS & APPLICATION


SYSTEMS
2.1.6: Describe the main functions of an operating system.
The Operating System (OS)
Topic 2: Computer Organization 47 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System (OS)

is a software that controls the computer’s hardware resources and


provides services for computer programs.
it acts as an intermediary between software applications (programs)
and computer hardware.

The main services of an OS are:


Peripheral communication
Memory management
Resource monitoring and multitasking
Networking
Disk access and data management
Security
Topic 2: Computer Organization 48 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Peripheral Communication

Peripheral Devices
All hardware components of a computer system that reside outside the
CPU. Examples: keyboard, monitor, mouse, printer, microphone etc.

The operating system is responsible for:


communicating directly with the hardware
providing an interface between hardware devices and applications.
allows for applications to use hardware devices in a trouble-free
manner
Topic 2: Computer Organization 49 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Memory Management

An operating system is responsible for all the memory that is available in


a computer system.
It is also has to ensure that there are no conflicts of memory usage
between all the currently running programs and processes.
That means that:
it manages how the memory is used by applications.
it ensures that one application does not interfere with memory that
is being used by some other applications. Obviously, if an
application interferes with another application’s memory, the latter
may stop functioning or its data may be affected or overwritten.
This can sometimes involve using virtual memory where a part of the disk
drive is used as primary memory. (This might have drawbacks as the
speed of a hard disk is slower than main memory)
Topic 2: Computer Organization 50 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Memory Management

Multi-tasking: keeping the memory space of each process safe from


other running processes.
Multi-user: keeping the memory space of each user safe from other
users.
Allocating and deallocating memory for each process.
Paging: Dividing virtual memory into equal-sized blocks (pages).
Paging allows the operating system to allocate non-contiguous
chunks of memory to the same process, thus reducing fragmentation
problems.
Topic 2: Computer Organization 51 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Resource monitoring and multitasking

An application running on a computer system takes up resources:


amount of memory the application is occupying.
how much processor time it needs in order to function properly.
The operating system is responsible for the efficient allocation of
resources so that an application can run as effectively as possible.
Multitasking
Multiple applications may run on a computer system, appearing as
they are performing tasks simultaneously.
Computer systems always have fewer CPUs than the number of
tasks they have to perform.
Applications must share CPU time to accomplish their goal.
This is known as multitasking and it is a core OS service.
Topic 2: Computer Organization 52 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Networking

An operating system:
manages connections to and interconnections with networks of other
computer systems so as to allow the sharing go resources (files,
printers etc)
acts as an intermediary between applications and networks, allowing
operations to interact with networks in a straightforward manner.
Topic 2: Computer Organization 53 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Disk Access & Data Management

An important function of an operating system is its ability to access data


stored in memory and disks. Data is stored using files, which are
structured in a way to:
make better use of the available space
provide reliability
provide fast access times
The operating system is responsible for:
keeping track of these files
keeping track of which files are being used by which applications so
that an application does not overwrite files of another application
coordinating the transfer of data from the disk to the primary
memory and vice versa
Common File Systems: NTFS, FAT, FAT32
Topic 2: Computer Organization 54 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Security

The operating system is also responsible for the overall security of the
computer system.
Methods:
provide some form of identity to the user that will allow his
authentication (username & password)
magnetic cards
biometric data
use of log files that keep trace of the activity of any user in the
computer system. Anything that a user does is recorded so that
unauthorized users and activities may be discovered.
Topic 2: Computer Organization 55 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System: Security

User Management: login with password


System of privileges, determining which user or process can do what
– e.g. delete files, shut down the system etc.
Permissions for files and directories – e.g. read-only
Memory management: keeping one process’s or one user’s memory
space separate from another’s
Built-in firewall
Topic 2: Computer Organization 56 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Operating System

Examples of operating systems:


Windows
OS X
Linux
UNIX
Android
iOS
Topic 2: Computer Organization 57 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.6: Describe the main functions of an operating system.

Questions
Outline the main functions of an operating system.
Outline how the operating system ensures that files are only
accessed by allowed users.
In what ways can an operating system improve information security
in a computer?
Topic 2: Computer Organization 58 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

OPERATING SYSTEMS & APPLICATION


SYSTEMS
2.1.7: Outline the use of a range of application software.
Word processors, spreadsheets, DBMSs, email, web browsers, CAD,
graphic processing software
Topic 2: Computer Organization 59 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Software Applications

A computer system has the ability to run software applications that have
been installed by the manufacturer to complete some predefined tasks.
Example: Digital Camera
consists of both hardware and software components
follows the input-process-output and storage model
software components are preloaded and complete predefined tasks
software components can only be altered by receiving their updated
versions from the manufacturer
Topic 2: Computer Organization 60 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Software Applications

Computer systems allow the user to install a large number of software


applications.
Main software applications of a computer system:
Word processors
Spreadsheets
Database Management System (DBMS)
Web browsers
Email
Computer Aided Design (CAD)
Graphic Processing Software
Topic 2: Computer Organization 61 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Word processors
A software application that is used for the production of any sort of
document. Includes tools for:
composition
editing
formatting
possibly printing

Word Processing Applications


Microsoft Word, Apple Pages.
Topic 2: Computer Organization 62 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Spreadsheets

A software application that is used for the organization and analysis of


data.
Data is represented as cells, organised in rows and columns.
Cells may contain numbers, text or results of formulas. They support:
Fundamental arithmetic operations
Mathematical functions
Financial & statistical operators
Display of graphical data

Spreadsheet Applications
Microsoft Excel, Numbers, OpenOffice Calc
Topic 2: Computer Organization 63 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Database Management System (DBMS)

Database
It is an organised collection of data.
Data are stored in some sort of table and the are organized in
records (i.e. rows) and fields (i.e. columns)
A key feature of a database is the unique or primary key: a specific
field that uniquely identify each record.

Database Management System (DBMS)


A software application that manages (creates, stores, modifies, updated,
extracts information, queries) databases and is designed to provide an
interface between users and a database (e.g. MySQL, MS Access)
Topic 2: Computer Organization 64 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Question
A school has a database with all the information about the students.
Suggest 5 fields that this database could have. Suggest a primary
(unique) key.
Topic 2: Computer Organization 64 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Question
A school has a database with all the information about the students.
Suggest 5 fields that this database could have. Suggest a primary
(unique) key.

Student ID F. Name L.Name Tel. Num. E-mail


1234 Tom Jones 210 1234567 tom@example.com
. . . . .
. . . . .
. . . . .

A primary key could be either student ID (preferred), e-mail or phone


number.
Topic 2: Computer Organization 65 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Web Browsers

A web browser is a software application used to access, retrieve and


present content on the World Wide Web.
Content may be web pages, images, videos etc identified by a URI
(Uniform Resource Identifier)
The web browser uses the URI to connect to the appropriate web
server and request the wanted information.

Examples
Google Chrome, Internet Explorer, Safari, Mozilla Firefox.Software
applications
Topic 2: Computer Organization 66 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Email (1/2)

A software application that allows the exchange of digital messages


from a single author to one or more recipients.
Author and recipient do not need to be online simultaneously to
exchange the email.
The author sends the email to recipient’s email server. When the
latter connects to the server, they will receive the message.
Email software applications can be:
web-based (Google GMail)
as a software that is installed on a personal computer system
(Microsoft Outlook)
Topic 2: Computer Organization 67 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Email (2/2)

Email consists of:


the envelope
the header
the body
Simple Mail Transfer Protocol (SMTP) is used for an email to be
transferred from the author to the recipient. This protocol communicates
delivery parameters using the message envelope. (A protocol is a set of
agreed upon rules that are used by computers during communication)
The message header contains information about the sender and
recipient(s) addresses, the subject field and a date/time stamp.
The body contains the actual message.
Topic 2: Computer Organization 68 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Question
State one advantage and one disadvantage of webmail over a mail
application that is installed on a person’s computer.
Topic 2: Computer Organization 68 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Question
State one advantage and one disadvantage of webmail over a mail
application that is installed on a person’s computer.

Answer
Webmail is accessible from any computer device that has a web browser.
It is also safer, since it can be tuned to require password at each
connection.
On the other hand webmail is usually slower, is not displayed nicely on all
devices and the user needs more time to connect to it.
Topic 2: Computer Organization 69 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Computer Aided Design (CAD)

It is a software application that assists engineers to:


create
analyse
optimize a design
Is used in many fields to increase the productivity of the designer and the
quality of the resulting design. Examples: automotive, shipbuilding,
architectural design
May convey more than just shape information: Materials, dimensions etc.
Example: Autodesk AutoCad
Topic 2: Computer Organization 70 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Graphic Processing Software

A software that allows a user to manipulate visual images on a computer.


User can edit an image with the use of books in various ways such as:
selecting
moving
cropping
scaling
erasing
Example: Corel Draw, Adobe Photoshop
Topic 2: Computer Organization 71 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

Graphic Processing Software

A software that allows a user to manipulate visual images on a computer.


User can edit an image with the use of books in various ways such as:
selecting
moving
cropping
scaling
erasing
Example: Corel Draw, Adobe Photoshop
Topic 2: Computer Organization 72 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

State some differences between a Spreadsheet software application and a


Database Management System.
Topic 2: Computer Organization 72 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.7: Outline the use of a range of application software.

State some differences between a Spreadsheet software application and a


Database Management System.

A Database Management System . . .


. . . could be used for various data associations that cannot be
created with spreadsheets.
. . . manages databases with much more data than a spreadsheet and
serves a lot of users.
. . . preserves data integrity easier.
A spreadsheet . . .
. . . can be used to produce charts and graphs using automated
software tools.
. . . can hold a limited amount of information.
. . . usually serves the needs of a single person.
. . . perform a lot of mathematical functions and perform data
analysis.
Topic 2: Computer Organization 73 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

OPERATING SYSTEMS & APPLICATION


SYSTEMS
2.1.8: Identify common features of applications
Some features are provided by the applications and some by the
operating system. This improves usability for a wide range of users.
Topic 2: Computer Organization 74 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Common Features of Applications

Software applications typically include a graphical user interface (GUI) to


allow the user to interact with them in a number of ways, instead of just
typing commands.
GUI includes components such as:
graphical icons
visual indicators
toolbars
menus
dialogue boxes
Topic 2: Computer Organization 75 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Graphic User Interface (GUI)

Toolbar is a GUI element on which buttons, icons, menus or other


input/ output elements are placed.
Menu is a GUI element that displays a list of commands that can
be chosen by the user to perform various functions.
Dialogue Box is a GUI element that is used to communicate information
to the user and allow him to respond by choosing an
option from a list of specific choices.
GUIs provide ways that allow users to understand and interface
with computer systems in a more direct and natural way
than CLIs. GUIs are described using the acronym WIMP
which stands for Windows, Icons, Menus and Pointers.
Topic 2: Computer Organization 76 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

A Dialogue Box
Topic 2: Computer Organization 77 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Command Line Interfaces (CLI)


A command line interface (CLI) is place in the computer where
commands can be typed in, like the one shown below.

Early software applications operated only with CLIs. Later software


applications took advantage of GUIs
Topic 2: Computer Organization 78 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Question

State the Pros & Cons of GUI and CLI


Topic 2: Computer Organization 79 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Command Line Interfaces (CLI)

(+) Easier to implement by a programmer


(+) Requires less memory to run
(+) Can be run on computer systems without graphical
monitor
(+) Quicker to type in a command than to use the mouse
-experienced users may find it useful
(-) Users need to remember specific commands -hard for new
users to use
Topic 2: Computer Organization 80 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Graphical User Interphases (GUI)

(+) Users do not need to remember specific commands -easier


for new users to use
(+) Users use icons to remember commands
(+) Commands are grouped in menus and toolbars
(-) More complex to implement by a programmer
(-) Requires more memory
(-) Requires a graphical monitor and a pointing device
Topic 2: Computer Organization 81 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Common Features of Applications


Since GUI elements can be found in almost every software
application, it would be a waste of time for every software
application programmer to have to go through implementing these
common GUI elements over and over again for every separate
software application.
Some common GUI elements, such as toolbars, menus, dialogue
boxes, windows etc are provided by the operating system, so that
the programmer only needs to state their existence.
Advantages:
it saves time from the programmer -you don’t have to reinvent the
wheel
improves usability since all these features are displayed n a familiar
way across all software applications
Therefore application programmers make use of abstract GUI
components in order to design graphical users interfaces more
efficiently.
Topic 2: Computer Organization 82 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Common Features of Applications

If something looks similar between various applications, such as window


and the red, yellow and green buttons, or the way menus work, it’s
probably coming from the OS.
Topic 2: Computer Organization 83 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.8: Identify common features of applications

Question

Define the terms toolbars, menus, dialogue boxes, graphical user


interface (GUI) and command line interface (CLI).
The above improve usability for a wide range of users. What are the
benefits?
Topic 2: Computer Organization 84 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

BINARY REPRESENTATION
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.
Topic 2: Computer Organization 85 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Decimal Representation

The decimal number system is a positional system that uses ten digits
(0,1,2,3,4,5,6,7,8,9) to represent any number.
The digits in the decimal number system can be used with a decimal
separator to represent a fractional part, as well as plus/minus sign (+/-)
to indicate whether the number represented is grader or less than zero.
The position of each digit within a number provides the multiplier by
which that digit is multiplied.
The multiplier is always a power of ten.
Apart from the decimal number system there exist a couple of other
useful number systems that are widely used in computer science:
Binary system (base-2)
Hexadecimal System (base-16)
Topic 2: Computer Organization 86 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Binary Representation

The Binary System is a positional system that uses two digits (0 and 1)
to represent any number.
Has 2 as its base (base-2 system).
Is the most widely used system in computer science.
Numbers represented in this system are known as binary numbers.
The position of each digit within a number determines the multiplier with
which that digit is multiplied.
The multiplier is always a power with a base of 2 and an exponent that
increases by one compared with the exponent of the position to its right
(starting with 20 ).
Topic 2: Computer Organization 87 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Bit

Computers use binary - the digits 0 and 1 - to store data.


A binary digit, or bit, is the smallest unit of data in computing.
A bit is always equal to 0 or 1.
Topic 2: Computer Organization 88 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Byte

Bits can be grouped together to make them easier to work with.


A group of 8 bits is called a byte.
Topic 2: Computer Organization 89 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Relationship between ‘normal’ numbers (denary) and binary


Topic 2: Computer Organization 90 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from binary to decimal

The base is often written in the right bottom corner, i.e.


(11011001)2 = (217)10 .
Topic 2: Computer Organization 91 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from decimal to binary (1st Method)

Assume that we wish to convert 23 to binary.


Topic 2: Computer Organization 91 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from decimal to binary (1st Method)

Assume that we wish to convert 23 to binary.


We create a table with all the powers of 2 not surpassing 23 and we put
a 1 in the first column.
16 8 4 2 1
1
Topic 2: Computer Organization 91 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from decimal to binary (1st Method)

Assume that we wish to convert 23 to binary.


We create a table with all the powers of 2 not surpassing 23 and we put
a 1 in the first column.
16 8 4 2 1
1

We calculate 23 − 16 = 7. We put a 0 to all the remaining powers


surpassing 7 and a 1 to the fist power not surpassing 7, i.e. to 4
16 8 4 2 1
1 0 1
Topic 2: Computer Organization 92 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from decimal to binary (1st Method)

We calculate 7 − 4 = 3. We now put a 1 to the first power not


surpassing 3, i.e. to 2
16 8 4 2 1
1 0 1 1
We calculate 4 − 3 = 1 and we put a 1 to the final power of 2, i.e. 1.
16 8 4 2 1
1 0 1 1 1
Topic 2: Computer Organization 93 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from decimal to binary (2nd Method)


Topic 2: Computer Organization 94 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Question

Conversions
Binary numbers → Decimal numbers
Decimal numbers → Binary numbers
Topic 2: Computer Organization 95 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Addition in Binary
Addition in binary is an analogue of the well known addition method in
decimal. All one has to know by heart are the following:

(1)2 + (1)2 = (10)2 (1)2 + (1)2 + (1)2 = (11)2 .

So, each time we have to add 1 and 1 we have 0 in the result and 1 in
the carry. Also when we add 1, 1 and 1 we have 1 in the result and 1 in
the carry.
The follwoing addition shows that x + y = z, where
x = (111)10 = (1101111)2 , y = (54)10 = (110110)2 and
z = (165)10 = (10100101)2 .
Carry 1 1 1 1 1 0
x 1 1 0 1 1 1 1
y 0 1 1 0 1 1 0
z 1 0 1 0 0 1 0 1
Topic 2: Computer Organization 96 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Binary number system and negative numbers

Two’s complement is the way most modern computers represent signed


binary numbers.
The main advantage of this representation is that addition, subtraction
and multiplication are carried out easily.

MSB
The Most Significant Bit (MSB) is the bit position in a binary number
having the greatest value. It is the leftmost bit.

LSB
The Least Significant Bit (LSB) is the bit on the right, which gives us
what we call the units value.

If LSB = 1 then the number is odd.


If LSB = 0 then the number is even.
Topic 2: Computer Organization 97 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Binary Representation and negative numbers: 2’s


complement
Topic 2: Computer Organization 98 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Question

Conversions
Positive number to its negative equivalent.
Negative number to its positive equivalent.
Topic 2: Computer Organization 99 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Fractions

In the binary system and in the decimal system the radix point is used to
separate the fractional from the whole part.
Topic 2: Computer Organization 100 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Binary Representation (Fractions)


Topic 2: Computer Organization 101 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert decimal fractions to binary


Topic 2: Computer Organization 102 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Question

Conversions
Positive decimal fraction to binary.
Binary fraction to decimal.
Topic 2: Computer Organization 103 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Hexadecimal Number System


The Hexadecimal number system . . .
. . . is a positional system that uses 16 digits
(0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) to represent any number.
. . . it has sixteen as its base.
. . . is used in computer science.

Numbers represented in this system are known as hexadecimal numbers.


Since it’s a positional system, the position of each digit within a number
provides provides the multiplier by which that is digit is multiplied.
The multiplier is always a power of sixteen and is calculated at every
position in the same way as in the binary system.
Topic 2: Computer Organization 104 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert hexadecimal numbers to decimal?


As usual :)

(A57F )16 =
(A · 163 + 5 · 162 + 7 · 161 + F · 160 )10 =
(10 · 163 + 5 · 162 + 7 · 161 + 15 · 160 )10 =
(42367)10 .
Topic 2: Computer Organization 104 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert hexadecimal numbers to decimal?


As usual :)

(A57F )16 =
(A · 163 + 5 · 162 + 7 · 161 + F · 160 )10 =
(10 · 163 + 5 · 162 + 7 · 161 + 15 · 160 )10 =
(42367)10 .

Remember

(A)16 = (10)10 = (1010)2


(B)16 = (11)10 = (1011)2
(C )16 = (12)10 = (1100)2
(D)16 = (13)10 = (1101)2
(E )16 = (14)10 = (1110)2
(F )16 = (15)10 = (1111)2
Topic 2: Computer Organization 105 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert decimal numbers to hexadecimal?


Topic 2: Computer Organization 106 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Question

Conversions
Hexadecimal numbers → Decimal numbers
Decimal numbers → Hexadecimal numbers
Topic 2: Computer Organization 107 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Hexadecimal digits and binary numbers

(0)16 = (0)10 = (0000)2


(1)16 = (1)10 = (0001)2
The correspondance to the right, (2)16 = (2)10 = (0010)2
between hexadecimal digits and (3)16 = (3)10 = (0011)2
binary numbers can be easily ver- (4)16 = (4)10 = (0100)2
ified. (5)16 = (5)10 = (0101)2
(6)16 = (6)10 = (0110)2
This correspondance is very use-
(7)16 = (7)10 = (0111)2
ful when one wants to convert
(8)16 = (8)10 = (1000)2
from binary to hexadecimal and
(9)16 = (9)10 = (1001)2
vice versa. (A)16 = (10)10 = (1010)2
Observe that since there are 16 (B)16 = (11)10 = (1011)2
different hexadecimal digits, we (C )16 = (12)10 = (1100)2
need 4 bits to represent all of (D)16 = (13)10 = (1101)2
them. (E )16 = (14)10 = (1110)2
(F )16 = (15)10 = (1111)2
Topic 2: Computer Organization 108 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from binary to hexadecimal


Let b = (1110001011)2 be a binary number that we wish to convert to
hexadecimal.
One method is to convert b to decimal first and then convert it
hexadecimal. But this takes too long . . .
A much faster method consists of the following 4 steps:
1 Moving from right to left we divide the number in 4-bit parts. So,
we have:
0011 1000 1011
2 Since b has 11 bits we add one 0 to the left.
3 Each 4-bit part of b is hexadecimal digit. It holds (1011)2 = (B)16 ,
(1000)2 = (8)16 and (0011)2 = (3)16 .
4 Thus we have:

b = (1110001011)2 = (0011 1000 1011)2 = (38B)16


Topic 2: Computer Organization 109 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

Conversions from binary to hexadecimal

Verify that the following holds:


(1100001)2 = (0110 0001)2 = (61)16
(1011100)2 = (0101 1100)2 = (5C )16
(11111)2 = (0001 1111)2 = (1F )16
Topic 2: Computer Organization 110 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.9: Define the terms bit, byte, binary, denary/decimal, hexadecimal.

How to convert from hexadecimal to binary

The conversion from hexadecimal to binary is very easy. We simply


replace each hexadecimal digit with the corresponding 4-bit binary
number.
For example we have:

(A11)16 = (1010 0001 0001)2


(F 23)16 = (1111 0010 0011)2
(BB9)16 = (1011 1011 1001)2

BE CAREFULL: Each hexadecimal digit has to be replaced by a 4-bit


binary number, even if the hexadecimal digit is smaller than 9.
Topic 2: Computer Organization 111 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

BINARY REPRESENTATION
2.1.10: Outline the way in which data is represented in the computer.
To include strings, integers, characters and colours. This should include
considering the space taken by data, for instance the relation between the
hexadecimal representation of colours and the number of colours
available.
TOK, INT Does binary represent an example of a lingua franca?
S/E, INT Comparing the number of characters needed in the Latin
alphabet with those in Arabic and Asian languages to understand the
need for Unicode.
Topic 2: Computer Organization 112 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation

Computer systems are binary systems, meaning that there are only
two possible values that they can represent -the values 0 and 1.
These two values can be represented by a single bit.
In order to represent more complex data, sequences of bits are used.
The length of binary digit sequences determines the possible number
of different representations that can be achieved.
By using n bits we can represent 2n different values.
Topic 2: Computer Organization 113 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation

In order for computer systems to communicate effectively and exchange


information, data must be consistent and similar.
That is why standard formats exist. Some of these standards are:
Integers (two’s complement method, sign-and-magnitude-number
representation)
Characters (ASCII, Unicode)
Strings (UTF-8)
Colours (RGB)
Topic 2: Computer Organization 114 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Integers

If we use 8 bits to represent an integer, there can be 256 different


representations. This would allow us to represent all the unsigned
positive integers from 0 to 255 (256 different numbers)
Negative integers can be represented using the two’s complement method
(see last section).

Sign-and-magnitude number representation


This method represents a number’s sign by allocating the MSB as a sign
bit. As we use 8 bits to represent an integer number, only 7 bits remain
for the magnitude.
MSB is set to:
0 for a positive number
1 for a negative number
Topic 2: Computer Organization 115 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Characters

The American Standard Code for Information Interchange (ASCII) is a


character encoding scheme originally based on the English alphabet.
ASCII is used to represent text in computer systems.
ASCII uses 7 bits to represent each character which means that it can
achieve 128 different representations (128 different characters).
It holds
the latin alphabet (lower case and capital letters),
the decimal numbering system (0-9)
space characters
punctuation characters like
!, ^, &, *, (, ), ;, ‘, :, \,
etc.
Topic 2: Computer Organization 116 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Characters

There are other character-encoding schemes available that allow


traditional characters to be represented.
This allows non-English characters, graphic symbols and mathematical
symbols to be represented.
The most widely known character-encoding scheme is Unicode.

Question
Why is the Unicode character encoding scheme needed?
Topic 2: Computer Organization 116 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Characters

There are other character-encoding schemes available that allow


traditional characters to be represented.
This allows non-English characters, graphic symbols and mathematical
symbols to be represented.
The most widely known character-encoding scheme is Unicode.

Question
Why is the Unicode character encoding scheme needed?

Answer
See next slides :)
Topic 2: Computer Organization 117 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Characters

For Arabic and Asian languages, there’s not enough room in a 128 set, or
even in a full 256 extended ASCII set to fit all the characters. There are
tens of thousands of Chinese characters, for example.
So, Arabic and Asian languages and indeed a whole bunch of other kinds
of languages demand more than 256 characters.
So we now have computers which work with UNICODE, which can
represent thousands of characters. UNICODE uses 16 bits per character.
In UNICODE, two bytes (16 bits) are read for each character, which
means that there are 216 = 65, 536 different combinations.
Topic 2: Computer Organization 118 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Strings

In a computer system a string is a sequence of characters.


If UTF-8 encoding system is used, each character will consists of 8 bits.
A 5 letter word will need 5 × 8 = 40 bits to be represented.

UTF-8
UTF-8 stands for Unicode Transformation Format-8-bit. It is a
variable-width character encoding used for electronic communication.
Topic 2: Computer Organization 119 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation - Colour

Monitors use pixels to display information and have a specific display


resolution, such as 1024 × 768.
A pixel is the smallest controllable element in a display of a picture
represented on the screen.
Every pixel may have only one colour at any moment.
Each colour is made up of a combination of shades of Red, Green and
Blue (RGB)
Each pixels stores information about its state and colour in a memory
location.
There are many ways to represent and store an individual colour -ex. RGB
Topic 2: Computer Organization 120 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Colours -Hexadecimal RGB

Hexadecimal RGB colour values specify the amount of red, green and blue
light that need to appear at a pixel, in order to produce a specific colour.
By combining different shades of red, green and blue a large variety of
colours can be displayed.
Each colour value is represented as a hexadecimal value of two digits that
may take up values from 00 to FF.
In order to describe a colour value in this way, a six-digit hexadecimal
number is needed, ex. 4E54F2.
The first two hexadecimal digits represent the red colour
the next two the green colour
the last two the blue colour
Topic 2: Computer Organization 121 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Examples of Colours

black: 00 00 00
red: FF 00 00
green: 00 FF 00
blue: 00 00 FF
white: FF FF FF
Topic 2: Computer Organization 122 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Colours (24 bit colour model)


Topic 2: Computer Organization 123 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Make your own color!

Go to the following link and make your own color!


http://www.cknuckles.com/rgbsliders.html
Topic 2: Computer Organization 124 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Data Representation -Colours


For every hex digit added to the colour model, there are 16 times more
colours available. It’s as simple as that :)
. . . Except that color models generally don’t go up by one hex digit, they
go up by two. And that makes sense, since the standard for working with
data is the byte and the byte is usually 8 bits, i.e. that which can be
represented by 2 hex digits, not 1.
So the most common colour models (8-bit colour, 16-bit colour, and 24-
bit colour) each go up in the number of colours possible by a factor of
256:
8-bit colour (i.e. two hex values colour) can represent 256 different
colours.
16-bit colour (i.e. four hex values colour) can represent 65, 536
(which is 256 x 256)
24-bit colour (i.e. six hex values colour) can represent 16,777,216
(which is 256 x 256 x 256)
Topic 2: Computer Organization 125 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Outline the way in which data is represented in the computer includeing
strings, integers, characters and colours.
Topic 2: Computer Organization 125 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Outline the way in which data is represented in the computer includeing
strings, integers, characters and colours.

All data is represented on a computer in a binary way. In the RAM of a


computer this binary representation is in the form of open circuits (the 1s
of the binary code) and closed circuits (the 0s of the binary code).
On hard drives, the binary representation is in the form of little regions
that have one level of magnetism or another.
Topic 2: Computer Organization 126 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question (cont’d)


Outline the way in which data is represented in the computer includeing
strings, integers, characters and colours.
Topic 2: Computer Organization 126 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question (cont’d)


Outline the way in which data is represented in the computer includeing
strings, integers, characters and colours.

So all data are translated into binary form.


Strings (i.e. sequences of characters) are encoded one character at a
time, with each character having a certain standard binary code.
The original coding system for this was called ASCII, and in it,
capital A, for example, had the standard 8 binary digit
representation of 0100 0001.
Integers are able to be stored simply as the binary equivalent of their
decimal value. So written in an integer context, the decimal number
6 would be (in an 8 bit form) 0000 0110.
For colours, it depends on the colour model, but using the common
RGB model, one byte is used for each of the red (R), green (G) and
blue (B) values. Red would then be 1111 1111 0000 0000 0000
0000. Since this model uses three bytes per pixel, it is referred to as
24-bit color.
Topic 2: Computer Organization 127 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Discuss the space taken by data, for instance the relation between the
hexadecimal representation of colours and the number of colours
available.
Topic 2: Computer Organization 127 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Discuss the space taken by data, for instance the relation between the
hexadecimal representation of colours and the number of colours
available.
The number of bits used per character or number or colour determines
the number of characters/numbers/colours which can be represented.
With all data, each extra bit (binary digit) which is used to represent
individual characters/numbers/colours doubles the number of
characters/numbers/colours available.
But since computers work with groups of 8 bits usually, we tend to think
of the influence of having an extra 8 bits used per thing. And so an extra
8 bits will double the initial number of colours etc. 8 times, or increase it
by a factor of 28 , or 256.
Topic 2: Computer Organization 128 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question (cont’d)


Discuss the space taken by data, for instance the relation between the
hexadecimal representation of colours and the number of colours
available.
Topic 2: Computer Organization 128 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question (cont’d)


Discuss the space taken by data, for instance the relation between the
hexadecimal representation of colours and the number of colours
available.
In the example of colour, we usually work with hexadecimal values, in
fact, and 8 binary digits are equivalent to two hex digits. So when a
colour model goes from 8 bit colour (for example FF) to 16 bit colour
(for example, the colour 33FF), to 24 bit colour (for example, the colour
AA33FF) - that is to say with every two addition hex digits, 162 or 256
more colours can be represented. So the number of colours available in
those models thereby is 2561 , 2562 , and 2563 , which equals
256 × 65.536, and is over 16 million.
So 24 bit colour can represent over 16 million different colours.
Topic 2: Computer Organization 129 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Compare the number of characters needed in the Latin alphabet with
those in Arabic and Asian languages to understand the need for Unicode.
Topic 2: Computer Organization 129 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Compare the number of characters needed in the Latin alphabet with
those in Arabic and Asian languages to understand the need for Unicode.

The number of characters needed in the Latin alphabet is way smaller


than those needed for Arabic and Asian languages. We only need the
basic A-Z characters 0-1 numbers and common punctuation symbols to
be able to store Latin characters as with the English language.
Arabic and Asian languages and other world languages would need
thousands and thousands of characters to be represented; think about
how Chinese dialects have tens of thousands of pictograms in their
language.
Topic 2: Computer Organization 130 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Compare the number of characters needed in the Latin alphabet with
those in Arabic and Asian languages to understand the need for Unicode.
Topic 2: Computer Organization 130 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Compare the number of characters needed in the Latin alphabet with
those in Arabic and Asian languages to understand the need for Unicode.

Remembering that computers are made to work primarily with groups of


8 bits (a byte), one group of 8 bits would be enough for Latin character
languages such as English. The number of characters which could be
represented by 8 bits is 28 , or 256. ASCII, the original computer character
set now uses exactly that, so it represents the most common 256 Latin
characters and symbols. To go up into the thousands of available
representations, it makes sense to stick with the 8 bit groupings model,
and so with 16 bits, 21 6 (65.536) different characters can be represented.
And this is exactly what the standard UNICODE code set contains.
Topic 2: Computer Organization 131 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Does binary represent an example of a lingua franca?
Topic 2: Computer Organization 131 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

IB Style Exam Question


Does binary represent an example of a lingua franca?

A lingua franca is a language which most people around the world can
understand.
So, yes, binary, in a way does represent a lingua franca, in so far as the
computers most people around the world use are able to interpret the
character codes sets ASCII and UNICODE
Topic 2: Computer Organization 132 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.10: Outline the way in which data is represented in the computer.

Chuck Norris’s Keyboard


Topic 2: Computer Organization 133 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

SIMPLE LOGIC GATES


2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR,
XOR
LINK Introduction to programming, approved notation sheet.
Topic 2: Computer Organization 134 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

Simple Logic Gates


Computer systems are made up of electrical circuits and use the binary
system to represent and store data.
In order to do so, electrical circuits have beed designed to receive one or
more binary numbers as their inputs and produce a single output, which
is another binary number.
The logical operations of these circuits are governed by the rules of
Boolean logic.
There are six Boolean operators available:
AND
OR
NOT
NAND
NOR
XOR
Topic 2: Computer Organization 135 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate AND


A AND B is also denoted by the symbol A · B
The truth table of AND is

A B A·B
0 0 0
0 1 0
1 0 0
1 1 1

Remember
A AND B is 1 if A = B = 1
A AND B is 0 if at at least one of A, B is 0
Topic 2: Computer Organization 136 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate OR
A OR B is also denoted by the symbol A + B
The truth table of OR is

A B A+B
0 0 0
0 1 1
1 0 1
1 1 1

Remember
The symbol + here does not denote addition in the usual way!
A OR B is 0 if A = B = 0
A OR B is 1 if at at least one of A, B is 1
Topic 2: Computer Organization 137 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate NOT

NOT A is also denoted as A.


The truth table of NOT is

A A
0 1
1 0

Remember
NOT A is the inverse of A.
Topic 2: Computer Organization 138 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate NAND


NAND means that we perform an AND and then a NOT. Thus
A NAND B = NOT (A AND B).
A NAND B is also denoted as A · B. The truth table of NAND is

A B A·B
0 0 1
0 1 1
1 0 1
1 1 0
Remember
A NAND B is 0 if A = B = 1
A NAND B is 1 if at at least one of A, B is 0
Topic 2: Computer Organization 139 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate NOR


NOR means that we perform an OR and then a NOT. Thus
A NOR B = NOT (A OR B).
A NOR B is also denoted as A + B. The truth table of NOR is

A B A+B
0 0 1
0 1 0
1 0 0
1 1 0
Remember
A NOR B is 1 if A = B = 0
A NOR B is 0 if at at least one of A, B is 1
Topic 2: Computer Organization 140 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

The Gate XOR


A XOR B is also denoted as A ⊕ B
The truth table of XOR is

A B A⊕B
0 0 0
0 1 1
1 0 1
1 1 0

Remember
A XOR B is 1 if A 6= B
A XOR B is 0 if A = B
Topic 2: Computer Organization 141 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

Order of Operations
NOT takes precedence,
then AND, and NAND,
and finally OR, NOR, and XOR in order from left to right.

Hence,
NOT A AND B OR C
is actually
((NOT A) AND B) OR C .

It is easier to understand the precedence if we use the alternative


notation. That is to represent

NOT A AND B OR C

as
A · B + C.
Topic 2: Computer Organization 142 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.11: Define the Boolean operators: AND, OR, NOT, NAND, NOR, XOR

In terms of programming . . .
The logic gate is on (meaning it has electricity flowing through it) when:
AND: Both input switches are closed. At the programming level,
both statements must be true for an AND statement to
evaluate to true. (a && b) in Java
OR: one input switch or the other is closed. At the
programming level, one of the 2 statements are true (if the
OR statement evaluates to true). (a||b) in Java.
NAND: At least one switch is not closed. !(a && b) in Java.
NOR: Both switches are not closed !(a||b) in Java
NOT: the input is not on (or the gate is turned off if its input
was on). Not gate stops flow of electricity if it was flowing
before, and makes electricity flow if it wasn’t. At the
programming level, the statement is not true. !(a) in Java.
XOR: one switch is closed, but not both. At the programming
level, one statement or the other can be true. (a ˆ b)
in Java.
Topic 2: Computer Organization 143 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

SIMPLE LOGIC GATES


2.1.12: Construct truth tables using the Boolean operators.
LINK: Thinking Logically
Topic 2: Computer Organization 144 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Convert sentences to Boolean expressions

1 Maria won’t go to school if it’s cold and raining or she has not done
her homework.
C=it’s cold
R = it’s raining
H = she has done her homework

C AND R OR NOT H = C · R + H
2 If the airplane is late and there and no taxis at the airport, we will
have to cancel our meeting tomorrow.
L=the airplane is late
T = there are taxis at the airport

L AND NOT T = A · T
Topic 2: Computer Organization 145 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Convert sentences to Boolean expressions

1 If it’s hot or sunny, but not both, we’ll go for a walk.


H = it’s hot
S = it’s sunny

H XOR S = H ⊕ S = H · S + S · H
2 If it rains, or it does not rain and is very cloudy, I will need an
umbrella.
R = it rains
C = is very cloudy

R OR (NOT R AND C ) = R + R · C
Topic 2: Computer Organization 146 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Constructing Truth Tables

When we have a boolean expression with n variables, the truth table will
have 2n rows.
Does this sound familiar?
Is there a connection between truth tables and representation of data?
Topic 2: Computer Organization 147 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A AND B OR C

A B C A·B A·B +C
0 0 0 0 0
0 0 1 0 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 1
1 1 1 1 1
Topic 2: Computer Organization 148 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

(A OR B) AND C

A B C A + B (A + B) · C
0 0 0 0 0
0 0 1 0 0
0 1 0 1 0
0 1 1 1 1
1 0 0 1 0
1 0 1 1 1
1 1 0 1 0
1 1 1 1 1
Topic 2: Computer Organization 149 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A OR B XOR C

A B C A + B (A + B) ⊕ C
0 0 0 0 0
0 0 1 0 1
0 1 0 1 1
0 1 1 1 0
1 0 0 1 0
1 0 1 1 1
1 1 0 1 1
1 1 1 1 0
Topic 2: Computer Organization 150 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A XOR B AND C

A B C B · C A ⊕ (B · C )
0 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 1 0 0 1
1 1 1 1 0
Topic 2: Computer Organization 151 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A AND B OR NOT C

A B C C A·B A·B +C
0 0 0 1 0 1
0 0 1 0 0 0
0 1 0 1 0 1
0 1 1 0 0 0
1 0 0 1 0 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 0 1 1
Topic 2: Computer Organization 152 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A NOR B OR C

A B C A+B A+B +C
0 0 0 1 1
0 0 1 1 1
0 1 0 0 0
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 0 0
1 1 1 0 1
Topic 2: Computer Organization 153 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

A XOR B NAND C

A B C B ·C A⊕B ·C
0 0 0 1 1
0 0 1 1 1
0 1 0 1 1
0 1 1 0 0
1 0 0 1 0
1 0 1 1 0
1 1 0 1 0
1 1 1 0 1
Topic 2: Computer Organization 154 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Construct a truth table for the following expressions

1 X = A OR B AND C
2 X = A AND B AND C
3 X = (A OR B) AND C
4 X = (NOT A OR B) AND NOT C
5 X = A XOR B OR C
6 X = (A XOR B) AND C
7 F =A·B ·C +A·B ·C +A·B ·C
8 F =A·B ·C +A·B ·C +A·B ·C +A·B ·C
Topic 2: Computer Organization 155 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Convert sentences to Boolean expressions

A chemical factory is equipped with three safety mechanisms. These


safety mechanisms are used to warn the local authorities for a potential
accident. If safety mechanism A or safety mechanism B are in OFF
position and if safety mechanism C is in the ON position, then there is no
reason to worry about an upcoming accident.
Construct a truth table for this scenario.
Topic 2: Computer Organization 156 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.12: Construct truth tables using the Boolean operators.

Truth tables / Boolean Operators

An alarm system has three inputs Q, W and R, and one output I. When
signal at Q is false then the output at I is the same as input signal R.
When the signal at Q is true then the output at I is the same as input
signal W.
Construct a truth table for this scenario.
Topic 2: Computer Organization 157 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

SIMPLE LOGIC GATES


2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR,
and XOR gates.
The gate should be written as a circle with the name of the gate inside it.
LINK: Thinking logically, connecting computational thinking and program
design, introduction to programming
Topic 2: Computer Organization 158 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

Logic Gates

A variety of electrical circuits is used to build a computer system.


Electrical circuits require binary inputs and produce a single binary
output.
Electrical circuits are constructed using the Boolean operators and
are implemented by logic gates.
A logic gate is a real electrical circuit that simulated a specific
Boolean operator.
There are six logic gates, as there are six Boolean operators.
Topic 2: Computer Organization 159 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

Logic Gates

All logic gates have a single output on the right.


NOT gate has a single input on the left, whereas all other gates have two
inputs, indicated by the two lines on the left of the cycle.
Topic 2: Computer Organization 160 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

A AND B OR NOT B
Topic 2: Computer Organization 161 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

(NOT A OR NOT B) XOR (C XOR D)


Topic 2: Computer Organization 162 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

Exercises

Create a logic diagram for the following statements:


1 Maria won’t go to school if it’s cold and raining or she has not done
her homework.
2 If the airplane is late and there are no taxis at the airport, we will
have to cancel our meeting tomorrow.
3 If it’s hot or sunny, but not both, we’ll go for a walk.
4 If it rains, or it does not rain and is very cloudy, I will need an
umbrella.
Topic 2: Computer Organization 163 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

Exercises

Draw the logic diagram for the following expressions:


1 (A OR B) AND (C XOR D)
2 (A AND B) OR (C AND NOT A)
3 (A AND NOT B) OR NOT C
4 (A OR NOT B) AND NOT (C XOR D)
5 (A AND B) OR (NOT A XOR B)
Topic 2: Computer Organization 164 / 164
2.1: Computer Organization – Operating systems and application systems
2.1.13: Construct a logic diagram using AND, OR, NOT, NAND, NOR, and XOR gates.

Resources

Dimitriou Kostas, Hatzitaskos Markos, Core Computer Science for


the IB Diploma Program, Express Publishing, 2015
shorturl.at/iyXY9
shorturl.at/hIX46
shorturl.at/giI23
https://bit.ly/3oGnDhx
https://bit.ly/3ebzAHs
https://bit.ly/2HKrMAw
https://bit.ly/37MUyLw

You might also like