What is a Computer ? Computers are Electronic Machines that process (performs calculation and manipulation) Data under the control of Set of Instructions.

Post on 16-Jan-2016

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

What is a Computer ?

• Computers are Electronic Machines

that process (performs calculation and manipulation) Data

under the control of Set of Instructions.

+ - storecompare

1234567890ABCDEF….!@#$%^&

If (x>0) y=x+5;cout<<“Hello”;

What is a Computer ?

• Computers are Hardware devices that process Data

under the control of Computer Program or Software.

What is a Computer ?

• Computer system:

– hardware + software

• Hardware:

– the physical components

• Software:

– the instructions that tell the hardware what to do

Computing Systems

Computers have two kinds of components:

• Hardware, consisting of its physical devices (CPU, memory, bus, storage devices, ...)

• Software, consisting of the programs it has (Operating system, applications, utilities, ...)

Why Computers ?

• Computers can do many different jobs because they are programmable, we are not.

• They perform computations at million times faster than us.

• They perform computations correctly every single time compared to us.

Computer Hardware

• All computer systems consist of similar hardware components.

• Hardware Components can be viewed as:– Logical Components (Generic)– Physical Components (Actual Devices)

Logical Hardware Components

• The CPU

• Main Memory or Primary Storage

• Auxiliary Memory or Secondary Storage– works as Input/Output device as well

• Input Devices

• Output Devices

Logical Hardware Components

Arithmetic Logic Unit

Control Unit

Auxiliary StorageDevices Main Memory ( RAM & ROM )

Central Processing Unit ( CPU ) Input Devices

Output Devices

Peripherals

Data

Main Unit

Registers

Logical Hardware Components

• Processor (CPU)– Central Processing Unit– Interprets and executes the instructions

• Main Memory– RAM, Temporarily holds data and

instructions– ROM, Permanently holds data and

instructions

• Auxiliary Memory– Permanently holds data and instructions

• Input device(s)– mouse, keyboard, etc.

• Output device(s)– video display, printer, etc.

Main Memory(such as RAM)

Processor(CPU)

Input Devices(such as keyboard

and mouse)

Output Devices(such as video

display or printer)

Auxiliary Memory(such as floppy &

hard drive)

Physical Hardware Components• Keyboard, Mouse

– Input devices• Peripherals

• Monitor– Output device

• Peripherals• Chassis or Box

– CPU– RAM

• Main memory– Floppy & Hard disk drives

• Auxiliary memory– I/O connectors

• to connect other Peripherals

Central Processing Unit

• has 3 components to execute program instructions

– Arithmetic/Logic Unit performs arithmetic operations, and makes logical comparisons.

– Control Unit controls the order in which your program instructions are executed.

– Registers holds data, memory inside the processor.

CPU

Central Processing Unit (CPU):– the “brain” of the machine? Action_Centre– performs arithmetic and logical ML statements– measurement: speed in MHz ( megahertz, millions of

clock-ticks per second ) or MIPS– examples:

· Intel Pentium, · AMD K6, · Motorola PowerPC, · Sun SPARC,

Two Kinds of Memory

• Main– working area, similar to our desk

– temporarily stores program and data (while program is executing)

• Auxiliary– permanent (more or less) , similar to our bookshelf

– saves program and results

– includes floppy & hard disk drives, CDs, tape, etc.

Main Memory Unit

• is an ordered sequence of storage cells, each capable of holding a piece of information

• each cell has its own unique address

• the information held can be input data, computed values, or your program instructions.

RAM

Random Access Memory (RAM)– “main” memory, which is fast, but volatile...– analogous to a person’s short-term memory.– many tiny “on-off” switches: for convenience

• “on” is represented by 1, “off” by 0.

– each switch is called a binary digit, or bit.• 8 bits is called a byte.

• 210 bytes =1024 bytes is called a kilobyte (1K)

• 220 bytes is called a megabyte (1M).

Memory Organization

• two circuit states of digital electronics correspond to 0 and 1

• bit (binary digit) refers to a single 0 or 1. • Bit patterns represent both the computer instructions

and computer data

• 1 byte = 8 bits

• 1 KB = 1024 bytes

• 1 MB = 1024 x 1024 = 1,048,576 bytes

Main Memory Organization

• Bit = one binary digit – Binary digit can have only

one of two values, 0 or 1• Byte = 8 bits

– “Byte is Addressable”– Main memory is a list of

numbered locations that contain one byte of data in each location

– Number of bytes per data item may vary

Address Data Byte

3021 1111 0000 Item 1: 2 bytesstored

3022 1100 1100

3023 1010 1010 Item 2: 1 bytestored

3024 1100 1110 Item 3: 3 bytesstored

3025 0011 0001

3026 1110 0001

3027 0110 0011 Item 4: 2 bytesstored

3028 1010 0010

3029 … Next Item, etc.

How Many Possible Digits?

• binary (base 2) numbers use 2 digits: JUST 0 and 1

• decimal (base 10) numbers use 10 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F

• hexadecimal (base 16) numbers use 16 digits: 0 1 2 3 4 5 6 7 8 9 A B C D E F

Disks

Secondary Memory (Disk):– Stable storage using magnetic or optical media.– Analogous to a person’s long-term memory.– Slower to access than RAM.– Examples:

• floppy disk (measured in kilobytes)

• hard disk (measured in gigabytes (230 bytes))

• CD-ROM (measured in megabytes), ...

Auxiliary Storage Organization

Peripherals

• are input, output, or auxiliary storage devices attached to a computer

– Input Devices include keyboard and mouse, microphone, camera.

– Output Devices include printers, video display, LCD screens, speakers.

– Auxiliary Storage Devices include disk drives, CD-ROM and DVD-ROM drives.

The Bus

– Connects CPU to other hardware devices.– Analogous to a person’s spinal cord.– Speed measured in megahertz (like the CPU),

but typically much slower than the CPU...– The bottleneck in most of today’s PCs.

Cache

While accessing RAM is faster than accessing secondary memory, it is still quite slow, relative to the rate at which the CPU runs.

To circumvent this problem, most systems add a fast cache memory to the CPU, to store recently used instructions and data.

(Assumption: Since such instructions/data were needed recently, they will be needed again in the near future.)

Connected Together

Putting the pieces together:

CPU

Bus

MainMemory

SecondaryMemorycache

Programs are stored (long-term) in secondary memory, and loaded into main memory to run, from which the CPU retrieves and executes their statements.

Software

• Operating Systems– DOS, MS- Windows(3.x, 95, 98, NT), MacOS,

UNIX, etc.

• Application Software– word-processor/editor– web browser– compiler or assembler– etc.

OS

The OS acts as the “manager” of the system, making sure that each hardware device interacts smoothly with the others.

It also provides the interface by which the user interacts with the computer, and awaits user input if no application is running.

Examples: MacOS, Windows-95, Windows-NT, UNIX, Linux, Solaris, ...

OS

The operating system (OS) is loaded from secondary storage into main memory when the computer is turned on, and remains in memory until the computer is turned off.

RAM DiskCPUCache

Bus

OS

Applications

Applications are non-OS programs that perform some useful task, including word processors, spreadsheets, databases, web browsers, C++ compilers, ...

Example C++ compilers/environments: – CodeWarrior (MacOS, Win95, WinNT, Solaris)

– GNU C++ (UNIX, Linux)

– Turbo/Borland C++ (Win95, WinNT)

– Visual C++ (Win95, WinNT)

Putting it all together

Programs and applications that are not running are stored on disk.

RAM DiskCPUCache

Bus

OS App

Putting it all together

When you launch a program, the OS controls the CPU and loads the program from disk to RAM.

RAM DiskCPUCache

Bus

OS AppAppOS

Putting it all together

The OS then relinquishes the CPU to the program, which begins to run.

RAM DiskCPUCache

Bus

OS AppAppApp

The Fetch-Decode-Execute Cycle

As the program runs, it repeatedly fetches the next instruction (from memory/cache), executes it, and stores any results back to memory.

RAM DiskCPUCache

Bus

OS AppApp

App

That’s all a computer does: fetch-execute-store, millions of times each second!

Summary

A computer has two kinds of components:

– Hardware: its CPU, RAM, Disk(s), …

– Software, its OS, Applications, and User Programs.

top related