Problems

333 views
261 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
333
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  •   这样的缺点有两个 1.         虚基类的子类都要背负一个基类指针指向共享部分。如果继承了多个虚基类,还需要多个这样的指针。( Microsoft 的解决方法是增加一个虚基类表,类似于虚函数表。) 2.         虚继承链条的增加,会导致间接访问的层次增加。例如两个菱形继承的串联。
  • Problems

    1. 1. Problems Tao He elfinhe@gmail.com @SELAB, SYSU 2010,May About 90 minutes 1/20
    2. 2. Themes Hackerdom Programming Languages 2/49
    3. 3. Fascinating Problems  “The world is full of fascinating problems waiting to be solved.” Eric Raymond, How to become a hackerEric Raymond. How To Become A Hacker. http://catb.org/~esr/faqs/hacker-howto.htmlEric Raymond. The Cathedral and the Bazaar. http://catb.org/esr/writings/homesteading/ 3/49
    4. 4. Hacker Not Cracker, But Creator Eager to Communicate 4/49
    5. 5. FLOSS community  Not only Free Source  But an Efficiency Way to Communicate, Study and Work  Tashi  “Talk is cheap. Show me the code.” LinusFLOSS: Free-Libre and Open Source Software 5/49
    6. 6. IF NOT OPEN?  Information Inequality  Esoterica  Design Patterns  No FeedbackHerbert Schiller. Information Inequality: The Deepening Social Crisis in America, Routledge 1995, ISBN 0415907659 6/49
    7. 7. KISS: Keep It Simple and Stupid “Perfection (in design) is achieved not when there is nothing more to add, but rather when there is nothing more to take away.” Linux  Fid  Process  Memory Design Patterns 7/49
    8. 8. Tools Everything 8/49
    9. 9. Tools Lingoes 9/49
    10. 10. Tools Wakoopa 10/49
    11. 11. Tools SuperMemo 11/49
    12. 12. Thank you! 12/49
    13. 13. Themes Hackerdom Programming Languages 13/49
    14. 14. Why we use ProgrammingLanguages? For customers  To meet their requirements. ( For example , OA systems) For machine ( Von Neumann Architecture )  Instruction flow  Data Strange, isn’t it ? 14/49
    15. 15. Other Problems Common Elements in High-Level Languages? Dynamic ? Syntax, Semantics and Pragmatics ? Semantics and Logic? 15/49
    16. 16. Assembler Language 16/49
    17. 17. Assembler Language Macro of Machine Code While Programming  Registers  Data Seg  Code Seg  Stack Seg Von Neumann Architecture  Instruction fetch  Instruction execute 17/49
    18. 18. We have Data Seg already.Why we need Stack Seg ? Modules But Stack is manual 18/49
    19. 19. Why we need Modules ? Recursion Reusability Scope Encapsulation 19/49
    20. 20. Stacks and Modules’ Disadvantages Time Space: Stack Overflow 20/49
    21. 21. The C Programming Language 21/49
    22. 22. What’s NEW in C Expressions (Formal Languages, Automaton )  For Instruction  Arithmetic Expressions ( 3+2-5*3 )  Control Flow Expressions ( for, if…else…, )  Function Expressions  For Data  Type System  Atom  Structure We have a Compiler now 22/49
    23. 23. Advantages from Expressions Human  For Instruction  Arithmetic Expressions ( 3+2-5*3 )  Control Flow Expressions ( for, if…else…, )  Function Expressions  For Data  Type System  Atom  Structure 23/49
    24. 24. Advantages from Compiler Expressions Modules : Stack is Automatic Code Optimization ( Inline, Tail Recursion ) 24/49
    25. 25. Compile-time vs. Run-time in C Compile-time  Type Information  Function Information Run-time  null 25/49
    26. 26. The C++ Programming Language 26/49
    27. 27. What’s NEW in C++? Paradigms Class Member Functions Inheritance Hierarchies Virtual Function & Virtual Inherit Template 27/49
    28. 28. Paradigms in C++ Procedural ADT OO 28/49
    29. 29. Class Member Functions Special Code  ___ClsA_Func2(..., ClsA *this) 29/49
    30. 30. Inheritance Hierarchies Almost Compile-time Virtual: Run-time 30/49
    31. 31. C++ want to be as Efficiency as C It’s all right for Procedural and ADT But not for OO with Virtual No Run-time Hierarchies Meta-data for Polymorphism 31/49
    32. 32. Virtual Function:Virtual Function Table 32/49
    33. 33. Inheritance Single Inheritance Multiple Inheritance Single Virtual Inheritance Multiple Virtual Inheritance 33/49
    34. 34. Virtual Inheritance: Virtual Base Table 34/49
    35. 35. Compile-time vs. Run-time in C++ Compile-time  Inheritance Hierarchies Information  Function Information Run-time ( Dynamic )  Virtual Function Table  Virtual Base Table 35/49
    36. 36. Cross-Platform in C++? Source-Level: Yes  Cross-Platform is Manual for different OS API Execution-Level : No 36/49
    37. 37. What is not Efficiency C++? Run-time  Virtual Function  Virtual Inheritance  Virtual Base Class without Virtual Function and Data will be optimized.  Java can Multiple Implement Interfaces. Compile-time  Inheritance Hierarchies 37/49
    38. 38. The Java Programming LanguageMark Stoodley. Issues in static and dynamic native Java code compilation.http://www.ibm.com/developerworks/java/library/j-rtj2/index.html 38/49
    39. 39. What’s NEW in Java? JVM Dynamic Compilation 39/49
    40. 40. 虚拟机的好处有什么? 跨平台:在 OS 与字节码间隔了一层。实 现了程序员无负担的跨平台。 动态编译:许多信息不必在编译后确定, 为动态特性提供可能,稍后详细说。 运行时维护着类型信息,甚至可以加载新 的类型。( CORBRA 依赖这个实现。) 40/49
    41. 41. Java 编译执行的过程是怎样的?  编译后产生一个基于堆栈的字节码 JRE 在不同的 OS 上提供支持 起初的 JRE 是解释执行的,效率低下。  获取待执行的下一个字节码。  解码。  从操作数堆栈获取所需的操作数。  按照  JVM 规范执行操作。  将结果写回堆栈。 41/49
    42. 42. Java 如何解决执行效率低下问题? 42/49
    43. 43. JIT 是怎样运行的呢? 每次按照一个 function 来编译 转成中间表示,并优化,转成可执行码 编译线程和执行线程 分析框架 Profiler 观察程序行为  例如热点 function 内部对象维持一个池。 43/49
    44. 44. 动态编译的优点有什么? 学习程序的行为并优化  频繁执行的 function—— 热方法  arrayCopy 方法,拷贝大段内存,特殊指令  例如类层次结构,多态的优化。  (大多数虚调用都有其固定的一个目标, JIT 因 此生成的代码比虚表调用代码的效率会更高。) 44/49
    45. 45. 动态编译的缺点有什么? 初始编译会影响启动时间。 运行时编译,行为分析需要花费时间。 运行效率达到稳定需要时间。 GUI 不能忍受动态编译和 GC 带来的延迟 。 45/49
    46. 46. Java 如何解决实时的需求? AOT ( Ahead-of-time )编译器  预先编译成为可执行码 46/49
    47. 47. 47/49
    48. 48. Java 适合怎样的应用呢? Java 比较时候需要长期运行的应用,  Web 服务器  Daemon 服务 48/49
    49. 49. Thank you! 49/49

    ×