1 / 27

# ECS15: Introduction to Computers - PowerPoint PPT Presentation

ECS15: Introduction to Computers. fall 2010 S. Felix Wu Midterm review. Number representation. We are used to counting in base 10:. 1000. 100. 10. 1. 10 3 10 2 10 1 10 0. ….. thousands hundreds tens units. Example:. digits. 1. 7. 3. 2.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' ECS15: Introduction to Computers' - fiona-english

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### ECS15:Introduction to Computers

fall 2010

S. Felix Wu

Midterm review

We are used to counting in base 10:

1000

100

10

1

103 102 101 100

….. thousands hundreds tens units

Example:

digits

1

7

3

2

1000

100

10

1

1x1000+7x100+3x10+2x1 = 1732

Computers use a different system: base 2:

1024 512 256 128 64 32 16 8 4 2 1

210 29 28 27 26 25 24 23 22 21 20

Example:

bits

1 1 0 1 1 0 0 0 1 0 0

1024 512 256 128 64 32 16 8 4 2 1

1x1024+1x512+0x256+1x128+1x64+0x32+ 0x16+ 0x8 + 1x4 + 0x2 + 0x1 = 1732

While base 10 and base 2 are the most common bases used

to represent numbers, others are also possible:

base 16 is another popular one, corresponding to

256 16 1

162 161 160

The “digits” are: 0 1 2 3 4 5 6 7 8 9 A B C D E F

Example:

2 A F

256 16 1

2x256 + 10*16 + 15x1 = 687

American Standard Code for Information Interchange

So far, we have seen how computers can handle numbers.

The ASCII code was designed for that: it assigns a number to

each character:

A-Z: 65-90

a-z: 97-122

0-9: 48-57

Conjunction:

The conjunction of two propositions p and q is the proposition

p q (read “p and q”) that is true if and only if both p and q are

true.

Truth table:

The CPU cycles through a series of operations or instructions,

organized in a cycle, the Fetch/Execute cycle:

Instruction Fetch (IF)

Instruction Decode (DP)

Data Fetch (DF)

Instruction Execute (IE)

Result Return

Fetch instruction from memory position 2200:

Add numbers in memory positions 884 and 428, and

store results at position 800

Decode instruction:

Defines operation (+), and set memory pointers in ALU

Hardware

BIOS

Operating System

Software

Programming languages

• BIOS refers to the firmware code usually stored on the PROM, EPROM or flash drive that is run by a computer when first powered on.

• BIOS performs three major tasks:

• First, the Power On Self Tests (POST) are conducted. These tests verify that the hardware system is operating correctly.

• - Second, the BIOS initiates the different hardware component of the system, scanning their own ROM or PROM.

• - Third, the BIOS initiate the boot process. The BIOS looks for boot information that is contained in file called the master boot record (MBR) at the first sector on the disk. Once an acceptable boot record is found the operating system is loaded which takes over control of the computer.

Hardware

BIOS

Operating System

Software

Programming languages

Definition found on Wikipedia:

“An operating system (OS) is the software that manages the sharing of the resources of a computer and provides programmers with an interface used to access those resources”

Most common operating systems:

- DOS (desktops, laptops)

- Unix and variants, including Linux (servers)

- MacOS

• Operating systems can be classified as follows:

• multi-user : Allows two or more users to run programs at the same time.

• -multiprocessing : Supports running a program on more than one CPU.

• -multitasking : Allows more than one program to run concurrently.

• multithreading : Allows different parts of a single program to run concurrently.

Memory management:

Current computers organize memory resources hierarchically,

from registers, CPU cache, RAM and disks.

The virtual memory manager coordinates the use of these resources by tracking which one is available, which is to be allocated or deallocated and how to move data between them.

If running processes require significantly more RAM than is available, the system may start thrashing.

Most operating systems come with an application that provides a user interface for managing the operating system, such as a command line interpreter or graphical user interface (GUI).

Operating systems provide a software platform on top of which other programs, called application programs, can run.

Your choice of operating system determines the applications you can run.

Assignment

X += 5

X:

a value

Memory box

&

Assignment

X  X+5

X:

old value + 5

X .

X:

a value

Memory box

&

Assignment

X  X+5

X:

old value + 5

F

T

for <integer_variable> in range (start, end, skip):

<statement>

<statement> (optional)

<other statements>

F

T

“access

denied”

“access

granted”

end

• Input three numbers

• Print these numbers in the ascending order

true: X <= Z?

true: // print X

Y <= Z?

true: print XYZ

false: print XZY

false: print ZXY

false: Y <= Z?

true: // print Y

X <= Z?

true: print YXZ

false: print YZX

false: print ZYX

Input X

Input Y

Input Z

XYZ XZY YXZ YZX ZXY ZYX