You are on page 1of 72

2019/20 Semester 2

IT1001 Introduction to Computing

Lecture 2
Computer Hardware
(Chapters 2 and 3)

Hyelim Oh, PhD


hyelim.oh@nus.edu.sg | 6516 6732 | COM2-0415

Department of Information Systems & Analytics


NUS School of Computing
Outline
• Information Representation in Hardware
• Binary Number System
• Components of computer hardware
• “Onboard devices”
• Motherboard, Central Processing Unit (CPU), Memory,
etc
• Peripherals
• Storage devices
• Input devices
• Output devices

2
History of Computer Hardware
 Moore’s Law and microprocessing power
 Computing power doubles every 18 months:
 The number of transistors in a dense integrated circuit doubles
approximately every two years.

3
Information Representation
• Computers can digest information only if it
has been broken into bits
• Bit, or a binary digit
• Smallest unit of information
• Can have one of two values: 0 or 1
• High and low electrical charges

High (On)
Low (Off)

4
Information Representation
• Number system: a way to represent numbers
• Decimal (base 10)
• 10 digits: 0, 1, 2, 3, …, 9

• Binary (base 2)
• 2 digits: 0, 1

• Octal (base 8)
• 8 digits: 0, 1, 2, 3, …, 7

• Hexadecimal (base 16)


• 16 digits: 0, 1, 2, 3, …, 9, A, B, C, …, F

5
Number System
Number System Base 3rd Position 2nd Position 1st Position

To determine the value of each position,


we take the Nth -1 power of the respective
base, where N is the position of the
numerical symbol
Decimal 10 102 101 100
Individual value 100 10 1
Binary 2 22 21 20
Individual value 4 2 1

6
Number System
• Idea: Use the position and the numerical
value to represent a number
• Consider Decimal (Base 10) case

Position 102 101 100

7 8 6

6 x 100 =6x1 = 6

8 x 101 = 8 x 10 = 80

7 x 102 = 7 x 100 = 700


786
7
Binary Number System

• Binary (Base 2) case

Position 22 21 20

1 0 1

1 x 20 =1x1 =1

0 x 21 =0x2 = 0

1 x 22 =1x4 =4
510

8
Binary vs Decimal
• Binary (Base 2) case

Decimal Binary Decimal Binary


0 0 10 1010
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011

9
Converting Binary to Decimal

• Binary to Decimal
• Examples: 101011012
1 0 1 0 1 1 0 1

27 26 25 24 23 22 21 20

128 64 32 16 8 4 2 1

128 + 32 + 8 + 4 + 1 = 17310

10
Converting Decimal to Binary
• Decimal to Binary
• 2 methods
• Comparison with descending powers of 2 and
subtraction
• Division by 2 with remainder

11
Converting Decimal to Binary
• Decimal to Binary
• Example: 17310
• Comparison with descending powers of 2 and
subtraction

position 9 8 7 6 5 4 3 2 1
28 27 26 25 24 23 22 21 20
256 128 64 32 16 8 4 2 1

173 – 128 = 45 45 – 32 = 13 13 – 8 = 5 5 – 4 = 1 1–1=0

1 0 1 0 1 1 0 1

12
Converting Decimal to Binary
• Decimal to Binary
• Example: 17310
• Division by 2 with remainder

2) 173 1
2) 86 0 173 / 2 = 86 with remainder 1
2) 43 1 86 / 2 = 43 with remainder 0
2) 21 1
2) 10 0 Read off the binary number
2) 5 1 starting from the bottom
2) 2 0
2) 1 1
Make sure you only stop
0 when the quotient is 0

13
Bits as Codes
• Coding Scheme
• Combination of bits (0 and 1) to represent information
(numbers, letter, special characters etc)
• E.g.
• ASCII (American Standard Code for Information
Interchange)
• Use 8 bits
• 28 = 256 characters
• 256 characters including special
symbols etc
• ‘A’ and ‘a’ treated as different
characters
• Idea: Representing a character
with a number

14
https://www.branah.com/ascii-converter
ASCII Activity

01000110 01010101 01001110

15 70 85 78
Bits as Codes
• ASCII only allows for 256 characters
• How do we represent non-English characters
then? E.g. Chinese characters?
• Unicode (UTF-8, UTF-16, UTF-32)
• Coding scheme that supports more than 100,000
unique characters

16
Bits as Instruction in Programs
• Fundamentally, computer programs are just
collections/string of bits

• 1010101111
1011101111
1010101011
1110111111
1010101101

17
Bits as Codes
• What does it mean?

01011010

18
A Bit about Bits

• What does a bit combination


such as 01011010 mean to
the computer?
• It depends on context and
convention
• It can be
• A number
• A character
• A program instruction
• Or almost anything else

19
Byte

• A logical unit of 8 bits


• 1 byte (B) = 8 bits (b)
• Can represent 256 different messages,
why?

20
Byte

• Computer memory/storage are often measured


in bytes

Note: 1 Kilobyte is not 1000 bytes!

21
Computer Hardware
• Four functional specialization
• Receive input
• Input devices
• Process information
• Microprocessor (CPU)
• Produce output
• Output devices
• Store information
• Memory and storage devices

22
“Onboard Devices”

Computer
Hardware

“Onboard
Peripherals
Devices”

Central
Motherboar Buses, Ports Input Output
Processing Memory Storage
d and Slots devices devices
Unit (CPU)

23
Motherboard
• Main circuit board
• Holds various
hardware
components
• CPU, memory, ports,
slots
• Information (bits)
travels between
components on the
motherboard through
groups of wires called
(internal) buses

24
“Onboard Devices”

Computer
Hardware

“Onboard
Peripherals
Devices”

Central
Motherboar Buses, Ports Input Output
Processing Memory Storage
d and Slots devices devices
Unit (CPU)

25
Central Processing Unit (CPU)

• The CPU
• “Brain” of computer
• Performs the transformations
of input into output
• Interprets and executes the
instructions in each program
• Performs arithmetic and logical
data manipulations
• Communicates with all the other
parts of the computer system
indirectly through memory

26
The CPU
• Main Components
• Arithmetic and logic
Unit (ALU)
• Decode Unit
• Control Unit (CU)
• Bus Interface Unit
• Cache

27
The CPU

• Arithmetic and Logic


Unit (ALU)
• In charge of
performing arithmetic
operations
• Registers are present
in the ALU for storing
the operands
• E.g.,
Add, subtract, etc

28
The CPU

• Decode Unit
• Reads the instructions
(from the memory)
and translate them to
the right form
• E.g.,
Determine
• Operations
• Operands

29
The CPU
• Control Unit (CU)
• Receive the decoded
instructions and provide
additional information
for the ALU or other
components
• E.g.,
CU tells ALU what
operation to do
(Add or sub etc)

30
The CPU

• Bus Interface Unit


• In charge of
reading/writing to the
Memory (RAM)

31
The CPU

• Caches
• Different components
often contain caches
Reading from/storing to
• E.g., Prefetch unit to register is much faster than
speed up the processing RAM
• Why?
• There are differences in
the speed of different
“storage” components
(e.g., Cache, RAM,
register, hard disk)

32
Indicators of a CPU

• Clock speed
• Speed of the internal clock
• The timing device that sets the pace for executing
instructions and produces electrical pulses to
synchronize the computer’s operations
• Clock cycles per second, measured in gigahertz
(GHz): a billion cycle per second.
• GHz: Determines how fast instructions are
executed

• Word size
• Numbers of bits the CPU can process at one time
• Typically 32-bit, or 64-bit

33
Indicators of a CPU

• Cache size
• Cache is used to reduce CPUs that run simultaneously
memory access time by CPU on a single chip
• Faster than RAM
• L1(Level 1), L2, L3
• L1 size much smaller than L2
or L3
(32KB, 512KB-4MB)
• Front Side Bus speed
• Design & Architecture
• Number of Cores
• Control unit and ALU

34
The CPU

Benchmark Tests

35
“Onboard Devices”

Computer
Hardware

“Onboard
Peripherals
Devices”

Central
Motherboar Buses, Ports Input Output
Processing Memory Storage
d and Slots devices devices
Unit (CPU)

36
Buses

• Roadway for data communication


between different components
• Speed
• Key indicator for computer performance
• More data a bus can handle=> faster
processing
• 32-bit bus or 64-bit bus

37
Expansion slots
• Expansion slots
• Users can customize
their computers by
inserting special-purpose
circuit boards (called
expansion cards) in Graphics Card Sound Card
these slots
• Expansion cards
• E.g., graphic card,
network interface card,
TV card, sound card, etc
Network Interface Controller (NIC) Card

38
Ports
• Sockets on the outside of CPU chassis for
connecting external devices
• E.g., keyboard, mouse, monitor, printer

S-Video

Onboard Ports

Ports from
expansion
cards DVI

39
“Onboard Devices”

Computer
Hardware

“Onboard
Peripherals
Devices”

Central
Motherboar Buses, Ports Input Output
Processing Memory Storage
d and Slots devices devices
Unit (CPU)

40
Memory
• Read-Only Memory (ROM)
• Non-volatile
• Information is stored permanently on a chip
• Available whenever the computer is operating
• Cannot be change, except by replacing the chip
• Stores start-up instructions and other critical
information
• Firmware
• When a program is immortalized on a silicon ship

41
Memory
• Random Access Memory (RAM)
• Random Access
• Data can be stored and retrieved at any location on the
memory chip
• Retrieves information fast, speed is lower than
cache/register but faster than secondary storage
• Holds data and programs that are currently
running in the computer
• Volatile Temporary
Memory
• How memory works

43
Information Storage Devices

Computer
Hardware

“Onboard
Peripherals
Devices”

Central
Motherboar Buses, Ports Input Output
Processing Memory Storage
d and Slots devices devices
Unit (CPU)

44
Memory
• Primary storage
• “working area” for storing data for manipulation
• Directly connected to the CPU
• CPU communicates with all other parts of the computer
system indirectly through memory
• At the core of a computer together with CPU
• E.g., RAM, ROM, register, cache

45
Storage Devices
• Secondary storage
• Non-volatile (permanent), services as long-term
repositories for data
• E.g., Hard disk, CD, DVD, tapes, flash memory

46
2019/20 Semester 1

IT1001 Introduction to Computing

Lecture 2
Computer Software
(Chapters 4 and 5)
Hyelim Oh, PhD
hyelim.oh@nus.edu.sg | 6516 6732 | COM2-0415

Department of Information Systems & Analytics


NUS School of Computing
Outline
• Software basics
• Why software?
• Software languages
• Major categories of software
• Operating system
• Utility software
• Application software

48
Hardware vs. Software
• Computer hardware
• Physical components for computational operations
• Deals directly with 0s and 1s
• Software
• Sets of computer instructions designed to solve problems
• Provides rules of processing information

49
Software Languages
• How do we write software? 000000 00001 00010 00110 00000
100000
000000 00001 00010 00110 00000
• Machine language 100001
• Numeric representations of 1s and 0s to represent basic
computer operations
Or
• High level language
• Fall somewhere between natural human languages and
precise machine languages
• E.g., C, Java, C++, C#, Python

main() { 000000 00001 00010 00110 00000


printf("hello, world\n"); 100000
} 000000 00001 00010 00110 00000
100001

50
Software Languages
• For a computer to understand a program
written in high-level language
• A translator program is needed to convert the
English-like instructions to the 0s and 1s of
machine language
• Compiler
• The most common type of translator program
• Compiles a complete translation of the program
before it runs for the first time
• The compiled program can run again and again
• When the program need to be recompiled?
• Instructions need to be changed

51
Software Languages
 Executable file
 A computer program that is carried out step-by-
step within the microprocessor
 Name extension
 .exe
 .app
 .dmg?

52
Major Categories of Software

Software

System Application
software software

Operating Utility Word Web


Spreadsheet ...
System (OS) Software Processing browsing

53
Major Categories of Software

• System software
• Manage system tasks
and resources
• Two types
• Operating systems (OS)
• Coordinates functions of
hardware (e.g., I/O)
• Supports application
software
• Utility software
• For maintenance
purposes (e.g., check
for virus)

54
Major Categories of Software

• Application software
• Adds capabilities to the computer
• Serves as productivity tools to help computer
users solve problems
• Many different types
• e.g., word processing, presentation, etc

55
Major Categories of Software

Software

System Application
software software

Operating Utility Word Web


Spreadsheet ...
System (OS) Software Processing browsing

56
Operating System (OS)
• Keeps computer hardware running efficiently
and makes the process of communication with
the hardware easier
• Functions
• Maintains the file systems that keep track of the
location of all programs and data files
• Manages resources (e.g., hardware devices,
memory) and application software
• Handles information from input and output devices
(e.g., communicates with device drive software)
• Provides user interface (as a means of
communicating with user)

57
Operating System (OS)
 In a nutshell
 Monitor and controls all I/O processing activities
within a computer system
 Manages all hardware & application software
 Where the OS lives?
 ROM?
 RAM?
 Hard disk?

58
Operating System (OS)

When turn on the computer, the CPU automatically


begins executing instructions stored in ROM. These
instructions help the system boot, and the OS is loaded
from the disk into part of the system’s memory
59
Operating System (OS)

Using the mouse, you “ask” the operating system to load a


word processing application program into memory so it
can run.
60
Operating System (OS)

The loaded application occupies a portion of memory,


leaving that much less for other programs and data.
OS remains in memory, helping to display on-screen
61 menus, communicating with I/O devices, etc
Operating System (OS)

Save the data back to disk, OS will handles


the communication between the CPU and
disk drive.
62
Operating System (OS)
• Multi-tasking
• Multiple programs/processes seems to be able to
run at “the same time”
• In actual fact, the number of CPU determines how
many process can be ran at any one time
• If the “time slices” are really small enough=> gives the
impression that applications are running at the same
time
• The OS must do task scheduling, allocating blocks
of CPU time to the processes to enable them to
make progress
MS Word
Firefox

time

63
Operating System (OS)
 Task manager (Windows)

64
Operating System (OS)
 Activity Monitor (Mac)

65
Operating System (OS)
• Multiuser
• The OS responsible for authentication and
authorization
• Authentication
• Determining that users are who they claim to be
• E.g., requiring login name and password
• E.g., fingerprint
• Authorization
• Ensuring that users have permission to perform a particular
action
• E,g., allowing only those with administrative privileges to
install/uninstall application programs

66
Operating System (OS)
• Interfaces
• From character-based interface (access through
Windows – “Command Prompt”)
• To graphical user interface (GUI)

67
Operating System (OS)
• Interfaces
• 1984 Mac GUI

68
Operating System (OS)
• Types
• Desktop OS
• E.g., Windows, Mac OS
• Mobile OS
• E.g., Android, IOS
• Server OS
• Linux, UNIX, Windows Server, mac OS server
• Multi-user OS

69
Virtual Machines
 A virtual machine allows one computer to
simulate the hardware and software of
another.
 E,g., Run Windows on a Mac
 Popular virtual machine software
 Also called hypervisor
 E.g., VMware Workstation, VirtualBox
 Benefits:
 Reduces hardware and power expenditures

70
 Running Windows on Mac

71
Tutorials
 Two flavors
 1) Lecture review
 2) Lab exercises
 Web authoring
 Software: Dreamweaver
 Descriptive analytics using Excel
 Intro to programming using Python
 Software: Anaconda python, PyCharm

You might also like