Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Cheng-Chun Hsu Training for New Students 2009/9/11.

Similar presentations


Presentation on theme: "1 Cheng-Chun Hsu Training for New Students 2009/9/11."— Presentation transcript:

1 1 Cheng-Chun Hsu Training for New Students 2009/9/11

2  First Part  Introduction of Java  Introduction of Garbage Collection  Second Part  Introduction of Actor Model  Third Part  CVM’s Implementation (Linux, Windows Mobile, Andes Platform, Windows) 2 2009/9/11

3  J2SE  J2EE  J2ME 3 2009/9/11

4 4 DesktopLow-end devices Enterprise High-end devices Smart Cards Optional packages Foundation profile CDC Personal profile Java Card Card VM MIDP Optional packages CLDC KVM Java Virtual Machine Java 2 Micro Edition (J2ME) Optional packages JEE Optional packages JSE CVM 2009/9/11

5 5

6 6

7  First Part  Introduction of Java  Introduction of Garbage Collection  Second Part  Introduction of Actor Model  Third Part  CVM’s Implementation (Linux, Windows Mobile, Andes Platform, Windows) 7 2009/9/11

8 8

9  No dangling references  No memory leaks  Greater programmer productivity  Ex: Java, C# 9 2009/9/11

10  G.C. stage  Identify (must pause time)  Collect  When is the G.C. happened ? 1)Allocate new object (not enough memory) 2)System idle 3)System.gc( ) 4)Intialization 10 2009/9/11

11 Classical G.C. 1.Mark and Sweep (Tracing) 2.Copying Collection (Semi-space) 3.Reference Counting => cyclic problem Advanced G.C. 1.Generational Collection => hybrid algorithm 2.Incremental Collection => real-time system) 11 2009/9/11

12  DFS(x) 12 2009/9/11

13  Marking phase  Starting from the roots, set the mark bit on all live cells.  Sweep phase  Return all unmarked cells to the free list.  Reset the mark bit on all marked cells. 13 2009/9/11

14  If less garbage, then high speed  Disadvantage  Memory has internal fragment.  Must be pause. 14 2009/9/11

15  From-space, To-space 15 2009/9/11

16  If much garbage, then high performance  Advantage  Only visits live objects (therefore fast)  No fragmentation and fast allocation  Disadvantage  Only from-space used  Must be pause 16 2009/9/11

17  Counting pointers and cyclic structure 17 2009/9/11

18  Advantage  Quickly  Disadvantage  Cannot reclaim cyclic structure  Maintain a counter per chunk  Extra space requirements  Fragmentation 18 2009/9/11

19  Old generation (mark-compact)  New generation (copying) 19 2009/9/11

20  First Part  Introduction of Java  Introduction of Garbage Collection  Second Part  Introduction of Actor Model  Third Part  CVM’s Implementation (Linux, Windows Mobile, Andes Platform, Windows) 20 2009/9/11

21 21 4 5 7 8 6 2 3 1 2009/9/11

22 22 2009/9/11

23 Object-Oriented SystemActor System PassiveActive HeavySightly Have suitable storageNo stacks, heap, register Computation has independent threads of control manipulating the object they refer to. Thread of control is encapsulated in the object itself. Thread of control is important.Thread of control is unimportant. 23 2009/9/11

24  Actor  The universe consists of autonomous computation agents.  Garbage Actor  Unable to receive a message from or send a message to the root actor. 24 2009/9/11

25  Active(  )  An actor which is either processing a message or has message pending in its mail-queue.  Blocked(  )  An actor that is waiting for the arrival of a message to its empty mail queue.  Root(  )  An actor that is always considered as non-garbage. 25 2009/9/11

26  Each actor has a unique mail address.  Communication is asynchronous.  Message for an actor are buffer in a mail queue. 26 2009/9/11

27  Create  Create a new actor.  Send  Send a message into other mail queue.  Ready  Prepare process next message in mail queue. 27 2009/9/11

28  The state of an individual actor  The topology of the system of actors 28 BAAB AABB 2009/9/11

29  Is-Black  Push-Pull  Table-Driven  Dickman  GCE 29 2009/9/11

30 30 B F ACED B F ACED 2009/9/11

31 31 B F AC ED B F ACED 2009/9/11

32 32 B F A CED B F AC ED 2009/9/11

33 33 B F ACED B F A CED 2009/9/11

34 34 2009/9/11

35 35 2009/9/11

36 36 2009/9/11

37 37 2009/9/11

38 38

39 2009/9/11 39

40 bR(b)R(b) CA DA FA FE DG aF(A)F(A) AE EA AG GA 2009/9/11 40

41  First Part  Introduction of Java  Introduction of Garbage Collection  Second Part  Introduction of Actor Model  Third Part  CVM’s Implementation (Linux, Windows Mobile, Andes Platform, Windows) 41 2009/9/11

42  CDC Porting Guide (Ch6)  CDC Build Guide  CDC Runtime Guide  CDC Dynamic Compiler 42 2009/9/11

43 1. Install JDK 1.4.2.19 (or default JDK 1.7.0 in Fedora 8) (set path “export PATH=$PATH:$HOME/j2sdk1.4.2_19/bin” ) 2. Extract “phoneme_advanced-mr2-dev-src-b97- 20_nov_2008.zip” 3. Input “cd phoneme_advanced_mr2/cdc/build/ linux-x86- generic” 4. Input “make”, after run “cvm” Next, move to the Eclipse (Please refer to “cvm 環境建置和指令 for linux.doc”) 43 2009/9/11

44 1. Install JDK 1.4.2.19(set path “C:\j2sdk1.4.2_19\bin;”) 2. Install Pocket PC 2003 SDK 3. Install Embedded Visual C++ 4 4. Install Embedded Visual C++ 4.0 SP3 5. Install Cygwin (include gcc, g++, zip, flex, bison, packages) 6. Extract “phoneme_advanced-mr2-dev-src-win32-b34- 04_oct_2007.zip” 7. Open “Cygwin” 8. Input “cd phoneme_advanced_mr2/cdc/build/win32-x86-ppc03” 9. Input “make” 44 2009/9/11

45 Connect PDA 1. Install ActiveSync 4.5 (synchronize between PC and PDA) 2. Install WindowsMobilePowerToys.msi (use cmd.exe in the PDA) 3. After, go to “C:\Program Files\Windows Mobile Developer Power Toys\PPC_Command_Shell\arm” 4. Copy all files to the PDA’s “windows” folder 45 2009/9/11

46 Run an example of “cvm” 1. After compiler successfully, copy “win32-x86-ppc03” folder to your root of “SD Card” 2. Open “notepad” 3. Input 255#“\SD Card\win32-x86-ppc03\bin\cvm.exe” –cp “\SD Card\win32-x86-ppc03\testclasses.zip” HelloWorld 4. Save the file, and set file name “EX_helloworld.lnk” 5. Go to SD card folder of PDA, after run “EX_helloworld.lnk” 6. Wait for a long time, and then show “HelloWorld.” 46 2009/9/11

47 1. Install JDK 1.4.2.19 (set path “C:\j2sdk1.4.2_19\bin;”) 2. Install andesight-1_3_1-windows (complete installation and include Cygwin) 3. Extract “pmea-mr2-b114-nds32-20090602.zip” to “C:\”, and then produce the folder “pmea” 4. Open “Cygwin” 5. Input “export PATH=$PATH:/cygdrive/c/Andestech/AndeSight/toolchains/n ds32-elf-n1213-s-full/bin” 47 2009/9/11

48 6. Input “nds32-elf-gcc”, and then show “nds32-elf-gcc: no input files” 7. Input “mkdir /pmea” 8. Input “mount c:/pmea /pmea” 9. Input “cd pmea/cdc/build/linux-nds32-xc5” 10. Input “make” Next, upload and test PMEA to the Andes platform. (Please refer to “ 教育改進計畫課程實驗模組 -Java Virtual Machine-2009-06-02.doc”) 48 2009/9/11

49 1. Install JDK 1.4.2.19 (set path “C:\j2sdk1.4.2_19\bin;”) 2. Install Microsoft Platform SDK for Windows Server 2003 R2 (install location “C:\Program Files\Microsoft Platform SDK”) 3. Install Visual C++ 2005 express(vc8) (install location “C:\Program Files\Microsoft Visual Studio 8”) 4. Install Cygwin(include gcc, g++, zip, flex, bison, packages) 5. Extract “phoneme_advanced-mr2-dev-src-win32-b34- 04_oct_2007.zip” 6. Open “Cygwin” 7. Input “cd phoneme_advanced_mr2/cdc/build/win32-x86-vc8” 8. Input “make”, after run “cvm” 49 2009/9/11

50  Run  bin/cvm –cp testclasses.zip HelloWorld  Change G.C.  make CVM_GCCHOICE=semispace/generational/marksweep  View CVM’s options  bin/cvm -XshowBuildOptions  Build Java program  Javac -target 1.4 -source 1.4 -bootclasspath /home/test- cdc/btclasses.zip MyApp.java (More information, refer to “cvm 環境建置和指令 for linux.doc”) 50 2009/9/11

51  Books  深入嵌入式 Java 虛擬機器 Inside KVM  Java 虛擬機深入解析  SCJP 6.0/5.0 猛虎出閘  Document  CDC Porting Guide 51 2009/9/11

52  Official Website of PhoneME  https://phoneme.dev.java.net/  phoneME for Windows Mobile  http://www.cs.kuleuven.be/~davy/phoneme/  Richard Jones  http://www.ssw.uni- linz.ac.at/Teaching/Lectures/Sem/2005/  ActorFoundry  http://osl.cs.uiuc.edu/research?action=topic&topic=Actor+ Systems 52 2009/9/11

53  Keywords  J2ME, CDC/CLDC, CVM/KVM, Java Virtual Machine, Garbage Collection, Memory Management, Mark- Sweep, Semi-Space, Reference Counting, Generational, Actor Model, Active Objects, Push-Pull, Is-Black 53 2009/9/11


Download ppt "1 Cheng-Chun Hsu Training for New Students 2009/9/11."

Similar presentations


Ads by Google