Ecs15 introduction to computers
This presentation is the property of its rightful owner.
Sponsored Links
1 / 27

ECS15: Introduction to Computers PowerPoint PPT Presentation


  • 87 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

ECS15: Introduction to Computers

An Image/Link below is provided (as is) to download presentation

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

ECS15:Introduction to Computers

fall 2010

S. Felix Wu

Midterm review


Number representation

Number representation

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


Number representation1

Number representation

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


Ecs15 introduction to computers

Hexadecimal numbers

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

hexadecimal numbers

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


Ecs15 introduction to computers

ASCII

American Standard Code for Information Interchange

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

What about letters / characters?

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


Ecs15 introduction to computers

Logic: compound propositions

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:


Ecs15 introduction to computers

The not-and (NAND) gate


Ecs15 introduction to computers

The AND gate


Ecs15 introduction to computers

The OR gate


Ecs15 introduction to computers

The Fetch/Execute Cycle

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


Ecs15 introduction to computers

Step 1: Instruction Fetch

Fetch instruction from memory position 2200:

Add numbers in memory positions 884 and 428, and

store results at position 800


Ecs15 introduction to computers

Step 2: Instruction Decode

Decode instruction:

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


Ecs15 introduction to computers

Computer Layers

Hardware

BIOS

Operating System

Software

Programming languages


Ecs15 introduction to computers

BIOS: Basic Input/Output Layer

  • 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.


Ecs15 introduction to computers

Computer Layers

Hardware

BIOS

Operating System

Software

Programming languages


Ecs15 introduction to computers

The operating system


Ecs15 introduction to computers

The operating system

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


Ecs15 introduction to computers

The operating system

  • 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.


Ecs15 introduction to computers

The operating system

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.


Ecs15 introduction to computers

The operating system

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.


Ecs15 introduction to computers

X = X + 5

Assignment

X += 5

X:

a value

Memory box

&

Assignment

X  X+5

X:

old value + 5


Ecs15 introduction to computers

ADD X, X, const(5)

Add 848, 440, 820

ADD X, X, const(5)

X .

X:

a value

Memory box

&

Assignment

X  X+5

X:

old value + 5


Ecs15 introduction to computers

Index Control

F

T

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

<statement>

<statement> (optional)

<other statements>


Ecs15 introduction to computers

Raw_input

Password 

Password == “secret”

F

T

“access

denied”

“access

granted”

end


Problem solving

Problem solving

  • Input three numbers

  • Print these numbers in the ascending order


Ecs15 introduction to computers

X <= Y?

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


  • Login