720 likes | 821 Vues
Explore Java programming language, distributed computing, and cluster computing in this informative course. Learn about Java basics, networking, cluster problems, and examples of cluster computing applications. Discover the Java environment, bytecodes, data types, and more. Join now to enhance your programming skills!
E N D
About me • Prof. Lyon, • vc (203)641-6293 cell. • Fax (203)877-4187 • lyon@docjava.com • Office Hours; appt only (for now).
About the Book • Java for Programmers: • by D. Lyon, Pren. Hall. • Grading: • 1/3, homework • 1/3 midterm • 1/3 final
Homework • weekly or bi-weekly • Due on time • You loose 10 points per day late! • Midterms are due in class with a demo. • Final is due in class with a demo. • Tests are take home.
Course Info • Web page: • http://www.docjava.com • Distributed Computing • multiple computers working on a single task. • Network gaming • client-server • browser – web-server
Examples of Distributed Computing • Services provided by a server • ftp server • print server • file server • mail server • echo server • ssh server • telnet server
Services • Where are services listed? • /etc/services • gives you a list of “ports” • Distributed Computing is Network Computing • You study Network Programming to do Network Computing
Cluster Computing • Group(s) of computers that are geographically co-located. Typically central administration using a master-work paradigm.
Cluster Problems • hard to load balance • need benchmark • need a mechanism to register a volunteer • Configuration problem – need a compute server on every machine. • need to detect when idle.
Cluster Problems • Need a way to partition a problem. • I need a way to transfer jobs from one machine to another. • How do you run a program on demand? • Java Web Start!
Examples of Cluster Computing • File System • SETI • etc…
What is Java? • A programming language • A technology that supports the language
What is a Programming Language? • A language that can run on a computer. • An invention that helps facilitate communication. • Generally, it helps people communicate with a computer.
What is a Computer? • A machine that processes data. • E.g. Brain= bio-computer
What is a machine? • A device that transforms energy. • Computers use energy to perform information processing. • E.g., Wheel, human, brain=biological computer!
Can Machines Think? • Humans think that they can think. • Human brain is a kind of machine. • Therefore machines can think.
Example Application of A programming Language • recipe • ingredients – data structures (<-input) • procedure to follow - algorithms • results - output
So Java Can • Take input • Fill Data structures • Run algorithms • Generate Output
What is HTML? • Hypertext Markup Language • Used by a Browser • Presentation of content
What is a browser? • a program that decodes HTML and presents it to the user. • For example: • Explorer • Netscape • Lynx
What is the Internet? • a collection of local area networks. • It is often viewed using a browser.
What is a Computer network? • A means of communicating between computers. Computer1 Computer2
Internet=Internetwork • Collection of Networks • Message forwarding on a data packet net Node Computer1 Computer2
What is the Web? • GUI on the Internet • Can use HTML for presentation of content • Browsers decode presentation data for display
What is the HTML Model? • Browsers present data embedded in HTML • HTML • Images • GIF, JPEG, PNG, .... • Audio • AIFF, AU,... • PLUGINS
What’s a Plugin • A program that helps a browser process data. • Shockwave • RealPlayer • Quicktime
Java Model • Add to the number of formats we can decode. • Run the Java program automatically when we visit a web page using a browser with Java.
Would you run a program on Demand? • A big security risk? • Feature Limits help us to be secure. • trusted programs can do anything • untrusted programs have big limits. • no file access • no access across the net to other machine. • Other restrictions too.
What is a Compiler? • Is a program that inputs a programming language and outputs another programming language! • Output language is lower level than input language.
What is Javac? • The java compiler • Inputs java source code • outputs BYTE CODES
How do I run BYTE CODES? • java is the command that invokes the JVM. • java inputs BYTE CODES and RUNs them!
Java Environment/ Life Cycle of Java Code Java Interpreter Just in Time Compiler Runtime Environment Compile-time Environment Class Loader Bytecode Verifier Java Class Libraries Java Source (.java) Java Bytecodes move locally or through network Java Virtual machine Java Compiler Runtime System Java Bytecode (.class ) Operating System Hardware
Whats a Byte? • a collection of 8 bits
Primitive Data Types • What is a Data type? • It is a structured record that hold bits in a format that is defined by either the programmer or the language designer. • Eg. The bit is a data type.
What is a bit? • Binary Digit = bit • It is symbolized by the numbers 0 or 1. • When you use a bit to count, you use a two-state numbering system. • Binary is a BI (two) state numbering (nary) system
What is Binary? • Two numbered system • Generally S={0,1} • 00, 01, 10, 11 (binary) • 0, 1, 2, 3 (decimal)
What is Hexidecimal? • 16 symbols in a numbering system. • Generally S={0,1,2,3,4,5,6,7,8,9,A, B,C,D,E,F} • (DEAD) base 16 (hexidecimal) • (CAB) • (7F) • (FF)
What is Octal? • A Base 8 numbering system • 8 symbols • generally S={0,1,2,3,4,5,6,7} • (177) (10) • (7) + (1) = (10) base 8 • (10)+(7)=(17) base 8 • (17)+(1)=(20) base 8
What is a base? • The number of symbols in a numbering system. • Radix of a numbering system is the base
Why do they call it the base? • In decimal we write: 42. • 42 = 4 * 10**1 + 2*10**0 • In binary we write: 1101 • 1101 = 1 * 2 ** 3 + 1 * 2**2+0*2**1+1*2**0=8 + 4 +1=13 base 10
What is a primitive data type? • Is a built in (to the language) data type. • That means that the language comes with the primitive data type.
Why do I need a primitive data type? • Holds some value represented by bits in computer memory. • It helps with computations by storing data.
What is an example of a PDT? • boolean – true, false. • boolean b = true; • boolean t = false; • boolean theChairsAreHard = true; • boolean theExampleIsGettingSilly = true; • The = sign means assignment. • Variables are on the left hand side of the = sign.
There are 8 primitive data types. • boolean • char • SignedFixedPoint (byte, short, int, long) • SignedFloatingPoint (float, double)
Two types of primitive data types • Signed • Unsigned
Two types of unsigned data types • boolean • char • example: • char c = ‘t’; • char qwerty = ‘q’; • char thisIsGettingSilly = ‘w’;
What is a Java statement? • Some Java code followed by a ‘;’ • char fooBar = ‘e’;
How many fixed point PDTs are there? • 4, byte, short, int, long • byte uses 8 bits to store values. • short uses 16 bits • int uses 32 • long uses 64
What are some examples? • byte b = 127; • byte b = 128; // does not work! • bytes range from –128...127 • The most significant bit is the sign bit. • byte thisIsGettingSilly = -128;