Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Chapter 1: Data Storage.
Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn...
-
date post
19-Dec-2015 -
Category
Documents
-
view
265 -
download
5
Transcript of Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn...
![Page 1: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/1.jpg)
Introduction to Computer Science
Fall 2004, 劉震昌
Ref: Computer Science: an overviewJ. Glenn Brookshear
![Page 2: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/2.jpg)
Outline Concept of computers
Computer software: algorithm Computer hardware: algorithmic machine Turing Machine
5 major components of computers
![Page 3: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/3.jpg)
Computers ?
Hardware
Software
SoftwarePackage(Executable)
SourceProgram
#include <stdio.h>main(){…}
compile
Computers are machines to execute Algorithm
![Page 4: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/4.jpg)
Hierarchy of computer
Program languageEx. C, Java,…
Readable by human
Machine language(instruction set)
Ex. Executable fileReadable by machine
Computer hardware
![Page 5: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/5.jpg)
Computer software: Algorithm 演算法
Computers are machines to execute Algorithm
Fundamental concept of CS Definition of algorithm (1): a set of steps
that defines how a task is performed Definition of algorithm (2): an ordered
set of unambiguous, executable steps that defines a terminating activity
![Page 6: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/6.jpg)
![Page 7: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/7.jpg)
Albert
Baker
Algorithm: example Sorting( 排序 ): sort the cards from top to d
own in alphabetical order
Charlie
![Page 8: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/8.jpg)
Algorithm: sort (cont.)Albert
BakerCharlie
input
Albert
BakerCharlie
AfterStep 1
Charlie
BakerAlbert
AfterStep 2
Charlie
AlbertBaker
AfterStep 3
![Page 9: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/9.jpg)
Write an algorithm: sort
Input: 3 cards in arbitrary order1. Compare the names on the first and second cards. Exchange them if they are out of order.2. Compare the names on the second and third cards. Exchange them if they are out of order.3. Compare the names on the first and second cards. Exchange them if they are out of order.
Output: 3 cards in alphabetical order
![Page 10: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/10.jpg)
Properties of algorithms
Goal: find a single set of directions that describe how any problem could be solved
Algorithm = Programs within computers
The intelligence required to perform the task is encoded in the algorithm
![Page 11: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/11.jpg)
Mini break NCNU webmail system http://webmail.ncnu.edu.tw/
The web-based email system 計算中心 FAQ http://
www.cc.ncnu.edu.tw/net/ccfaq/FAQ.htm Send an email to me with subject : Lab
2 學號
![Page 12: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/12.jpg)
How to devise an algorithm?
1945 Polya, “How to solve it” Phase 1: Understand the problem Phase 2: Devise a plan for solving the probl
em Phase 3: Carry out the plan Phase 4: Evaluate the solution for accurac
y and for its potential as a tools for solving other problems
![Page 13: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/13.jpg)
HW#1.1
1. Write an algorithm to sort 4 cards2. Write an algorithm to sort 5 cardsGive an example for each of your
algorithm.
Write your homework in a well-formed document (.txt, .doc), and send it to me via email.
![Page 14: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/14.jpg)
Computers hardware? Concept of algorithm appeared first Computers are designed to implement algorith
ms Computers (計算機 ,電腦 ) are not smart thems
elves…
+
![Page 15: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/15.jpg)
Development of Algorithmic Machines
Algorithmic machines: machines that perform algorithm tasks
Abacus(算盤 ): ancient Greek and Roman
Blaise Pascal(1623-1662), France
![Page 16: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/16.jpg)
Development of Algorithmic Machines (cont.)
Charles Babbage(1792-1871), England
Herman Hollerith
解多項式
打孔機
![Page 17: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/17.jpg)
1st generation computer 1940
ENIAC
真空管
![Page 18: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/18.jpg)
2nd generation computer 1959
電晶體
![Page 19: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/19.jpg)
3rd generation computer 1965
IC ( 積體電路 )
![Page 20: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/20.jpg)
4th generation computer 1971
VLSI ( 超大積體電路 )
![Page 21: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/21.jpg)
Turing machines
The abstract model of general-purpose algorithmic machines
1936 by Alan M. Turing You will learn more in the class of automa
ta and formal language 自動機與形式語言
![Page 22: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/22.jpg)
Turing machines (cont.)
Controlunit
tape
read/write head
… …
symbols
state of the machines
Components of a Turing machine
![Page 23: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/23.jpg)
A specific Turing machine A Turing machine for incrementing a vlaue
![Page 24: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/24.jpg)
Example:
state=START
1
state=ADD
2
3
state=CARRY
4
state=NO CARRY
state=NO CARRY
5
![Page 25: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/25.jpg)
HW#1.2 Apply the above Turing machine to the
following tape:
Design a Turing machine that decrements the value on the tape if it is greater than 0 or leaves the value unaltered if it is 0.
state=START
11 01
![Page 26: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/26.jpg)
Turing machines (cont.)
Prototype of today’s computer Control unit -> CPU States -> registers Tape cells -> memory Symbols -> 0 and 1
The power of Turing machine If a problem cannot be solved by a Turing
machine, then it cannot be solved by any algorithmic system
![Page 27: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/27.jpg)
John von Neumann machine
In early computing machines, the programs were built as part of the machine
Store-program concept Program, just like data, can be coded and
stored in main memory Control unit extracts the program from
memory, decodes the instructions, and executes them
Some data(bit patterns) were interpreted as instructions -> machine language
![Page 28: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/28.jpg)
Outline Concept of computers
Computer software: algorithm Computer hardware: algorithmic machine Turing Machine
5 major components of computers
![Page 29: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/29.jpg)
Computer hardware
Centralprocessing
unitmemory
Inputdevices
Outputdevices
Auxiliarymemory
Peripherals 週邊
Bus: for data transmission
![Page 30: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/30.jpg)
CPU (central processing unit)
Carry out the instructions in the program
CPU
ALU Controlunit
registers
ALU: arithmetic/logic unit
![Page 31: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/31.jpg)
CPU – control unit
Instruction fetch
Instruction decoding
Instruction execution
Memory read/writetime
Instruction cycle
![Page 32: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/32.jpg)
Memory Main memory
RAM(random access memory) Fast Volatile 揮發
Auxiliary memory Secondary storage Slower Permanent Ex. Hard Disk, CD-ROM
![Page 33: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/33.jpg)
I/O devices Input devices
Keyboard, mouse, … Output devices
Display, printer, …
![Page 34: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/34.jpg)
Overview of computer systems
Hardwaremachines
MS WindowsUnixLinux
Operationsystem
shelldesktop dosUser
Interface
applications
machinelanguage
assemblylanguage
High-levellanguage
compiler
assembler
software
![Page 35: Introduction to Computer Science Fall 2004, 劉震昌 Ref: Computer Science: an overview J. Glenn Brookshear.](https://reader036.fdocuments.net/reader036/viewer/2022081419/56649d365503460f94a0de58/html5/thumbnails/35.jpg)
Purpose of this class
Hardwaremachines
MS WindowsUnixLinux
Operationsystem
shelldesktop dosUser
Interface
applications
machinelanguage
High-levellanguage
compiler
software
assemblylanguage
assembler