PhD Thesis Defense Presentation

9,834 views

Published on

PhD in Computer Science (mention très honorable) at Ecole Des Mines de Douai and Université
des Sciences et Technologies de Lille 1 (USTL) – INRIA Lille Nord Europe
Title : « Application-Level Virtual Memory for Object-Oriented Systems »
Funding : Ecole Des Mines de Douai.
Supervisor : Prof. Stéphane Ducasse.
Co-supervisors : Dr. Noury Bouraqadi, Dr. Marcus Denker and Dr. Luc Fabresse.
Defended : October, 29th, 2012
Jury : Prof. Robert Hirschfeld, Prof. Christophe Dony, Prof. Jean-Bernard Stefani, Prof. Roel Wuyts,
Prof. Stéphane Ducasse, Dr. Noury Bouraqadi, Dr. Marcus Denker, Dr. Luc Fabresse

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
9,834
On SlideShare
0
From Embeds
0
Number of Embeds
4,990
Actions
Shares
0
Downloads
97
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

PhD Thesis Defense Presentation

  1. 1. Application-Level Virtual Memory forObject-Oriented Systems Mariano Martinez Peck 1
  2. 2. Application-Level Virtual Memory forObject-Oriented Systems Mariano Martinez Peck 2
  3. 3. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 3
  4. 4. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 3
  5. 5. Context 4
  6. 6. Context 4
  7. 7. Context 4
  8. 8. Context 4
  9. 9. Context 4
  10. 10. Context 4
  11. 11. We need to optimizememory management 5
  12. 12. Context• Object-oriented programming. Why? Most modern and widespread. Memory is usually automatically managed (GC).• Dynamic languages. Why? Powerful. More and more used. 6
  13. 13. In this context of OOP,is GC actually enough to optimize memory management? 7
  14. 14. % used objects ? % used memory ?% unused objects ? % unused memory ? 8
  15. 15. % used objects % used memory % unused objects % unused memory (web app + CMS) (standalone + lots of tools + large)(174 pack. 1364 class. 121010 LOC) (mobile app) (infrastructure) 8
  16. 16. % used objects % used memory % unused objects % unused memory 19% 29% (web app + CMS) 81% 71% 18% 27% (standalone + lots of tools + large)(174 pack. 1364 class. 121010 LOC) 73% 82% 23% 54% 46% 77% (mobile app) 10% 37% 63% (infrastructure) 90% 8
  17. 17. % used objects % used memory % unused objects % unused memory 19% 29% (web app + CMS) 81% 71% 18% 27% (standalone + lots of tools + large)(174 pack. 1364 class. 121010 LOC) 73% 82% 23% 54% 46% 77% (mobile app) 10% In average, %80 of the 37% objects are unused.90% 63% (infrastructure) 8
  18. 18. % used objects % used memory % unused objects % unused memory 19% 29% (web app + CMS) 81% 71% 18% 27% (standalone + lots of tools + large)(174 pack. 1364 class. 121010 LOC) 73% 82% 23% 54% 46% 77% (mobile app) 10% In average, %80 of the In average, 77% 37%the of objects are unused.90% memory is63% unused. (infrastructure) 8
  19. 19. Unused objects Referenced. GC cannot collect them! Waste primary memory. 9
  20. 20. Unused objects Referenced. GC cannot collect them! Waste primary memory. No, the GC is not enough 9
  21. 21. OS’ Virtual Memory is not the answer• It only swaps pages.• Developers cannot easily influence it. 10
  22. 22. Thesis statementA virtual memory for dynamic OOP languagesshould be: Application-aware Efficient 11
  23. 23. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 12
  24. 24. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 12
  25. 25. A model for efficient application-level virtual memory:• Designed for dynamic OOP• Based on the swapping of object graphs 13
  26. 26. Primary memory Swap out Swap in unused object needed object graphs graphsSecondary memory cloud file database 14
  27. 27. Primary memory Swap out Swap in unused object needed object graphs graphsSecondary memory cloud file database 14
  28. 28. Primary memory Y A B C E FSecondary memory 15
  29. 29. Primary memory Y A B C E F Memory occupied by graph of unused objectsSecondary memory 15
  30. 30. Primary memory Y A B C E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 15
  31. 31. Primary memory Y A Pa B C E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 15
  32. 32. Primary memory Y Pa Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 15
  33. 33. Primary memory Y PaSecondary memory bytes (A,B,C,E,F) 15
  34. 34. Primary memory Y PaSecondary memory bytes (A,B,C,E,F) 15
  35. 35. Primary memory Y Pa Memory ReleasedSecondary memory bytes (A,B,C,E,F) 15
  36. 36. Primary memory Y Pa Memory ReleasedSecondary memory Swap in bytes (A,B,C,E,F) 15
  37. 37. Primary memory Y A B C E FSecondary memory 15
  38. 38. Primary memory Y A B C E FSecondary memory 16
  39. 39. Primary memory Y A D B C E FSecondary memory 16
  40. 40. Primary memory Y A D B C E F Memory occupied by graph of unused objectsSecondary memory 16
  41. 41. Primary memory Y A D B C E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 16
  42. 42. Primary memory Y A Pa D B C E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 16
  43. 43. Primary memory Y Pa D C E Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 16
  44. 44. Primary memory Y Pa D C ESecondary memory bytes (A,B,C,E,F) 16
  45. 45. Primary memory Y Pa D C ESecondary memory bytes (A,B,C,E,F) 16
  46. 46. Primary memory Y Pa D C ESecondary memory Swap in bytes (A,B,C,E,F) 16
  47. 47. Primary memory Y Pa D C ESecondary memory Swap in bytes (A,B,C,E,F) 16
  48. 48. Primary memory Y Pa D C ESecondary memory Swap in bytes (A,B,C,E,F) 16
  49. 49. Primary memory Y A D B C C E E FSecondary memory 16
  50. 50. Primary memory Y A D B C C E E FSecondary memory 16
  51. 51. Primary memory Y A D B C C E E FSecondary memory INCORRECT!!! 16
  52. 52. ObjectivesCorrectness: SwapIn(SwapOut(X))==XMaximize memory released.Minimize runtime overhead. 17
  53. 53. subsystems Object Graph Proxy Swapper Toolbox ObjectObject Graph Graph Serializer Storage 18
  54. 54. Primary memory Y A D B C E FSecondary memory 19
  55. 55. Primary memory Y A D B C E F Memory occupied by graph of unused objectsSecondary memory 19
  56. 56. Primary memory Y A D B C E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 19
  57. 57. Primary memory Y A D B C facade objects E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 19
  58. 58. Primary memory Y A Pa D B C Pc facade objects proxy E F Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 19
  59. 59. Primary memory Y Pa D Pc facade objects proxy Memory occupied by graph of unused objectsSecondary memory Swap out bytes (A,B,C,E,F) 19
  60. 60. Primary memory Y Pa D Pc facade objects proxySecondary memory bytes (A,B,C,E,F) 19
  61. 61. Primary memory Y Pa D Pc facade objects proxySecondary memory bytes (A,B,C,E,F) 19
  62. 62. Primary memory Y Pa D Pc facade objects proxySecondary memory Swap in bytes (A,B,C,E,F) 19
  63. 63. Primary memory Y A D B C facade objects proxy E FSecondary memory 19
  64. 64. How to efficiently detect and manage facade objects?• Back-pointers.• Whole memory scan. Y A D B C E F 20
  65. 65. How to efficiently detect and manage facade objects?• Back-pointers.• Whole memory scan. Y A D B C Marea provides an E F efficient solution. 20
  66. 66. Primary memory Swapping out A D GraphTable B CSecondary memory 21
  67. 67. Primary memory Swapping out A D GraphTable B CSecondary memory 21
  68. 68. Primary memory Swapping out Graph ID: 42 A D GraphTable B CSecondary memory 1) Assign graph ID 21
  69. 69. Primary memory Swapping out Graph ID: 42 A D GraphTable B CSecondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 21
  70. 70. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 A Pa GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 1 2 3 42.swap 21
  71. 71. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 A Pa GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 1 2 3 42.swap 21
  72. 72. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 A Pa GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 1 2 3 42.swap 21
  73. 73. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 A Pa GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap 21
  74. 74. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 A Pa GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap 21
  75. 75. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 Pa A GraphTable B C B Pb Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap 21
  76. 76. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 Pa A GraphTable B C Pb B Pb 42 1 C Pc proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap 21
  77. 77. Primary memory Swapping out Graph ID: 42 Pa Pc D 42 2 A 42 3 Pa A GraphTable B C Pb B Pb 42 1 Pc C proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap 21
  78. 78. Primary memory Swapping out Graph ID: 42 Pa Pc 42 Pa Pb Pc A D (weak array) 42 2 42 3 Pa A GraphTable B C Pb B Pb 42 1 Pc C proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Update GraphTable 42.swap 21
  79. 79. Primary memory Swapping out Graph ID: 42 Pa Pc 42 Pa Pb Pc A D (weak array) 42 2 42 3 Pa A GraphTable B C Pb B Pb 42 1 Pc C proxiesDictSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Update GraphTable 6) GC runs 42.swap 21
  80. 80. Primary memory Swapping out Pa Pc 42 Pa nil Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc CSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Update GraphTable 6) GC runs 42.swap 21
  81. 81. Primary memory Swapping out Pa Pc 42 Pa nil Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc CSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Update GraphTable 6) GC runs 42.swap 7) Compact (optional) 21
  82. 82. Primary memory Swapping out Pa Pc 42 Pa Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc CSecondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Update GraphTable 6) GC runs 42.swap 7) Compact (optional) 21
  83. 83. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTableSecondary memory B’ A’ C’ 1 2 3 42.swap 22
  84. 84. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTableSecondary memory 0) A proxy intercepts a message... B’ A’ C’ 1 2 3 42.swap 22
  85. 85. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTableSecondary memory 0) A proxy intercepts a message... B’ A’ C’ 1 2 3 42.swap 22
  86. 86. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph B’ A’ C’ 1 2 3 42.swap 22
  87. 87. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  88. 88. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  89. 89. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  90. 90. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  91. 91. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  92. 92. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  93. 93. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable Pa A’ B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  94. 94. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable Pa A’ Pc C’ B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 42.swap 22
  95. 95. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable Pa A’ Pc C’ B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 3) Replace proxies with original objects 42.swap 22
  96. 96. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable A’ Pa Pc C’ B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 3) Replace proxies with original objects 42.swap 22
  97. 97. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable A’ Pa C’ Pc B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 3) Replace proxies with original objects 42.swap 22
  98. 98. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 A’ 42 3 (weak array) B’ C’ GraphTable A’ Pa C’ Pc B’ A’ C’ proxiesDict 1 2 3 materializedObjectsSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with B’ A’ C’ materialized objects 1 2 3 3) Replace proxies with original objects 4) Clean 42.swap 22
  99. 99. Primary memory Swapping in Pa Pc D 42 2 A’ 42 3 B’ C’ GraphTable C’ PcSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with materialized objects 3) Replace proxies with original objects 4) Clean 22
  100. 100. Primary memory Swapping in A’ D B’ C’ GraphTable C’ PcSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with materialized objects 3) Replace proxies with original objects 4) Clean 5) GC runs 22
  101. 101. Primary memory Swapping in A’ D B’ C’ GraphTable C’ PcSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with materialized objects 3) Replace proxies with original objects 4) Clean 5) GC runs 6) Forward message to object 22
  102. 102. Primary memory Swapping in A’ D B’ C’ GraphTable C’ PcSecondary memory 0) A proxy intercepts a message... 1) Materialize the object graph 2) Associate proxies with materialized objects 3) Replace proxies with original objects 4) Clean 5) GC runs 6) Forward message to object 22
  103. 103. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory B’ A’ C’ 1 2 3 42.swap 23
  104. 104. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory B’ A’ C’ 1 2 3 42.swap 23
  105. 105. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory 1) Assign graph ID B’ A’ C’ 1 2 3 42.swap 23
  106. 106. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 23
  107. 107. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 23
  108. 108. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph 23
  109. 109. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph D’ C’ 1 2 43.swap 23
  110. 110. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph ...) as usually... D’ C’ 1 2 43.swap 23
  111. 111. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph ...) as usually... We don’tC’ D’ want to swap in a graph while 1 2 swapping out another one 43.swap 23
  112. 112. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory B’ A’ C’ 1 2 3 42.swap 24
  113. 113. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory B’ A’ C’ 1 2 3 42.swap 24
  114. 114. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory 1) Assign graph ID B’ A’ C’ 1 2 3 42.swap 24
  115. 115. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTableSecondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 1 2 3 42.swap D’ Pc’ 1 2 43.swap 24
  116. 116. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 42.swap D’ Pc’ 1 2 43.swap 24
  117. 117. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap D’ Pc’ 1 2 43.swap 24
  118. 118. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap D’ Pc’ 1 2 43.swap 24
  119. 119. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap D’ Pc’ 1 2 43.swap 24
  120. 120. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 43 Pd Ppc Ppc Pd GraphTable 43 1 (weak array) 43 2Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap 5) Update GraphTable D’ Pc’ 1 2 43.swap 24
  121. 121. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 43 Pd Ppc Ppc Pd GraphTable 43 1 (weak array) 43 2Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 43.swap 24
  122. 122. Primary memory Intersections... Pa nil Pa 42 (weak array) 42 2 43 Pd nil Pd GraphTable 43 1 (weak array)Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 43.swap 24
  123. 123. Primary memory Intersections... Pa nil Pa 42 (weak array) 42 2 43 Pd nil Pd GraphTable 43 1 (weak array)Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) B’ A’ C’ 3) Create and associate proxies 1 2 3 4) Replace original objects with proxies 42.swap 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 7) Swap in graph 42 43.swap 24
  124. 124. Primary memory Intersections... nil 43 Pd nil A’ Pd 43 1 GraphTable (weak array) B’ C’Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 7) Swap in graph 42 43.swap 24
  125. 125. Primary memory Intersections... nil 43 Pd nil A’ Pd 43 1 GraphTable (weak array) B’ C’Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 7) Swap in graph 42 8) Swap in graph 43... 43.swap 24
  126. 126. Primary memory Intersections... nil 43 Pd nil A’ Pd 43 1 GraphTable (weak array) B’ C’Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable D’ Pc’ 6) GC runs 1 2 7) Swap in graph 42 8) Swap in graph 43... 43.swap 24
  127. 127. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable 6) GC runs 7) Swap in graph 42 8) Swap in graph 43... 24
  128. 128. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable 6) GC runs 7) Swap in graph 42 8) Swap in graph 43... 24
  129. 129. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3Secondary memory 1) Assign graph ID 2) Serialize the object graph (customize serializer) 3) Create and associate proxies 4) Replace original objects with proxies 5) Update GraphTable 6) GC runs INCORRECT!!! 7) Swap in graph 42 8) Swap in graph 43... 24
  130. 130. Graph intersections• Avoiding proxies for proxies (Ppc) does not solvethe problem either.• Several scenarios for swapping inswapped intersecting graphs. 25
  131. 131. Graph intersections• Avoiding proxies for proxies (Ppc) does not solvethe problem either.• Several scenarios for swapping inswapped intersecting graphs. Marea solves all these scenarios and challenges. 25
  132. 132. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 26
  133. 133. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 26
  134. 134. Experiment (web app + CMS) 1. We swapped out most classes with their instances. (standalone + lots of tools + large) 2. We navigated, used and tested(174 pack. 1364 class. 121010 LOC) each application 1. Swapped in all needed graphs for typical uses. (mobile app) 2. Tests also for correctness. 3. We measured differences. (infrastructure) 27
  135. 135. Original = 100% With Marea Measured minimun 100 75% of memory 50 25 0 DBXTalk Moose DrGeo Pharo 28
  136. 136. Original = 100% With Marea Measured minimun 100 75% of memory 50 25 0 DBXTalk Moose DrGeo PharoMarea released between 25%and 40% of the used memory. 28
  137. 137. Original = 100% With Marea Measured minimun 100 75% of memory 50 25 0 DBXTalk Moose DrGeo PharoMarea released between 25% There is stilland 40% of the used memory. room for improvement. 28
  138. 138. Speed overhead• For typical uses is 0%.• For non covered uses: 29
  139. 139. Speed overhead• For typical uses is 0%. Swap in Swap out• For non covered uses: 300 225 Time (ms) 150 75 0 51 236 777 5758 21753 Graph size (amount of objects) 29
  140. 140. Speed overhead• For typical uses is 0%. Swap in Swap out• For non covered uses: 300 225 Time (ms) 150 75 0 51 236 777 5758 21753 Graph size (amount of objects) Swapping in is faster than swapping out. 29
  141. 141. Speed overhead• For typical uses is 0%. Swap in Swap out• For non covered uses: 300 225 Time (ms) 150 75 0 51 236 777 5758 21753 Graph size (amount of objects) Swapping in is faster The graph size has a small than swapping out. impact in small/medium graphs. 29
  142. 142. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 30
  143. 143. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 30
  144. 144. Comparison criteria• Efficient object-based swapping unit.• Uniformity.• Reversibility.• Automatic swapping in.• Automatic swapping out.• Transparency.• Controllability at the application level.• Portability. 31
  145. 145. Language level and libraries RuntimesOS related 32
  146. 146. Language level and libraries RuntimesOS related 32
  147. 147. Language level and libraries RuntimesOS related 32
  148. 148. Language level and libraries RuntimesOS related 32
  149. 149. Language level and libraries RuntimesOS related 32
  150. 150. Language level and libraries RuntimesOS related In progress 32
  151. 151. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 33
  152. 152. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 33
  153. 153. in Object Proxy Graph Toolbox SwapperObject Graph Object Serializer Graph Storage 34
  154. 154. • An extensible, uniform and fast serializer.• General-purpose.• Used in research and industry.• Integrated in Pharo 2.0 and ported to Squeak, VisualWorks and Newspeak.• ESUG Innovation Technology Awards 2011. 35
  155. 155. • An extensible, uniform and fast serializer.• General-purpose.• Used in research and industry.• Integrated in Pharo 2.0 and ported to Squeak, VisualWorks and Newspeak.• ESUG Innovation Technology Awards 2011. Martin Dias, Mariano Martinez Peck, Stéphane Ducasse and Gabriela Arévalo. Fuel: A Fast General Purpose Object Graph Serializer. Software: Practice and Experience, 2012. 35
  156. 156. • Proxify all kind of objects.• Low memory footprint.• Intercepting all messages.• Clear division between proxies and handlers.• General-purpose. 36
  157. 157. • Proxify all kind of objects.• Low memory footprint.• Intercepting all messages.• Clear division between proxies and handlers.• General-purpose. [Martinez Peck 2012a] Mariano Martinez Peck, Noury Bouraqadi, Stéphane Ducasse, Luc Fabresse and Marcus Denker. Ghost: A Uniform and Lightweight Proxy Implementation. Science of Computer Programming, 2012 (submitted + passed first review round). 36
  158. 158. Object replacement• Provided by regular VM (#become:) Specific to Smalltalk.• Different implementations Full memory scan in Pharo VM. Object header swapping in VisualWorks VM. Object tables’ entries swapping in Gemstone VM. 37
  159. 159. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 38
  160. 160. Outline1. Context, problem and introduction.2. My proposal.3. Validation.4. Related work.5. Implementation.6. Conclusion and future work 38
  161. 161. ConclusionFor an improved automatic memory management we need: GC +An application-level virtual memory We propose 39
  162. 162. Results Correct• Facade objects.• Graph intersection.• Serializer and proxies for all type of objects.• Proxies intercept all messages.• Support proxies in primitives. 40
  163. 163. Results Maximizes memory released• Small proxies.• Object graphs as swapping unit.• Proxies only for facade objects. Minimizes speed overhead• Fast serialization.• Fast detection of facade objects.• Avoid unnecessary swap in. 41
  164. 164. Future Work• Automatic graphs detection. 42
  165. 165. Visualizing Objects Usage 43
  166. 166. CusVisualizing Objects Usage trac tom eo ized bjec VM t us to age 43
  167. 167. CusVisualizing Objects Usage trac tom eo ized bjec VM t us to age 43
  168. 168. Future Work• Automatic graphs detection.• Study possible integration with GC.• Partial swap in. 44
  169. 169. List of publicationsConferences [Dias 2011] Martin Dias, Mariano Martinez Peck, Stéphane Ducasse and Gabriela Arévalo. Clustered Serialization with Fuel. In Proceedings of ESUG International Workshop on Smalltalk Technologies (IWST 2011), Edinburgh, Scotland, 2011. [Martinez Peck 2010a] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, Stéphane Ducasse and Luc Fabresse. Experiments with a Fast Object Swapper. In Smalltalks 2010, Concepción del Uruguay, Argentina, 2010. [Martinez Peck 2010b] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, Stéphane Ducasse and Luc Fabresse. Visualizing Objects and Memory Usage. In Smalltalks 2010, Concepción del Uruguay, Argentina, 2010. [Martinez Peck 2011a] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, Stéphane Ducasse and Luc Fabresse. Efficient Proxies in Smalltalk. In Proceedings of ESUG International Workshop on Smalltalk Technologies (IWST 2011), Edinburgh, Scotland, 2011. [Martinez Peck 2011b] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, Stéphane Ducasse and Luc Fabresse. Problems and Challenges when Building a Manager for Unused Objects. In Proceedings of Smalltalks 2011 International Workshop, Bernal, Buenos Aires, Argentina, 2011. 45
  170. 170. List of publications Journals [Martinez Peck 2011c] Mariano Martinez Peck, Noury Bouraqadi, Stéphane Ducasseand Luc Fabresse. Object Swapping Challenges: an Evaluation of ImageSegment.Journal of Computer Languages, Systems and Structures, vol. 38, no. 1, pages 1–15, nov 2011. [Dias 2012] Martin Dias, Mariano Martinez Peck, Stéphane Ducasse and GabrielaArévalo. Fuel: A Fast General Purpose Object Graph Serializer. Software: Practice andExperience, 2012. [Martinez Peck 2012a] Mariano Martinez Peck, Noury Bouraqadi, Stéphane Ducasse,Luc Fabresse and Marcus Denker. Ghost: A Uniform and Lightweight ProxyImplementation. Science of Computer Programming, 2012 (submitted + passed firstreview round). [Martinez Peck 2012b] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker,Stéphane Ducasse and Luc Fabresse. Object-Based Virtual Memory Brought To TheApplication Level. Journal of Object Technology, 2012 (submitted). 46
  171. 171. In summary... • We implemented a novel and efficient application-level virtual memory for object- oriented systems. • Almost no need from the VM and fully implemented in the language side. • Users can decide and influence what and when to swap. Thanks! Mariano Martinez Peck 47
  172. 172. Fuel Features• It is a fast, well-designed, concrete, general- purpose and flexible binary serializer.• Can serialize/materialize not only plain objects but also classes, traits, methods, closures, contexts, packages, etc.• Support for global references.• Large number of hooks: ignore certain instance variables, substitute objects by others, post and pre serialization and materialization actions.• Supports class rename and class reshape.
  173. 173. Key Characteristics• Pickle format.• Objects grouped in clusters.• Analysis phase before writing.• Stack over recursion.• Two phases for writing instances and references.• Iterative graph recreation.
  174. 174. Success stories• Export and import of Moose models.• Pier CMS persistency (and export/import)• Backend of SandstoneDB, SimplePersistence and NoSQL databases.• BioSmalltalk: serialize big DNA or proteins.• PharoKernel regeneration and bootstrap (Hazelnut).• Presenty UI and Gaucho frameworks.• Revive test failures from Jenkins and materialize debuggers in another image.• Serialization for remote programming (Seamless).• Tanker (export/import packages of code).• Several commercial applications.
  175. 175. Traditional proxiesUsage of a minimal object together with an implementation of a custom #doesNotUnderstand ProtoObject identityHash pointersTo nextObject ... Proxy target doesNotUnderstand: executeBeforeHandling executeAfterHandling
  176. 176. Problems #doesNotUnderstand: cannot be trapped like aregular message.Mix of handling procedure and proxy interception. Only methods that are not understood areintercepted.No separation between proxies and handlers This approach is not stratified
  177. 177. Ghost features• It is stratified, it intercept all messages and there are proxies and handlers.• Uniform: it can proxy classes, methods, etc.• Low memory footprint.• Easy debugging.
  178. 178. Traditional Ghost#doesNotUnderstand: #cannotInterpret: iscannot be trapped like a trapped like a regularregular message. message.Mix of handling No mix of handlingprocedure and proxy procedure and proxyinterception. interception.Only methods that are “All” methods arenot understood are intercepted.intercepted.No separation between Clear separation betweenproxies and handlers. proxies and handlers.
  179. 179. Classes with no MethodDictionary References Object instance of message send lookup subclass Proxy cannotInterpret: aMessage aProxy username 4: #cannotInterpret: lookup 1: #username send ProxyTrap methodDict := nil aProxy 2: #aProxy lookup 3: Since the method dictionary was nil, the VM sends #cannotInterpret tothe receiver but starting the lookup in the superclass
  180. 180. Object Interception InterceptionDelegator message MethodLookup cannotInterpret: proxy InterceptionDelegator receiver <<methodDict := nil>> cannotInterpret: ProxyTrap superclass AbstractProxy proxyHandler AbstractProxyHandler AbstractClassProxy handleInterception: anInterception superclass handleInterceptionToInstance: anObject methodDict handleMethodExecution: anInterception proxyInitializeFrameworkApplication handler SimpleForwarderHandler TargetBasedClassProxy TargetBasedProxy handleInterception: anInterception handler handler handleInterceptionToInstance: anObject target target handleMethodExecution: anInterception handler proxyHandler proxyHandler proxyTarget proxyTarget createProxyFor:handler: createProxyFor:handler: createProxyAndReplace:handler: createProxyAndReplace:handler:
  181. 181. ConclusionWith a little bit of special support from theVM (#cannotInterpret hook), we can have animage-side proxy solution much better thanthe classic #doesNotUnderstand: [Martinez Peck 2012a] Mariano Martinez Peck, Noury Bouraqadi, Stéphane Ducasse, Luc Fabresse and Marcus Denker. Ghost: A Uniform and Lightweight Proxy Implementation. Science of Computer Programming, 2012 (in submission, accepted with major revision).
  182. 182. ObjectTracer VM • A Pharo Smalltalk virtual machine that traces object usage. • Let us query which objects has been used and which ones have not.http://ss3.gemstone.com/ss/ObjectUsageTracer.html
  183. 183. Results
  184. 184. ImageSegment (an object swapper for Squeak Smalltalk)Good swapping unit: graphs.It does not swap shared objects.It cannot swap classes and methods.It scans the whole memory twice for each graph.Implemented in the VM side.No support for graph intersection. Mariano Martinez Peck, Noury Bouraqadi,Stéphane Ducasse and Luc Fabresse. Object Swapping Challenges: an Evaluation of ImageSegment. Journal of Computer Languages, Systems and Structures, vol. 38, no. 1, pages 1–15, nov 2011.
  185. 185. Forwarding pointers• To maintain correctness when we cannot proxify certain objects.
  186. 186. Speed analysis
  187. 187. Primary memory Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory B’ A’ C’ 1 2 3 42.swap
  188. 188. Primary memory Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory B’ A’ C’ 1 2 3 42.swap
  189. 189. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID B’ A’ C’ 1 2 3 42.swap
  190. 190. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap D’ Pc’ 1 2 43.swap
  191. 191. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable Pd 43 1 SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 1 2 3 42.swap D’ Pc’ 1 2 43.swap
  192. 192. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable Pd 43 1 SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap D’ Pc’ 1 2 43.swap
  193. 193. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable Pd 43 1 SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 42.swap D’ Pc’ 1 2 43.swap
  194. 194. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable Pd 43 1 SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Store shared proxy 42.swap D’ Pc’ 1 2 43.swap
  195. 195. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 GraphTable Pd 43 1 49194 Pc SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Store shared proxy 42.swap D’ Pc’ 1 2 43.swap
  196. 196. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 43 Pd Pc GraphTable Pd (weak array) 43 1 49194 Pc SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Store shared proxy 42.swap 6) Update GraphTable D’ Pc’ 1 2 43.swap
  197. 197. Primary memory Graph ID: 43 Intersections... Pa Pc 42 (weak array) Pa Pc D 42 2 42 3 43 Pd Pc GraphTable Pd (weak array) 43 1 49194 Pc SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Store shared proxy 42.swap 6) Update GraphTable D’ Pc’ 7) GC runs 1 2 43.swap
  198. 198. Primary memory Intersections... Pa Pc 42 (weak array) Pa Pc 42 2 42 3 43 Pd Pc GraphTable Pd (weak array) 43 1 49194 Pc SharedProxiesTable (key: proxyID / value: object or proxy)Secondary memory 1) Assign graph ID 2) Serialize the object graph 3) Create and associate proxies (not for proxies) B’ A’ C’ 4) Replace original objects with proxies 1 2 3 5) Store shared proxy 42.swap 6) Update GraphTable D’ Pc’ 7) GC runs 1 2 43.swap

×