Java and CS

509
-1

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
509
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java and CS

  1. 1. Java and CS&E: A Marriage Made in Heaven or Hell? Sanjiva Weerawarana Department of Computer Sciences Purdue University CS&E Spring Seminar Series April 16, 1997.
  2. 2. Overview <ul><li>Introduction to the Java Environment </li></ul><ul><li>Java Language </li></ul><ul><li>Java and CS&E </li></ul><ul><li>Examples </li></ul><ul><li>Conclusion </li></ul>
  3. 3. Introduction: The Java Platform <ul><li>Many platforms in computing: Microsoft Windows, Macintosh, OS/2, UNIX, NetWare, … </li></ul><ul><li>The Java platform allows delivering and running interactive, dynamic and secure applets and applications on various computing devices </li></ul>
  4. 4. The Java Platform <ul><li>Sits on top of existing ones or native </li></ul><ul><li>Java language is entry ramp </li></ul><ul><li>Allows programs written in Java to be run on the Java platform on any hardware/OS combination </li></ul><ul><li>“Write Once, Run Anywhere” SM </li></ul>
  5. 6. Java is .. <ul><li>A programming language </li></ul><ul><li>A bytecode specification </li></ul><ul><li>A virtual machine </li></ul><ul><li>A type of coffee </li></ul>
  6. 7. Java Applets <ul><li>“Small” programs run within a browser </li></ul><ul><li>In Web case, when a page is accessed the programs embedded in that page are automatically downloaded and run </li></ul><ul><li>Should be small / modular to prevent long download times </li></ul><ul><li>Security is considered: sandbox mode </li></ul>
  7. 8. Java Applications <ul><li>Like programs in any other language </li></ul><ul><li>Full access to system services </li></ul><ul><li>Platform independent by design </li></ul>
  8. 9. Java Platform is Everywhere.. <ul><li>Embedded in Web browsers </li></ul><ul><li>Embedded in all major desktop OSs </li></ul><ul><li>JavaOS </li></ul><ul><li>JavaChip family of integrated circuits </li></ul>
  9. 11. Definition: Network Computing <ul><li>Computing is moving from the desktop to the network .. A greater and greater %ge of activity is net-centric </li></ul><ul><li>May or may not imply use of Network Computers (NCs) </li></ul><ul><li>A possible solution to the costly desktop maintenance problem? </li></ul><ul><li>“The Network is the Computer” ® </li></ul>
  10. 12. Network Computers <ul><li>NC Reference Profile by Oracle, Sun, IBM, Netscape and others: </li></ul><ul><ul><li>min 640x480 screen; support for JPEG, GIF, WAV, AU; various Internet protocols, Java, security, … </li></ul></ul><ul><li>“Thin client” model </li></ul><ul><li>Goal is for entire desktop to be software which is downloaded from central server </li></ul>
  11. 13. Enabling Technologies / Forces: Why now? <ul><li>The Web </li></ul><ul><li>Low cost, high power machines </li></ul><ul><li>Low cost network access </li></ul><ul><li>Economics- charging for information will not pay the bills </li></ul><ul><li>Economics- desktops are expensive </li></ul><ul><li>Microsoft </li></ul>
  12. 14. Java and Network Computing <ul><li>Java does not introduce new computer science; it combines features of many things .. So why Java? </li></ul><ul><ul><li>Java is multiplatform by design </li></ul></ul><ul><ul><li>Java is embeddable </li></ul></ul><ul><ul><li>Java is secure </li></ul></ul><ul><ul><li>Java is reasonably efficient </li></ul></ul><ul><ul><li>“being at the right place at the right time” </li></ul></ul>
  13. 15. The Java Language Environment
  14. 16. Java Language <ul><li>History </li></ul><ul><ul><li>Started in 1990 by Jim Gosling </li></ul></ul><ul><ul><li>1991- Consumer Electronics </li></ul></ul><ul><ul><li>1993- Interactive TV </li></ul></ul><ul><ul><li>1995- Internet </li></ul></ul><ul><li>Simple, Efficient, Small, Architecture Neutral, Secure, Robust, Multi-Threaded, ... </li></ul>
  15. 17. Language Syntax <ul><li>Very similar to C/C++ </li></ul><ul><li>Easy to learn </li></ul><ul><li>Fewer concepts </li></ul><ul><ul><li>no pointers arithmetic </li></ul></ul><ul><ul><li>no structs, typedefs </li></ul></ul><ul><ul><li>no preprocessor </li></ul></ul><ul><ul><li>no memory management </li></ul></ul>
  16. 18. Example: Hello World <ul><li>Public class HelloWorld { </li></ul><ul><li>public static void main (String args[]) { System.out.println (“Hello, World.”); } </li></ul><ul><li>} </li></ul>
  17. 19. Simple Data Types <ul><li>Usual types are available, but no unsigned numbers </li></ul><ul><li>Numerical behavior is well defined on all platforms </li></ul><ul><li>If data sizes do not coincide with native, then emulate </li></ul>
  18. 20. Arrays <ul><li>Supports (only) 1-dimensional arrays.. </li></ul><ul><li>Syntactic sugar for multidimensional arrays, but not the performance (arrays of arrays) </li></ul><ul><li>Array references are bounds checked </li></ul>
  19. 21. Object Oriented <ul><li>Java is a more object oriented language than C++: everything but the built-in primitive types must be objects (i.e., there are no user defined functions, only classes) </li></ul><ul><li>Forces design of software to be really OO, and does not allow the pretend-OO style of C++ </li></ul><ul><li>Has all the usual OO concepts: inheritance, encapsulation, abstraction, ... </li></ul>
  20. 22. OO in Java <ul><li>Java has single implementation inheritance </li></ul><ul><ul><li>a new class can be defined by extending (I.e., using) the code from exactly one pre-defined class </li></ul></ul><ul><li>Java has multiple interface inheritance </li></ul><ul><ul><li>a new type can be defined by extending (i.e., starting with) the definition of any number of previously defined types) </li></ul></ul>
  21. 23. Java is Multithreaded <ul><li>Allows execution of multiple “threads” of execution within the same address space </li></ul><ul><li>Preemptive multi-threading </li></ul><ul><li>No explicit locks </li></ul><ul><li>Built-in primitives for synchronization </li></ul><ul><li>Condition variables </li></ul>
  22. 24. Reality Check: Java is Not Everywhere : Native Code <ul><li>JNI: Java Native Interface - allows extending the Java runtime using code written in other languages </li></ul><ul><li>Shared libraries are dynamically loaded and code executed </li></ul><ul><li>Language / security checks are off in native code! </li></ul>
  23. 25. Garbage Collection <ul><li>Unused memory is automatically located and reused: Garbage collection </li></ul><ul><li>Never have to free anything! </li></ul><ul><li>Conservative mark and sweep algorithm </li></ul><ul><li>Most GC is done when idle </li></ul>
  24. 26. Security <ul><li>Compiled code is verified </li></ul><ul><li>Language constraints are enforced at link </li></ul><ul><li>Untrusted code in trusted environment: sandbox approach using security manager </li></ul><ul><li>Control over class loading </li></ul><ul><li>Digitally signed classes </li></ul>
  25. 28. Java and CS&E: Roles <ul><li>User Interfaces </li></ul><ul><ul><li>Data/problem input </li></ul></ul><ul><ul><li>Monitoring and steering </li></ul></ul><ul><ul><li>Data visualization </li></ul></ul><ul><ul><li>Definitely valid ... </li></ul></ul><ul><li>Metacomputing </li></ul><ul><ul><li>Java as a “glue” to build large scope systems </li></ul></ul><ul><ul><li>Definitely valid ... </li></ul></ul>
  26. 29. Java for HPC <ul><li>No question about popularity: </li></ul><ul><ul><li>more and more schools are teaching Java as the first programming language </li></ul></ul><ul><ul><li>has >400,000 developers in 2 years </li></ul></ul><ul><ul><li>relationship to Web and ability to easily interact with others is driving its popularity </li></ul></ul><ul><li>HPC? </li></ul><ul><ul><li>Opportunity to unify languages for core computing and application building </li></ul></ul>
  27. 30. Java Performance <ul><li>Clearly performance is key </li></ul><ul><ul><li>Note: Web/Net speed is not issue; assume high-bandwidth networks (vBNS, I-Way, …) </li></ul></ul><ul><li>Java is currently compiled into bytecodes and then interpreted </li></ul><ul><ul><li>Just-In-Time (JIT) compiler makes difference </li></ul></ul><ul><li>Java can be compiled into native code directly </li></ul>
  28. 31. The Java Language Environment
  29. 32. Compiled Java <ul><li>Is feasible .. Can be high performance </li></ul><ul><li>Programming model needs to be curtailed to help compiler: </li></ul><ul><ul><li>watch exceptions </li></ul></ul><ul><li>Sun claims next version is close to compiled C performance! </li></ul>
  30. 34. Examples of Java in CS&E <ul><li>LINPACK Benchmark in Java http://www.netlib.org/benchmark/linpackjava/ </li></ul><ul><li>HotGAMS http://gams.nist.gov/HotGAMS/ </li></ul><ul><li>MatrixMarket http://math.nist.gov/MatrixMarket/ </li></ul><ul><li>Net // ELLPACK http://pellpack.cs.purdue.edu/netpp/ </li></ul><ul><li>Virtual Programming Laboratory http://www.npac.syr.edu/ </li></ul>
  31. 35. Conclusion <ul><li>Java is here to stay .. At least for the time being! </li></ul><ul><li>High performance and Java and not incompatible </li></ul><ul><li>Selective use of native code is still needed and ok .. </li></ul><ul><li>Real systems are falling into place </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×