introduction nano programming
TRANSCRIPT
![Page 1: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/1.jpg)
CSE1002 Lecture NotesIntroduction
Ryan Stansifer
Department of Computer SciencesFlorida Institute of Technology
Melbourne, Florida USA 32901
http://www.cs.fit.edu/˜ryan/
20 July 2009
![Page 2: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/2.jpg)
Overview of Course
I Introduction. What is CS? What is a computer?
I Review of Java. Data, control constructs, static methods
I Classes
I Generics
I Introduction to Data Structures
![Page 3: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/3.jpg)
Goal: Programming
I Primary goal: programmingI intellectual dreams are translated to realityI rules are simple, yet programming well is difficult, do not
underestimate the challengeI problem solving is hard and difficult to teach
I Secondary goal: introduction to computer scienceI a little at the beginningI and from time to time: BNF, O(N), FSM, invariants
![Page 4: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/4.jpg)
Why Java?
I Why any particular language?
I concrete before abstractI language mastery
I Why not C++?In some ways C++ resembles assembly language, and some thatwould learn C++ first would never realize what high-levellanguages offer.
I Why Java?Good tools, good textbooks, used by AP.
![Page 5: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/5.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 6: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/6.jpg)
Overview of Introduction
I What is CS? Architecture, OS, networking, . . .
I ComputerI ArchitectureI CPUI memory hierarchy
I Interface layers: hardware, operating system, applicationI The Java platform
I JVM and a million other piecesI Java documentationI Java history
I Programming languages — not just Javalearning to program is not just learning about Java
I Program development; debuggers
I Program style; a program is a text file
I I/O, streams
![Page 7: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/7.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 8: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/8.jpg)
What is Computer Science?
computer science. The study of information andalgorithms for virtual and real automata.
I automaton: “self moving” – in our context, self “deciding”mechanism
I information: knowledge represented in a form suitable fortransmission, manipulation, etc.
I algorithm: an unambiguous, finite description in simple steps ofactions
Computer Science is not the study of computers, nor is it the practiceof their use.
![Page 9: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/9.jpg)
I Bosnian: algritem
I Catalon: algorisme
I Chinese (Mandarin):
I Croatian: algritam
I Dutch: algoritme
I Finnish: algoritmi
I French: algorithme
I German: Algorithmus
I Japanese: (arugorizumu)
I Korean:
I Latin: algorithmus
I Spanish: algoritmo
I Swedish: algoritm
I Turkish: algoritma
![Page 10: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/10.jpg)
Mathematics, science, or engineering?
Mathematics. The science of numbers, interrelations,and abstractions.
Science. Systematic knowledge or practice. Acquiringknowledge through the scientific method of naturalphenomena (natural sciences) or human or social behavior(social sciences).
Engineering. The applied science of acquiring andapplying knowledge to design, or construct works forpractical purposes.
![Page 11: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/11.jpg)
What is CS?
I Engineering? Application of science?
I Natural science? Observable phenomena?
I Mathematics? Invisible abstractions?
I Social science? Functioning of human society?
CS is exciting and difficult as it is all these things.
![Page 12: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/12.jpg)
What Does A Computer Scientist Do?
Just like mathematics, everyone in modern society uses computerscience. So getting a computer science degree prepares you foreverything and nothing.
The most visible activity is commanding computers to do our bidding,i.e., programming.
What do you want to do?
![Page 13: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/13.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 14: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/14.jpg)
Fields
I Computer architecture
I Operating systems
I Programming languages and compilers
I Algorithms, data structures, complexity
I Computability theory
I Numerical analysis
I Networking and distributed computing
I Parallel computing
I Database systems
I Software development (aka Software Engineering)
I Human-computer communication/interaction
I Intelligent Systems (aka Artificial Intelligence)
![Page 15: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/15.jpg)
Architecture
Basic five-stage pipeline in a RISC machine: instruction fetch,instruction decode, execute, memory access, register write back.
![Page 16: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/16.jpg)
Operating Systems — paging
![Page 17: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/17.jpg)
Programming Languages and Compilers
![Page 18: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/18.jpg)
Algorithms and Data Structures — Sorting
![Page 19: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/19.jpg)
Theory of Computation — halting problem
![Page 20: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/20.jpg)
Numerical Analysis
A report from the United States General AccountingOffice begins “On February 25, 1991, a Patriot missiledefense system operating ad Dhahran, Saudi Arabia, duringOperation Desert Storm failed to track and intercept anincoming Scud. This Scud subsequently hit an Armybarracks, killing 28 Americans.” The report finds the failureto track the Scud missile was caused by a precision problemin the software.
Nicholas J. Higham, Accuracy and Stability of Numerical Algorithms,SIAM, 1996, ISBN13 9780898713558. Page 505.
http://www.ima.umn.edu/˜arnold/disasters/disaster.html
![Page 21: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/21.jpg)
Distributed Computing — barbershop problem
![Page 22: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/22.jpg)
Parallel Computing
single data SISD MISDmultiple data SIMD MIMD
Flynn’s taxonomy
![Page 23: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/23.jpg)
Database Systems
The join of two relational tables
![Page 24: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/24.jpg)
Software Engineering — waterfall model
![Page 25: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/25.jpg)
Human-Computer Communication/Interaction
![Page 26: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/26.jpg)
Intelligent Systems
C3PO and R2D2 are fantasy robots from the movie Star Wars, whileKiva’s industrial robots can efficiently and intelligently move shelves ina warehouse.
![Page 27: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/27.jpg)
End of the overview of different fields of study in computer science
![Page 28: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/28.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 29: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/29.jpg)
Computing is complex. There are many layer of interesting stuffbetween the person and the automaton.
![Page 30: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/30.jpg)
The vastness and minuteness of time and space is a challenge tocomprehend.
![Page 31: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/31.jpg)
SI prefixes1018 exa E quintillion 1 000 000 000 000 000 000
1015 peta P quadrillion 1 000 000 000 000 000
1012 tera T trillion 1 000 000 000 000
109 giga G billion 1 000 000 000
106 mega M million 1 000 000
103 kilo k thousand 1 000102 hecto h hundred 100101 deca da ten 10100 (none) one 110−1 deci d tenth 0.110−2 centi c hundredth 0.110−3 milli m thousandth 0.0110−6 micro µ millionth 0.000 001
10−9 nano n billionth 0.000 000 001
10−12 pico p trillionth 0.000 000 000 001
10−15 femto f quadrillionth 0.000 000 000 000 001
10−18 atto a quintillionth 0.000 000 000 000 000 001
![Page 32: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/32.jpg)
Because computers represent information in binary form, it isimportant to know how many pieces of information can be representedin n bits. 2n pieces of information can be stored in n bits, and so it isnecessary to be familiar with powers of two.
![Page 33: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/33.jpg)
Powers of Two
0 1 00:00:01 second1 2 00:00:022 4 00:00:043 8 00:00:084 16 00:00:165 32 00:00:326 64 00:01:04 about a minute7 128 00:02:088 256 00:04:169 512 00:08:32
10 1,024 00:17:0411 2,048 00:34:0812 4,096 01:08:16 about an hour
![Page 34: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/34.jpg)
Powers of Two
Notice that 210 ≈ 103, so these powers have significance:
10 kilo 1 024 17 minutes20 mega 1 048 576 two weeks30 giga 1 073 741 824 34 years40 tera 1 099 511 627 776 37 millenia50 peta 125 899 906 842 62460 exa 1 152 921 504 606 846 976 age of universe70 zetta 1 180 591 620 717 411 303 424
![Page 35: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/35.jpg)
Powers of Two
Some other powers of have special significance in computing.
7 128 size of ASCII8 256 size of Latin-1
16 65 536 size of Java short31 2 147 483 648 no. of neg int32 4 294 967 296 size of Java int63 9 223 372 036 854 775 808 no. of neg long64 18 446 744 073 709 551 616 size of Java long
![Page 36: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/36.jpg)
Interface Layers
![Page 37: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/37.jpg)
Computing is complex. There are many layers of interesting stuffbetween the person and the automaton.
1. person (user)
2. user-interface (mouse, etc)
3. application (program)
4. high-level language
5. machine language
6. operating system (OS)
7. hardware
8. devices
9. physics
![Page 38: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/38.jpg)
Definitions
I interface – An interface defines the communication boundarybetween two entities, such as a piece of software, a hardwaredevice, or a user. It generally refers to an abstraction that anentity provides of itself to the outside.
I API — An application programming interface (API) is a set ofprocedures that an operating system, library or service providesto support requests made by computer programs.
I IDE — In computing, an integrated development environment(IDE) is a software application that provides facilities to computerprogrammers for software development. An IDE normallyconsists of a source code editor, a compiler and/or interpreter,build automation tools, and usually a debugger.
![Page 39: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/39.jpg)
Simple View of Programming
computer
program
files
OS
monitor
mouse
keyboard
The program controls the computer, yet it needs critical assistance(from the operating system) to communicate with the outsideenvironment and even to run effectively.
![Page 40: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/40.jpg)
For a deeper appreciation of programming a computer we shouldexamine briefly the many layers upon which the user depends.
An important lesson in organizing these complex systems is that theboundaries should be well chosen. Rapidly changing technology,competing business interests, and new insights make it impossible tosettle these boundaries once and for all.
Whole classes like computer architecture, operating systems, compilerconstruction, and programming languages go into the subjects moredeeply.
![Page 41: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/41.jpg)
Hardware and Operating System Platform
Application
System calls: open(), read(), mkdir(), kill()
OS:
File system
NetworkingProcess management
Memory management
Hardware:CPU Memory
Network interface
Monitor Disk Keyboard
![Page 42: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/42.jpg)
Example Platforms
I Hardware: IBM PowerPC, Intel x86, Sun UltraSPARC II
I OS: Microsoft Windows XP, Mac OS X v10.5 “Leopard”, Linux,Solaris 10
Try:
cs> uname -ioRackMac3,1 Darwin
olin> uname -ioX86_64 GNU/Linux
![Page 43: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/43.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 44: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/44.jpg)
Computer Hardware
![Page 45: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/45.jpg)
Computer Hardware–CPU
AMD 64X2 dual core
![Page 46: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/46.jpg)
Computer Hardware–CPU
![Page 47: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/47.jpg)
Computer Hardware–CPU
control unit is the part of the cpu that controls all the internal actions ofthe cpu escially the fetch/execute cyle.arithmetic/logic unit (ALU) is the part of the cpu that does operations:addition, multiplication, etc.memory data register (MDR) is the reigister of the cpu that conaintsthe data to be stored in the computer’s main storage, or the data aftera fetch from the storage. It acts like a buffer keeping the contents ofstorage ready for immediate use by the cpu.
![Page 48: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/48.jpg)
Computer Architecture
![Page 49: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/49.jpg)
Computer Architecture
type access size costregisters 5ns 1e2
caches (SRAM) 10ns 1e6 100.00 $/MBmain memory (DRAM) 100ns 1e9 1.00 $/MB
hard disk 5000ns 1e11 .05 $/MB
As the technology improves and the costs go down over time, thetypical size of each layer goes up. The ratio in access time betweentwo layers influences the design of the computer hardware. When theratio changes significantly a different design may achieve betterperformance.
![Page 50: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/50.jpg)
Computer Architecture
A final note about computers. The computing platform today is lessconcerned about the individual computer and more concerned aboutthe network of interconnected computers on the Internet.
The computer is the network
Slogan of Sun Microsystems
![Page 51: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/51.jpg)
Outline
IntroductionWhat is CS?Brief overview of fields in computer science
Architecture
Layers of Software and HardwareAnatomy of a ComputerThe Java Platform
Java DocumentationHistory of Java
![Page 52: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/52.jpg)
Programming Language Interface
The programming language interface establishes a virtual machine—avritual computer the programmer pretends to use in place of an actualcomputer.Generally a programming language hides little of the underlyingmachine forcing the programmer to interact directly with the operatingsystems in an ad hoc, mixed approach to controlling a computer.Java tried (with mixed success) to build an all-encompassing platform.
![Page 53: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/53.jpg)
Sun Java Platform
enterprise computing
telephony
programs
distributed programs
WWW applications
network centricapplications
![Page 54: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/54.jpg)
Sun Java SE 6 platform overview from the documentation
![Page 55: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/55.jpg)
Sun Java Platform
I Java virtual machine (JVM) specification
I Java programing language specification
I virtual machine implementation (for Solaris, Windows, and Linux),translation tools (java and javac), and development tools
I A core library (the package java.lang), extensive libraries(APIs) for networking, graphics, etc., and additional APIs forspecial purposes (e.g., telephony)
In addition,
I API documentation
I An IDE for developing Java programs, Netbeans
The virtual machine and language have developed over time.Currently we are concerned primarily with what Sun calls the “Javaplatform, Standard Edition Development Kit 6” or JDK 6 for short.
![Page 56: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/56.jpg)
Interface Layers
I java.util, java.awt
I java.lang
I JVM, JRE
I Hardware and operating system platform
See detailed diagram at: http://java.sun.com/javase/6/docs/
![Page 57: introduction nano programming](https://reader034.vdocument.in/reader034/viewer/2022051314/5517702349795933228b4a55/html5/thumbnails/57.jpg)
History of Java
I Sun Microsystems
I James Gosling
I 1995: WWW, browsers, Java, applets