Download as pdf or txt
Download as pdf or txt
You are on page 1of 57

CSE1002 Lecture Notes

Introduction

Ryan Stansifer
Department of Computer Sciences Florida Institute of Technology Melbourne, Florida USA 32901

http://www.cs.fit.edu/ryan/

20 July 2009

Overview of Course

Introduction. What is CS? What is a computer? Review of Java. Data, control constructs, static methods Classes Generics Introduction to Data Structures

Goal: Programming

Primary goal: programming


intellectual dreams are translated to reality rules are simple, yet programming well is difcult, do not underestimate the challenge problem solving is hard and difcult to teach

Secondary goal: introduction to computer science


a little at the beginning and from time to time: BNF, O (N ), FSM, invariants

Why Java?

Why any particular language?


concrete before abstract language mastery

Why not C++? In some ways C++ resembles assembly language, and some that would learn C++ rst would never realize what high-level languages offer. Why Java? Good tools, good textbooks, used by AP.

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

Overview of Introduction
What is CS? Architecture, OS, networking, . . . Computer
Architecture CPU memory hierarchy

Interface layers: hardware, operating system, application The Java platform


JVM and a million other pieces Java documentation Java history

Programming languages not just Java learning to program is not just learning about Java Program development; debuggers Program style; a program is a text le I/O, streams

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

What is Computer Science?

computer science. The study of information and algorithms for virtual and real automata. automaton: self moving in our context, self deciding mechanism information: knowledge represented in a form suitable for transmission, manipulation, etc. algorithm: an unambiguous, nite description in simple steps of actions Computer Science is not the study of computers, nor is it the practice of their use.

Bosnian: algritem Catalon: algorisme Chinese (Mandarin): Croatian: algritam Dutch: algoritme Finnish: algoritmi French: algorithme German: Algorithmus Japanese: (arugorizumu) Korean: Latin: algorithmus Spanish: algoritmo Swedish: algoritm Turkish: algoritma

Mathematics, science, or engineering? Mathematics. The science of numbers, interrelations, and abstractions. Science. Systematic knowledge or practice. Acquiring knowledge through the scientic method of natural phenomena (natural sciences) or human or social behavior (social sciences). Engineering. The applied science of acquiring and applying knowledge to design, or construct works for practical purposes.

What is CS?

Engineering? Application of science? Natural science? Observable phenomena? Mathematics? Invisible abstractions? Social science? Functioning of human society? CS is exciting and difcult as it is all these things.

What Does A Computer Scientist Do?

Just like mathematics, everyone in modern society uses computer science. So getting a computer science degree prepares you for everything and nothing. The most visible activity is commanding computers to do our bidding, i.e., programming. What do you want to do?

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

Fields
Computer architecture Operating systems Programming languages and compilers Algorithms, data structures, complexity Computability theory Numerical analysis Networking and distributed computing Parallel computing Database systems Software development (aka Software Engineering) Human-computer communication/interaction Intelligent Systems (aka Articial Intelligence)

Architecture

Basic ve-stage pipeline in a RISC machine: instruction fetch, instruction decode, execute, memory access, register write back.

Operating Systems paging

Programming Languages and Compilers

Algorithms and Data Structures Sorting

Theory of Computation halting problem

Numerical Analysis

A report from the United States General Accounting Ofce begins On February 25, 1991, a Patriot missile defense system operating ad Dhahran, Saudi Arabia, during Operation Desert Storm failed to track and intercept an incoming Scud. This Scud subsequently hit an Army barracks, killing 28 Americans. The report nds the failure to track the Scud missile was caused by a precision problem in 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

Distributed Computing barbershop problem

Parallel Computing
single data SISD MISD multiple data SIMD MIMD Flynns taxonomy

Database Systems

The join of two relational tables

Software Engineering waterfall model

Human-Computer Communication/Interaction

Intelligent Systems

C3PO and R2D2 are fantasy robots from the movie Star Wars, while Kivas industrial robots can efciently and intelligently move shelves in a warehouse.

End of the overview of different elds of study in computer science

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

Computing is complex. There are many layer of interesting stuff between the person and the automaton.

The vastness and minuteness of time and space is a challenge to comprehend.

SI prexes
1018 1015 1012 109 106 103 102 101 100 101 102 103 106 109 1012 1015 1018 exa peta tera giga mega kilo hecto deca (none) deci centi milli micro nano pico femto atto E P T G M k h da d c m quintillion quadrillion trillion billion million thousand hundred ten one tenth hundredth thousandth millionth billionth trillionth quadrillionth quintillionth
1 000 000 000 000 000 000 1 000 000 000 000 000 1 000 000 000 000 1 000 000 000 1 000 000

1 000 100 10 1 0.1 0.1 0.01


0.000 001 0.000 000 001 0.000 000 000 001 0.000 000 000 000 001 0.000 000 000 000 000 001

n p f a

Because computers represent information in binary form, it is important to know how many pieces of information can be represented in n bits. 2n pieces of information can be stored in n bits, and so it is necessary to be familiar with powers of two.

Powers of Two
0 1 2 3 4 5 6 7 8 9 10 11 12 1 2 4 8 16 32 64 128 256 512 1,024 2,048 4,096 00:00:01 second 00:00:02 00:00:04 00:00:08 00:00:16 00:00:32 00:01:04 about a minute 00:02:08 00:04:16 00:08:32 00:17:04 00:34:08 01:08:16 about an hour

Powers of Two

Notice that 210 103 , so these powers have signicance: 10 20 30 40 50 60 70 kilo mega giga tera peta exa zetta 1 024 1 048 576 1 073 741 824
1 099 511 627 776 125 899 906 842 624 1 152 921 504 606 846 976 1 180 591 620 717 411 303 424

17 minutes two weeks 34 years 37 millenia age of universe

Powers of Two

Some other powers of have special signicance in computing. 7 8 16 31 32 63 64 128 256 65 536 2 147 483 648 4 294 967 296 9 223 372 036 854 775 808 18 446 744 073 709 551 616 size of ASCII size of Latin-1 size of Java short no. of neg int size of Java int no. of neg long size of Java long

Interface Layers

Computing is complex. There are many layers of interesting stuff between 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

Denitions

interface An interface denes the communication boundary between two entities, such as a piece of software, a hardware device, or a user. It generally refers to an abstraction that an entity provides of itself to the outside. API An application programming interface (API) is a set of procedures that an operating system, library or service provides to support requests made by computer programs. IDE In computing, an integrated development environment (IDE) is a software application that provides facilities to computer programmers for software development. An IDE normally consists of a source code editor, a compiler and/or interpreter, build automation tools, and usually a debugger.

Simple View of Programming

les keyboard program computer OS mouse monitor

The program controls the computer, yet it needs critical assistance (from the operating system) to communicate with the outside environment and even to run effectively.

For a deeper appreciation of programming a computer we should examine briey the many layers upon which the user depends. An important lesson in organizing these complex systems is that the boundaries should be well chosen. Rapidly changing technology, competing business interests, and new insights make it impossible to settle these boundaries once and for all. Whole classes like computer architecture, operating systems, compiler construction, and programming languages go into the subjects more deeply.

Hardware and Operating System Platform

Application System calls: open(), read(), mkdir(), kill()

File system

Memory management

OS:

Process management CPU

Networking Memory

Hardware:
Monitor Disk

Network interface Keyboard

Example Platforms

Hardware: IBM PowerPC, Intel x86, Sun UltraSPARC II OS: Microsoft Windows XP, Mac OS X v10.5 Leopard, Linux, Solaris 10 Try:

cs> uname -io RackMac3,1 Darwin olin> uname -io X86_64 GNU/Linux

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

Computer Hardware

Computer HardwareCPU

AMD 64X2 dual core

Computer HardwareCPU

Computer HardwareCPU

control unit is the part of the cpu that controls all the internal actions of the 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 conaints the data to be stored in the computers main storage, or the data after a fetch from the storage. It acts like a buffer keeping the contents of storage ready for immediate use by the cpu.

Computer Architecture

Computer Architecture

type registers caches (SRAM) main memory (DRAM) hard disk

access 5ns 10ns 100ns 5000ns

size 1e2 1e6 1e9 1e11

cost 100.00 $/MB 1.00 $/MB .05 $/MB

As the technology improves and the costs go down over time, the typical size of each layer goes up. The ratio in access time between two layers inuences the design of the computer hardware. When the ratio changes signicantly a different design may achieve better performance.

Computer Architecture

A nal note about computers. The computing platform today is less concerned about the individual computer and more concerned about the network of interconnected computers on the Internet. The computer is the network Slogan of Sun Microsystems

Outline

Introduction What is CS? Brief overview of elds in computer science


Architecture

Layers of Software and Hardware Anatomy of a Computer The Java Platform


Java Documentation History of Java

Programming Language Interface

The programming language interface establishes a virtual machinea vritual computer the programmer pretends to use in place of an actual computer. Generally a programming language hides little of the underlying machine forcing the programmer to interact directly with the operating systems in an ad hoc, mixed approach to controlling a computer. Java tried (with mixed success) to build an all-encompassing platform.

Sun Java Platform


distributed programs

enterprise computing programs telephony

WWW applications network centric applications

Sun Java SE 6 platform overview from the documentation

Sun Java Platform


Java virtual machine (JVM) specication Java programing language specication virtual machine implementation (for Solaris, Windows, and Linux), translation tools (java and javac), and development tools A core library (the package java.lang), extensive libraries (APIs) for networking, graphics, etc., and additional APIs for special purposes (e.g., telephony) In addition, API documentation 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 Java platform, Standard Edition Development Kit 6 or JDK 6 for short.

Interface Layers

java.util, java.awt java.lang


JVM, JRE Hardware and operating system platform See detailed diagram at: http://java.sun.com/javase/6/docs/

History of Java

Sun Microsystems James Gosling 1995: WWW, browsers, Java, applets

You might also like