1 / 16

Multicore Programming

Multicore Programming. Tutorial 1 CS 0368-3469 Spring 2010. Administrative. Staff Prof. Nir Shavit , shanir@post.tau.ac.il T.A. - Guy Korland, guykorland@post.tau.ac.il. Administrative. Info Web: http://www.cs.tau.ac.il/~multi/ RSS: http://www.cs.tau.ac.il/~multi/rss.php

joey
Télécharger la présentation

Multicore Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multicore Programming Tutorial 1 CS 0368-3469Spring 2010

  2. Administrative Staff • Prof. Nir Shavit, shanir@post.tau.ac.il • T.A. - Guy Korland, guykorland@post.tau.ac.il

  3. Administrative Info • Web: http://www.cs.tau.ac.il/~multi/ • RSS: http://www.cs.tau.ac.il/~multi/rss.php • Forum– Will be published

  4. Administrative The Textbook The Art of Multiprocessor Programming, Herlihy and Shavit,

  5. Requirements • 6 assignments (20%) • 4% each (5 out of 6) • Final exam (80%)

  6. Assignments • http://www.cs.tau.ac.il/~multi/index.php?p=administ • http://www.cs.tau.ac.il/~multi/index.php?p=technical

  7. Java - links • Download JDK6.0: http://java.sun.com/javase/downloads/widget/jdk6.jsp • JDoc: http://java.sun.com/javase/6/docs/api/ • IDE: http://www.eclipse.org/downloads/ • ANT: http://ant.apache.org/bindownload.cgi

  8. Java Class Example package example; import java.awt.Point; public class Rectangle { privateint width = 0; privateint height = 0; private Point origin; public Rectangle() { origin = new Point(0, 0); } public Rectangle(int w, int h) { this(new Point(0, 0), w, h); } public Rectangle(Point p, int w, int h) { origin = p; width = w; height = h; } publicvoid setWidth(int width) { this.width = width; } } data members constructors a method

  9. Running Java Programs packagemp; // file mp/HelloWorld.java public classHelloWorld { public staticvoid main(String[] args) { System.out.println(“Hello World !”); } } > javac HelloWorld.java The compilation phase: This command will produce the java bytecode file HelloWord.class > java –cp . HelloWorld The execution phase (on the JVM): This command will produce the output “Hello World!”

  10. Java Threads • java.lang.Thread class MyThread extends Thread{ @Override publicvoid run(){ … } } publicstatic void main(String args[]){ MyThread thread = new MyThread(); thread.start(); try { thread.join(); } catch (InterruptedException e) { }; }

  11. Java concurrent • Concurrent: http://java.sun.com/j2se/6/docs/api/java/util/concurrent/package-tree.html • Locks: http://java.sun.com/j2se/6/docs/api/java/util/concurrent/locks/package-summary.html

  12. Java - Overview • final, static, private, … • Exception, try-catch & finally • Types - References and Primitives • Wrappers (int vs Integer) • Inheritance & Interfaces

  13. Ant - Overview <projectname="Ex0" default="run" basedir="."< <propertyname="src" location="src"/> <targetname="compile" depends="init"> <javacsrcdir="${src}" destdir="${build}"/> </target> …

  14. Ant – Overview cont. … <target name="run" depends="compile" description="run the program"> <java classname="mpp.Example" classpath="${build}" fork="true"/> </target> </project>

More Related