SlideShare une entreprise Scribd logo
1  sur  210
Application-Level
  Virtual Memory for
Object-Oriented Systems
     Mariano Martinez Peck




                             1
Application-Level
  Virtual Memory for
Object-Oriented Systems
     Mariano Martinez Peck




                             2
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        3
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        3
Context




          4
Context




          4
Context




          4
Context




          4
Context




          4
Context




          4
We need to optimize
memory management


                      5
Context
• Object-oriented programming. Why?
     Most modern and widespread.
     Memory is usually automatically managed (GC).
• Dynamic languages. Why?
     Powerful.
     More and more used.

                                                     6
In this context of OOP,
is GC actually enough to
    optimize memory
      management?

                           7
% used objects ?     % used memory ?
% unused objects ?   % unused memory ?




                                    8
% 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
% 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
% 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
% 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
Unused objects
   Referenced.
   GC cannot collect them!
   Waste primary memory.




                             9
Unused objects
   Referenced.
   GC cannot collect them!
   Waste primary memory.




    No, the GC is not enough
                               9
OS’ Virtual Memory is
   not the answer

• It only swaps pages.
• Developers cannot easily influence it.

                                          10
Thesis statement
A virtual memory for dynamic OOP languages
should be:
   Application-aware
   Efficient




                                             11
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        12
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        12
A model for efficient application-level virtual
  memory:
• Designed for dynamic OOP
• Based on the swapping of object graphs


                                                   13
Primary memory




                Swap out             Swap in
              unused object       needed object
                 graphs               graphs

Secondary memory


                                        cloud

        file            database
                                                  14
Primary memory




                Swap out             Swap in
              unused object       needed object
                 graphs               graphs

Secondary memory


                                        cloud

        file            database
                                                  14
Primary memory

                   Y       A
                       B       C

                       E       F


Secondary memory




                                   15
Primary memory

                   Y             A
                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory




                                                           15
Primary memory

                   Y             A
                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           15
Primary memory

                   Y             A
                                 Pa


                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           15
Primary memory

                   Y             Pa




              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           15
Primary memory

                   Y          Pa




Secondary memory




                       bytes (A,B,C,E,F)
                                           15
Primary memory

                   Y          Pa




Secondary memory




                       bytes (A,B,C,E,F)
                                           15
Primary memory

                   Y          Pa




                          Memory
                          Released


Secondary memory




                       bytes (A,B,C,E,F)
                                           15
Primary memory

                   Y          Pa




                          Memory
                          Released


Secondary memory

                               Swap in


                       bytes (A,B,C,E,F)
                                           15
Primary memory

                   Y       A
                       B       C

                       E       F


Secondary memory




                                   15
Primary memory

                   Y       A
                       B       C

                       E       F


Secondary memory




                                   16
Primary memory

                   Y       A       D

                       B       C

                       E       F


Secondary memory




                                       16
Primary memory

                   Y             A                D

                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory




                                                           16
Primary memory

                   Y             A                D

                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           16
Primary memory

                   Y             A
                                 Pa               D

                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           16
Primary memory

                   Y             Pa               D

                                       C

                             E
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           16
Primary memory

                   Y           Pa          D

                                    C

                           E


Secondary memory




                       bytes (A,B,C,E,F)
                                               16
Primary memory

                   Y           Pa          D

                                    C

                           E


Secondary memory




                       bytes (A,B,C,E,F)
                                               16
Primary memory

                   Y           Pa          D

                                    C

                           E


Secondary memory

                                Swap in


                       bytes (A,B,C,E,F)
                                               16
Primary memory

                   Y           Pa          D

                                    C

                           E


Secondary memory

                                Swap in


                       bytes (A,B,C,E,F)
                                               16
Primary memory

                   Y           Pa          D

                                    C

                           E


Secondary memory

                                Swap in


                       bytes (A,B,C,E,F)
                                               16
Primary memory

                   Y         A       D

                        B    C   C

                       E E       F


Secondary memory




                                         16
Primary memory

                   Y         A       D

                        B    C   C

                       E E       F


Secondary memory




                                         16
Primary memory

                   Y         A       D

                        B    C   C

                       E E       F


Secondary memory




            INCORRECT!!!                 16
Objectives

Correctness: SwapIn(SwapOut(X))==X
Maximize memory released.
Minimize runtime overhead.




                                     17
subsystems

   Object
   Graph          Proxy
  Swapper        Toolbox


                 Object
Object Graph
                  Graph
 Serializer
                 Storage

                            18
Primary memory

                   Y       A       D

                       B       C

                       E       F


Secondary memory




                                       19
Primary memory

                   Y             A                D

                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory




                                                           19
Primary memory

                   Y             A                D

                            B          C

                             E        F
              Memory occupied by graph of unused objects

Secondary memory

                 Swap out


                        bytes (A,B,C,E,F)
                                                           19
Primary memory

                    Y              A                D

                              B          C
   facade objects
                               E        F
                Memory occupied by graph of unused objects

Secondary memory

                    Swap out


                          bytes (A,B,C,E,F)
                                                             19
Primary memory

                    Y              A
                                   Pa               D

                              B          C
                                         Pc

   facade objects
   proxy                       E        F
                Memory occupied by graph of unused objects

Secondary memory

                    Swap out


                          bytes (A,B,C,E,F)
                                                             19
Primary memory

                    Y              Pa               D
                                          Pc

   facade objects
   proxy
                Memory occupied by graph of unused objects

Secondary memory

                    Swap out


                          bytes (A,B,C,E,F)
                                                             19
Primary memory

                    Y          Pa           D
                                     Pc

   facade objects
   proxy


Secondary memory




                        bytes (A,B,C,E,F)
                                                19
Primary memory

                    Y          Pa           D
                                     Pc

   facade objects
   proxy


Secondary memory




                        bytes (A,B,C,E,F)
                                                19
Primary memory

                    Y          Pa           D
                                     Pc

   facade objects
   proxy


Secondary memory

                                Swap in


                        bytes (A,B,C,E,F)
                                                19
Primary memory

                    Y       A       D

                        B       C
   facade objects
   proxy                E       F


Secondary memory




                                        19
How to efficiently detect
 and manage facade objects?

• Back-pointers.
• Whole memory scan.   Y       A       D

                           B       C

                           E       F
                                       20
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
Primary memory     Swapping out
        A          D
                          GraphTable
    B       C



Secondary memory




                                       21
Primary memory     Swapping out
        A          D
                          GraphTable
    B       C



Secondary memory




                                       21
Primary memory         Swapping out
        Graph ID: 42

        A              D
                                     GraphTable
    B        C



Secondary memory           1) Assign graph ID




                                                  21
Primary memory          Swapping out
        Graph ID: 42

        A               D
                                        GraphTable
    B           C



Secondary memory             1) Assign graph ID
                            2) Serialize the object graph
         B’ A’ C’
            1   2   3


            42.swap
                                                            21
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
                                proxiesDict
Secondary memory                    1) Assign graph ID
                                   2) Serialize the object graph
                                   3) Create and associate proxies
            B’ A’ C’
             1   2      3


             42.swap
                                                                     21
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
                                proxiesDict
Secondary memory                    1) Assign graph ID
                                   2) Serialize the object graph
                                   3) Create and associate proxies
            B’ A’ C’
             1   2      3


             42.swap
                                                                     21
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
                                proxiesDict
Secondary memory                    1) Assign graph ID
                                   2) Serialize the object graph
                                   3) Create and associate proxies
            B’ A’ C’
             1   2      3


             42.swap
                                                                     21
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
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
                                proxiesDict
Secondary 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
Primary memory          Swapping out
  Pa         Pc                            42          Pa nil Pc
                        D                               (weak array)
  42 2       42 3
                            Pa A       GraphTable
                            Pb B
                            Pc C

Secondary 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
Primary memory          Swapping out
  Pa         Pc                            42          Pa nil Pc
                        D                               (weak array)
  42 2       42 3
                            Pa A       GraphTable
                            Pb B
                            Pc C

Secondary 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
Primary memory          Swapping out
  Pa         Pc                            42          Pa Pc
                        D                               (weak array)
  42 2       42 3
                            Pa A       GraphTable
                            Pb B
                            Pc C

Secondary 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
Primary memory
                        Swapping in
   Pa            Pc     D         42         Pa Pc
  42 2           42 3                        (weak array)

                                GraphTable




Secondary memory


         B’ A’ C’
         1   2      3


         42.swap
                                                       22
Primary memory
                        Swapping in
   Pa            Pc     D                      42           Pa Pc
  42 2           42 3                                      (weak array)

                                            GraphTable




Secondary memory            0) A proxy intercepts a message...


         B’ A’ C’
         1   2      3


         42.swap
                                                                     22
Primary memory
                        Swapping in
   Pa            Pc     D                      42           Pa Pc
  42 2           42 3                                      (weak array)

                                            GraphTable




Secondary memory            0) A proxy intercepts a message...


         B’ A’ C’
         1   2      3


         42.swap
                                                                     22
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
                                               materializedObjects
Secondary memory             0) A proxy intercepts a message...
                             1) Materialize the object graph

          B’ A’ C’
          1   2      3


          42.swap
                                                                         22
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
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
                                               materializedObjects
Secondary 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
Primary memory
                     Swapping in
   Pa          Pc    D
  42 2   A’   42 3

    B’        C’                         GraphTable

                             C’ Pc


Secondary 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
Primary memory
                   Swapping in
         A’        D

    B’        C’                       GraphTable

                           C’ Pc


Secondary 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
Primary memory
                   Swapping in
         A’        D

    B’        C’                       GraphTable

                           C’ Pc


Secondary 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
Primary memory
                   Swapping in
         A’        D

    B’        C’                       GraphTable

                           C’ Pc


Secondary 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
Primary memory
                            Intersections...
                                                Pa Pc
      Pa         Pc     D            42         (weak array)
      42 2       42 3

                                   GraphTable




Secondary memory

 B’ A’ C’
  1      2   3

 42.swap

                                                        23
Primary memory
                            Intersections...
                                                Pa Pc
      Pa         Pc     D            42         (weak array)
      42 2       42 3

                                   GraphTable




Secondary memory

 B’ A’ C’
  1      2   3

 42.swap

                                                        23
Primary memory
                 Graph ID: 43
                                Intersections...
                                                                  Pa Pc
      Pa            Pc      D                          42         (weak array)
      42 2          42 3

                                                     GraphTable




Secondary memory                1) Assign graph ID

 B’ A’ C’
  1      2   3

 42.swap

                                                                          23
Primary memory
                 Graph ID: 43
                                Intersections...
                                                                 Pa Pc
      Pa            Pc      D                           42       (weak array)
      42 2          42 3

                                                    GraphTable




Secondary memory                1) Assign graph ID
                                2) Serialize the object graph
 B’ A’ C’
  1      2   3

 42.swap

                                                                         23
Primary memory
                 Graph ID: 43
                                Intersections...
                                                                 Pa Pc
      Pa            Pc      D                           42       (weak array)
      42 2          42 3

                                                    GraphTable




Secondary memory                1) Assign graph ID
                                2) Serialize the object graph
 B’ A’ C’
  1      2   3

 42.swap

                                                                         23
Primary memory
            Graph ID: 43
                           Intersections...
                                                            Pc
       A’              D

  B’          C’                               GraphTable




Secondary memory           1) Assign graph ID
                           2) Serialize the object graph




                                                             23
Primary memory
            Graph ID: 43
                             Intersections...
                                                              Pc
       A’                D

  B’          C’                                 GraphTable




Secondary memory             1) Assign graph ID
                             2) Serialize the object graph



                D’ C’
                1   2

               43.swap                                         23
Primary memory
            Graph ID: 43
                             Intersections...
                                                              Pc
       A’                D

  B’          C’                                 GraphTable




Secondary memory             1) Assign graph ID
                             2) Serialize the object graph
                             ...) as usually...

                D’ C’
                1   2

               43.swap                                         23
Primary memory
            Graph ID: 43
                           Intersections...
                                                            Pc
       A’              D

  B’          C’                               GraphTable




Secondary 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
Primary memory
                            Intersections...
                                                Pa Pc
      Pa         Pc     D            42         (weak array)
      42 2       42 3

                                   GraphTable




Secondary memory

 B’ A’ C’
  1      2   3

 42.swap

                                                        24
Primary memory
                            Intersections...
                                                Pa Pc
      Pa         Pc     D            42         (weak array)
      42 2       42 3

                                   GraphTable




Secondary memory

 B’ A’ C’
  1      2   3

 42.swap

                                                        24
Primary memory
                 Graph ID: 43
                                  Intersections...
                                                                  Pa Pc
      Pa            Pc      D                          42         (weak array)
      42 2          42 3

                                                     GraphTable




Secondary memory                1) Assign graph ID

 B’ A’ C’
  1      2   3

 42.swap

                                                                          24
Primary memory
                 Graph ID: 43
                                  Intersections...
                                                                         Pa Pc
      Pa               Pc   D                             42            (weak array)
      42 2          42 3

                                                       GraphTable




Secondary 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
Primary memory
                 Graph ID: 43
                                       Intersections...
                                                                              Pa Pc
      Pa               Pc     D                                42            (weak array)
      42 2          42 3

                       Ppc    Pd                            GraphTable
                       43 2   43 1




Secondary 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
Primary memory
                 Graph ID: 43
                                       Intersections...
                                                                              Pa Pc
      Pa               Pc     D                                42            (weak array)
      42 2          42 3

                       Ppc    Pd                            GraphTable
                       43 2   43 1




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          D’ Pc’
                   1     2

                 43.swap                                                             24
Primary memory
                 Graph ID: 43
                                       Intersections...
                                                                              Pa Pc
      Pa               Pc     D                                42            (weak array)
      42 2          42 3

                       Ppc    Pd                            GraphTable
                       43 2   43 1




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          D’ Pc’
                   1     2

                 43.swap                                                             24
Primary memory
                 Graph ID: 43
                                       Intersections...
                                                                              Pa Pc
      Pa               Pc     D                                42            (weak array)
      42 2          42 3

                       Ppc    Pd                            GraphTable
                       43 2   43 1




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          D’ Pc’
                   1     2

                 43.swap                                                             24
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 2




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’
                   1     2

                 43.swap                                                             24
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 2




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
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
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
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
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
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
Primary memory
                           Intersections...
                    D’                                                 nil

        A’
                                                GraphTable
   B’        C’   Pc’
                  42 3



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
                         6) GC runs
                         7) Swap in graph 42
                         8) Swap in graph 43...
                                                                        24
Primary memory
                           Intersections...
                    D’                                                 nil

        A’
                                                GraphTable
   B’        C’   Pc’
                  42 3



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
                         6) GC runs
                         7) Swap in graph 42
                         8) Swap in graph 43...
                                                                        24
Primary memory
                           Intersections...
                    D’                                                 nil

        A’
                                                GraphTable
   B’        C’   Pc’
                  42 3



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
                         6) GC runs
              INCORRECT!!!
                         7) Swap in graph 42
                         8) Swap in graph 43...
                                                                        24
Graph intersections
• Avoiding proxies for proxies (Ppc) does not solve
the problem either.
• Several scenarios for swapping in
swapped intersecting graphs.




                                                      25
Graph intersections
• Avoiding proxies for proxies (Ppc) does not solve
the problem either.
• Several scenarios for swapping in
swapped intersecting graphs.



               Marea solves all these
             scenarios and challenges.

                                                      25
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        26
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        26
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
Original = 100%   With Marea           Measured minimun
              100


               75
% of memory




               50


               25


                0
                      DBXTalk   Moose        DrGeo         Pharo




                                                                   28
Original = 100%   With Marea           Measured minimun
              100


               75
% of memory




               50


               25


                0
                      DBXTalk   Moose        DrGeo         Pharo


Marea released between 25%
and 40% of the used memory.
                                                                   28
Original = 100%   With Marea           Measured minimun
              100


               75
% of memory




               50


               25


                0
                      DBXTalk   Moose        DrGeo         Pharo


Marea released between 25%                       There is still
and 40% of the used memory.                  room for improvement.
                                                                   28
Speed overhead
• For typical uses is 0%.
• For non covered uses:




                              29
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
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
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
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        30
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        30
Comparison criteria
• Efficient object-based swapping unit.
• Uniformity.
• Reversibility.
• Automatic swapping in.
• Automatic swapping out.
• Transparency.
• Controllability at the application level.
• Portability.                                31
Language level and libraries

         Runtimes
OS related




                                        32
Language level and libraries

         Runtimes
OS related




                                        32
Language level and libraries

         Runtimes
OS related




                                        32
Language level and libraries

         Runtimes
OS related




                                        32
Language level and libraries

         Runtimes
OS related




                                        32
Language level and libraries

         Runtimes
OS related




                In progress


                                        32
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        33
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        33
in

   Object            Proxy
   Graph            Toolbox
  Swapper

Object Graph   Object
 Serializer     Graph
               Storage


                              34
• 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
• 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
• Proxify all kind of objects.
• Low memory footprint.
• Intercepting all messages.
• Clear division between proxies and handlers.
• General-purpose.

                                                 36
• 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
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
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        38
Outline
1. Context, problem and introduction.
2. My proposal.
3. Validation.
4. Related work.
5. Implementation.
6. Conclusion and future work

                                        38
Conclusion
For an improved automatic memory
       management we need:
                GC
                 +
An application-level virtual memory


         We propose



                                      39
Results

  Correct
• Facade objects.
• Graph intersection.
• Serializer and proxies for all type of objects.
• Proxies intercept all messages.
• Support proxies in primitives.


                                                    40
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
Future Work

• Automatic graphs detection.



                                42
Visualizing Objects Usage




                            43
Cus
Visualizing Objects Usage
                  trac tom
                       eo  ized
                         bjec VM
                              t us to
                                  age




                                   43
Cus
Visualizing Objects Usage
                  trac tom
                       eo  ized
                         bjec VM
                              t us to
                                  age




                                   43
Future Work

• Automatic graphs detection.
• Study possible integration with GC.
• Partial swap in.

                                        44
List of publications
Conferences
   [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
List of publications
  Journals
   [Martinez Peck 2011c] 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.

  [Dias 2012] 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.

  [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).

   [Martinez Peck 2012b] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker,
Stéphane Ducasse and Luc Fabresse. Object-Based Virtual Memory Brought To The
Application Level. Journal of Object Technology, 2012 (submitted).



                                                                                               46
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
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.
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.
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.
Traditional proxies
Usage of a minimal object together with an implementation of a
                custom #doesNotUnderstand

         ProtoObject
     identityHash
     pointersTo
     nextObject
     ...



           Proxy
   target
   doesNotUnderstand:
   executeBeforeHandling
   executeAfterHandling
Problems
 #doesNotUnderstand: cannot be trapped like a
regular message.

Mix of handling procedure and proxy interception.

 Only methods that are not understood are
intercepted.

No separation between proxies and handlers

                This approach is not stratified
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.
Traditional                     Ghost
#doesNotUnderstand:        #cannotInterpret: is
cannot be trapped like a   trapped like a regular
regular message.           message.
Mix of handling            No mix of handling
procedure and proxy        procedure and proxy
interception.              interception.
Only methods that are
                           “All” methods are
not understood are
                           intercepted.
intercepted.
No separation between      Clear separation between
proxies and handlers.      proxies and handlers.
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 to
the receiver but starting the lookup in the superclass
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
                 proxyInitialize

Framework
Application                                          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:
Conclusion
With a little bit of special support from the
VM (#cannotInterpret hook), we can have an
image-side proxy solution much better than
the 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).
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
Results
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.
Forwarding pointers


• To maintain correctness when we cannot
  proxify certain objects.
Speed analysis
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
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
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
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
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
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
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
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
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
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
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
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
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
                              8) Swap in graph 42
                 43.swap
Primary memory
                                      Intersections...
                                                                                Pa C’
                                                                    42          (weak array)
                         Pc
                      42 3                                          43          Pd C’
               A’              Pd
                                                                   GraphTable   (weak array)
                               43 1
      B’              C’
                                                 49194 C’
                                                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
                                  8) Swap in graph 42
                    43.swap
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems
Application-Level Virtual Memory for Object-Oriented Systems

Contenu connexe

Tendances

Master Thesis presentation
Master Thesis presentationMaster Thesis presentation
Master Thesis presentationBogdan Vasilescu
 
Powerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaPowerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaDr Mohan Savade
 
Dissertation proposal defense slideshow; phenomenology, qualitative
Dissertation proposal defense slideshow; phenomenology, qualitativeDissertation proposal defense slideshow; phenomenology, qualitative
Dissertation proposal defense slideshow; phenomenology, qualitativeCorey Caugherty
 
Ashbaugh dissertation defense presentation
Ashbaugh dissertation defense presentationAshbaugh dissertation defense presentation
Ashbaugh dissertation defense presentationDRMLAID
 
Proposal defense presentation
Proposal defense presentationProposal defense presentation
Proposal defense presentationRuchika Mehresh
 
Dissertation oral defense presentation
Dissertation   oral defense presentationDissertation   oral defense presentation
Dissertation oral defense presentationDr. Naomi Mangatu
 
Dissertation Defense Presentation
Dissertation Defense PresentationDissertation Defense Presentation
Dissertation Defense PresentationDr. Timothy Kelly
 
Final thesis presentation
Final thesis presentationFinal thesis presentation
Final thesis presentationPawan Singh
 
EdD: Dissertation Defence
EdD: Dissertation Defence EdD: Dissertation Defence
EdD: Dissertation Defence RDC ZP
 
Thesis Power Point Presentation
Thesis Power Point PresentationThesis Power Point Presentation
Thesis Power Point Presentationriddhikapandya1985
 
Optimization problems and algorithms
Optimization problems and  algorithmsOptimization problems and  algorithms
Optimization problems and algorithmsAboul Ella Hassanien
 
My Thesis Defense Presentation
My Thesis Defense PresentationMy Thesis Defense Presentation
My Thesis Defense PresentationDavid Onoue
 
First Year Report, PhD presentation
First Year Report, PhD presentationFirst Year Report, PhD presentation
First Year Report, PhD presentationBang Xiang Yong
 
Transfer learning-presentation
Transfer learning-presentationTransfer learning-presentation
Transfer learning-presentationBushra Jbawi
 
Masters Thesis Defense Presentation
Masters Thesis Defense PresentationMasters Thesis Defense Presentation
Masters Thesis Defense Presentationnancyanne
 
Dissertation defense power point
Dissertation defense power pointDissertation defense power point
Dissertation defense power pointKelly Dodson
 

Tendances (20)

Master Thesis presentation
Master Thesis presentationMaster Thesis presentation
Master Thesis presentation
 
1 Year PhD Presentation
1 Year PhD Presentation1 Year PhD Presentation
1 Year PhD Presentation
 
Powerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD VivaPowerpoint Presentation of PhD Viva
Powerpoint Presentation of PhD Viva
 
Msc Thesis - Presentation
Msc Thesis - PresentationMsc Thesis - Presentation
Msc Thesis - Presentation
 
Dissertation proposal defense slideshow; phenomenology, qualitative
Dissertation proposal defense slideshow; phenomenology, qualitativeDissertation proposal defense slideshow; phenomenology, qualitative
Dissertation proposal defense slideshow; phenomenology, qualitative
 
Ashbaugh dissertation defense presentation
Ashbaugh dissertation defense presentationAshbaugh dissertation defense presentation
Ashbaugh dissertation defense presentation
 
Proposal defense presentation
Proposal defense presentationProposal defense presentation
Proposal defense presentation
 
Dissertation oral defense presentation
Dissertation   oral defense presentationDissertation   oral defense presentation
Dissertation oral defense presentation
 
Dissertation Defense Presentation
Dissertation Defense PresentationDissertation Defense Presentation
Dissertation Defense Presentation
 
Metaheuristics
MetaheuristicsMetaheuristics
Metaheuristics
 
Final thesis presentation
Final thesis presentationFinal thesis presentation
Final thesis presentation
 
Deep learning presentation
Deep learning presentationDeep learning presentation
Deep learning presentation
 
EdD: Dissertation Defence
EdD: Dissertation Defence EdD: Dissertation Defence
EdD: Dissertation Defence
 
Thesis Power Point Presentation
Thesis Power Point PresentationThesis Power Point Presentation
Thesis Power Point Presentation
 
Optimization problems and algorithms
Optimization problems and  algorithmsOptimization problems and  algorithms
Optimization problems and algorithms
 
My Thesis Defense Presentation
My Thesis Defense PresentationMy Thesis Defense Presentation
My Thesis Defense Presentation
 
First Year Report, PhD presentation
First Year Report, PhD presentationFirst Year Report, PhD presentation
First Year Report, PhD presentation
 
Transfer learning-presentation
Transfer learning-presentationTransfer learning-presentation
Transfer learning-presentation
 
Masters Thesis Defense Presentation
Masters Thesis Defense PresentationMasters Thesis Defense Presentation
Masters Thesis Defense Presentation
 
Dissertation defense power point
Dissertation defense power pointDissertation defense power point
Dissertation defense power point
 

En vedette

Powerpoint of randomness
Powerpoint of randomnessPowerpoint of randomness
Powerpoint of randomnessjeccarogers
 
Towards Test-Driven Development for Mobile Robots
Towards Test-Driven Development for Mobile RobotsTowards Test-Driven Development for Mobile Robots
Towards Test-Driven Development for Mobile RobotsNoury Bouraqadi
 
Towards Live Programming in ROS with PhaROS and LRP
Towards Live Programming in ROS with PhaROS and LRPTowards Live Programming in ROS with PhaROS and LRP
Towards Live Programming in ROS with PhaROS and LRPNoury Bouraqadi
 
Smalltalk to Rule all Robots
Smalltalk to Rule all RobotsSmalltalk to Rule all Robots
Smalltalk to Rule all RobotsNoury Bouraqadi
 
First Tests of a Helper Robot in a Shopping Mall
First Tests of a Helper Robot in a Shopping MallFirst Tests of a Helper Robot in a Shopping Mall
First Tests of a Helper Robot in a Shopping MallNoury Bouraqadi
 
PhaROS: Towards Live Environments in Robotics
PhaROS: Towards Live Environments in RoboticsPhaROS: Towards Live Environments in Robotics
PhaROS: Towards Live Environments in RoboticsSantiago Bragagnolo
 
Talking to Robots with Pharo
Talking to Robots with PharoTalking to Robots with Pharo
Talking to Robots with PharoNoury Bouraqadi
 
PharoJS
PharoJSPharoJS
PharoJSESUG
 
Unsupervised Partial Parsing: Thesis defense
Unsupervised Partial Parsing: Thesis defenseUnsupervised Partial Parsing: Thesis defense
Unsupervised Partial Parsing: Thesis defenseElias Ponvert
 
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...Gary Broils, DBA, PMP
 
Understanding design thinking in practice: a qualitative study of design led ...
Understanding design thinking in practice: a qualitative study of design led ...Understanding design thinking in practice: a qualitative study of design led ...
Understanding design thinking in practice: a qualitative study of design led ...Zaana Jaclyn
 
Robots Mobiles & Autonomes avec Pharo
Robots Mobiles & Autonomes avec PharoRobots Mobiles & Autonomes avec Pharo
Robots Mobiles & Autonomes avec PharoNoury Bouraqadi
 
PhD defence presentation
PhD defence presentationPhD defence presentation
PhD defence presentationcsteinmann
 

En vedette (14)

Powerpoint of randomness
Powerpoint of randomnessPowerpoint of randomness
Powerpoint of randomness
 
Towards Test-Driven Development for Mobile Robots
Towards Test-Driven Development for Mobile RobotsTowards Test-Driven Development for Mobile Robots
Towards Test-Driven Development for Mobile Robots
 
Towards Live Programming in ROS with PhaROS and LRP
Towards Live Programming in ROS with PhaROS and LRPTowards Live Programming in ROS with PhaROS and LRP
Towards Live Programming in ROS with PhaROS and LRP
 
Smalltalk to Rule all Robots
Smalltalk to Rule all RobotsSmalltalk to Rule all Robots
Smalltalk to Rule all Robots
 
First Tests of a Helper Robot in a Shopping Mall
First Tests of a Helper Robot in a Shopping MallFirst Tests of a Helper Robot in a Shopping Mall
First Tests of a Helper Robot in a Shopping Mall
 
PhaROS: Towards Live Environments in Robotics
PhaROS: Towards Live Environments in RoboticsPhaROS: Towards Live Environments in Robotics
PhaROS: Towards Live Environments in Robotics
 
Smalltalk and Business
Smalltalk and BusinessSmalltalk and Business
Smalltalk and Business
 
Talking to Robots with Pharo
Talking to Robots with PharoTalking to Robots with Pharo
Talking to Robots with Pharo
 
PharoJS
PharoJSPharoJS
PharoJS
 
Unsupervised Partial Parsing: Thesis defense
Unsupervised Partial Parsing: Thesis defenseUnsupervised Partial Parsing: Thesis defense
Unsupervised Partial Parsing: Thesis defense
 
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...
Gary Broils, D.B.A. - Dissertation Defense: Virtual Teaming and Collaboration...
 
Understanding design thinking in practice: a qualitative study of design led ...
Understanding design thinking in practice: a qualitative study of design led ...Understanding design thinking in practice: a qualitative study of design led ...
Understanding design thinking in practice: a qualitative study of design led ...
 
Robots Mobiles & Autonomes avec Pharo
Robots Mobiles & Autonomes avec PharoRobots Mobiles & Autonomes avec Pharo
Robots Mobiles & Autonomes avec Pharo
 
PhD defence presentation
PhD defence presentationPhD defence presentation
PhD defence presentation
 

Similaire à Application-Level Virtual Memory for Object-Oriented Systems

Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersPeter Ledbrook
 
Introduction to mobile programming with Androids.
Introduction to mobile programming with Androids. Introduction to mobile programming with Androids.
Introduction to mobile programming with Androids. Maksim Golivkin
 
Symantec 2010 Windows 7 Migration Survey
Symantec 2010 Windows 7 Migration SurveySymantec 2010 Windows 7 Migration Survey
Symantec 2010 Windows 7 Migration SurveySymantec
 
[B3]couchbase server for speed and scale with interactive applications sdec...
[B3]couchbase server for speed and scale with interactive applications   sdec...[B3]couchbase server for speed and scale with interactive applications   sdec...
[B3]couchbase server for speed and scale with interactive applications sdec...NAVER D2
 
Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Fwdays
 
Android Performance Tips & Tricks
Android Performance Tips & TricksAndroid Performance Tips & Tricks
Android Performance Tips & TricksSergii Zhuk
 
Mitx Slides July07 1
Mitx Slides July07 1Mitx Slides July07 1
Mitx Slides July07 1Compete
 
Modernize your Solaris Apps
Modernize your Solaris AppsModernize your Solaris Apps
Modernize your Solaris AppsAppZero
 
Agileload - load testing tool for better web performance
Agileload - load testing tool for better web performanceAgileload - load testing tool for better web performance
Agileload - load testing tool for better web performanceAgileload testing
 
Applico Android Info Session at Columbia University
Applico Android Info Session at Columbia UniversityApplico Android Info Session at Columbia University
Applico Android Info Session at Columbia UniversityApplico
 
Characteristics of next generation bi tools - bi leadership web site
Characteristics of next generation bi tools - bi leadership web siteCharacteristics of next generation bi tools - bi leadership web site
Characteristics of next generation bi tools - bi leadership web siteEckerson Group
 
Hey you, get onto my cloud
Hey you, get onto my cloudHey you, get onto my cloud
Hey you, get onto my cloudJim Hirsch
 
A Visualization Application On AppEngine (Google Cloud)
A Visualization Application On AppEngine (Google Cloud)A Visualization Application On AppEngine (Google Cloud)
A Visualization Application On AppEngine (Google Cloud)surprisedcloud
 
GitOps Core Concepts & Ways of Structuring Your Repos
GitOps Core Concepts & Ways of Structuring Your ReposGitOps Core Concepts & Ways of Structuring Your Repos
GitOps Core Concepts & Ways of Structuring Your ReposWeaveworks
 
Mobile for PHP developers
Mobile for PHP developersMobile for PHP developers
Mobile for PHP developersIvo Jansch
 
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentée
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentéeInria Tech Talk : Améliorez vos applications de robotique & réalité augmentée
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentéeStéphanie Roger
 

Similaire à Application-Level Virtual Memory for Object-Oriented Systems (20)

Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developers
 
Introduction to mobile programming with Androids.
Introduction to mobile programming with Androids. Introduction to mobile programming with Androids.
Introduction to mobile programming with Androids.
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
 
Symantec 2010 Windows 7 Migration Survey
Symantec 2010 Windows 7 Migration SurveySymantec 2010 Windows 7 Migration Survey
Symantec 2010 Windows 7 Migration Survey
 
[B3]couchbase server for speed and scale with interactive applications sdec...
[B3]couchbase server for speed and scale with interactive applications   sdec...[B3]couchbase server for speed and scale with interactive applications   sdec...
[B3]couchbase server for speed and scale with interactive applications sdec...
 
Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"Сергей Жук "Android Performance Tips & Tricks"
Сергей Жук "Android Performance Tips & Tricks"
 
Android Performance Tips & Tricks
Android Performance Tips & TricksAndroid Performance Tips & Tricks
Android Performance Tips & Tricks
 
Mitx Slides July07 1
Mitx Slides July07 1Mitx Slides July07 1
Mitx Slides July07 1
 
Modernize your Solaris Apps
Modernize your Solaris AppsModernize your Solaris Apps
Modernize your Solaris Apps
 
Agileload - load testing tool for better web performance
Agileload - load testing tool for better web performanceAgileload - load testing tool for better web performance
Agileload - load testing tool for better web performance
 
Oow Ppt 1
Oow Ppt 1Oow Ppt 1
Oow Ppt 1
 
Open GeoSocial API
Open GeoSocial APIOpen GeoSocial API
Open GeoSocial API
 
Applico Android Info Session at Columbia University
Applico Android Info Session at Columbia UniversityApplico Android Info Session at Columbia University
Applico Android Info Session at Columbia University
 
Characteristics of next generation bi tools - bi leadership web site
Characteristics of next generation bi tools - bi leadership web siteCharacteristics of next generation bi tools - bi leadership web site
Characteristics of next generation bi tools - bi leadership web site
 
Hey you, get onto my cloud
Hey you, get onto my cloudHey you, get onto my cloud
Hey you, get onto my cloud
 
A Visualization Application On AppEngine (Google Cloud)
A Visualization Application On AppEngine (Google Cloud)A Visualization Application On AppEngine (Google Cloud)
A Visualization Application On AppEngine (Google Cloud)
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 
GitOps Core Concepts & Ways of Structuring Your Repos
GitOps Core Concepts & Ways of Structuring Your ReposGitOps Core Concepts & Ways of Structuring Your Repos
GitOps Core Concepts & Ways of Structuring Your Repos
 
Mobile for PHP developers
Mobile for PHP developersMobile for PHP developers
Mobile for PHP developers
 
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentée
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentéeInria Tech Talk : Améliorez vos applications de robotique & réalité augmentée
Inria Tech Talk : Améliorez vos applications de robotique & réalité augmentée
 

Plus de Mariano Martínez Peck

Plus de Mariano Martínez Peck (10)

Web Development with Smalltalk
Web Development with SmalltalkWeb Development with Smalltalk
Web Development with Smalltalk
 
Object garphs swapping
Object garphs swappingObject garphs swapping
Object garphs swapping
 
Metacello
MetacelloMetacello
Metacello
 
Efficient Proxies in Smalltalk
Efficient Proxies in SmalltalkEfficient Proxies in Smalltalk
Efficient Proxies in Smalltalk
 
DBXTalk: Smalltalk Relational Database Suite
DBXTalk: Smalltalk Relational Database SuiteDBXTalk: Smalltalk Relational Database Suite
DBXTalk: Smalltalk Relational Database Suite
 
Clustered Serialization with Fuel
Clustered Serialization with FuelClustered Serialization with Fuel
Clustered Serialization with Fuel
 
Building you own Pharo images with Metacello
Building you own Pharo images with Metacello Building you own Pharo images with Metacello
Building you own Pharo images with Metacello
 
Visualizing Objects and Memory Usage
Visualizing Objects and Memory UsageVisualizing Objects and Memory Usage
Visualizing Objects and Memory Usage
 
Object swapping issues and the imagesegment implementation
Object swapping issues and the imagesegment implementationObject swapping issues and the imagesegment implementation
Object swapping issues and the imagesegment implementation
 
SqueakDBX
SqueakDBXSqueakDBX
SqueakDBX
 

Application-Level Virtual Memory for Object-Oriented Systems

  • 1. Application-Level Virtual Memory for Object-Oriented Systems Mariano Martinez Peck 1
  • 2. Application-Level Virtual Memory for Object-Oriented Systems Mariano Martinez Peck 2
  • 3. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 3
  • 4. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 3
  • 10. Context 4
  • 11. We need to optimize memory management 5
  • 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. In this context of OOP, is GC actually enough to optimize memory management? 7
  • 14. % used objects ? % used memory ? % unused objects ? % unused memory ? 8
  • 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. % 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. % 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. % 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. Unused objects Referenced. GC cannot collect them! Waste primary memory. 9
  • 20. Unused objects Referenced. GC cannot collect them! Waste primary memory. No, the GC is not enough 9
  • 21. OS’ Virtual Memory is not the answer • It only swaps pages. • Developers cannot easily influence it. 10
  • 22. Thesis statement A virtual memory for dynamic OOP languages should be: Application-aware Efficient 11
  • 23. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 12
  • 24. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 12
  • 25. A model for efficient application-level virtual memory: • Designed for dynamic OOP • Based on the swapping of object graphs 13
  • 26. Primary memory Swap out Swap in unused object needed object graphs graphs Secondary memory cloud file database 14
  • 27. Primary memory Swap out Swap in unused object needed object graphs graphs Secondary memory cloud file database 14
  • 28. Primary memory Y A B C E F Secondary memory 15
  • 29. Primary memory Y A B C E F Memory occupied by graph of unused objects Secondary memory 15
  • 30. Primary memory Y A B C E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 15
  • 31. Primary memory Y A Pa B C E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 15
  • 32. Primary memory Y Pa Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 15
  • 33. Primary memory Y Pa Secondary memory bytes (A,B,C,E,F) 15
  • 34. Primary memory Y Pa Secondary memory bytes (A,B,C,E,F) 15
  • 35. Primary memory Y Pa Memory Released Secondary memory bytes (A,B,C,E,F) 15
  • 36. Primary memory Y Pa Memory Released Secondary memory Swap in bytes (A,B,C,E,F) 15
  • 37. Primary memory Y A B C E F Secondary memory 15
  • 38. Primary memory Y A B C E F Secondary memory 16
  • 39. Primary memory Y A D B C E F Secondary memory 16
  • 40. Primary memory Y A D B C E F Memory occupied by graph of unused objects Secondary memory 16
  • 41. Primary memory Y A D B C E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 16
  • 42. Primary memory Y A Pa D B C E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 16
  • 43. Primary memory Y Pa D C E Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 16
  • 44. Primary memory Y Pa D C E Secondary memory bytes (A,B,C,E,F) 16
  • 45. Primary memory Y Pa D C E Secondary memory bytes (A,B,C,E,F) 16
  • 46. Primary memory Y Pa D C E Secondary memory Swap in bytes (A,B,C,E,F) 16
  • 47. Primary memory Y Pa D C E Secondary memory Swap in bytes (A,B,C,E,F) 16
  • 48. Primary memory Y Pa D C E Secondary memory Swap in bytes (A,B,C,E,F) 16
  • 49. Primary memory Y A D B C C E E F Secondary memory 16
  • 50. Primary memory Y A D B C C E E F Secondary memory 16
  • 51. Primary memory Y A D B C C E E F Secondary memory INCORRECT!!! 16
  • 52. Objectives Correctness: SwapIn(SwapOut(X))==X Maximize memory released. Minimize runtime overhead. 17
  • 53. subsystems Object Graph Proxy Swapper Toolbox Object Object Graph Graph Serializer Storage 18
  • 54. Primary memory Y A D B C E F Secondary memory 19
  • 55. Primary memory Y A D B C E F Memory occupied by graph of unused objects Secondary memory 19
  • 56. Primary memory Y A D B C E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 19
  • 57. Primary memory Y A D B C facade objects E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 19
  • 58. Primary memory Y A Pa D B C Pc facade objects proxy E F Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 19
  • 59. Primary memory Y Pa D Pc facade objects proxy Memory occupied by graph of unused objects Secondary memory Swap out bytes (A,B,C,E,F) 19
  • 60. Primary memory Y Pa D Pc facade objects proxy Secondary memory bytes (A,B,C,E,F) 19
  • 61. Primary memory Y Pa D Pc facade objects proxy Secondary memory bytes (A,B,C,E,F) 19
  • 62. Primary memory Y Pa D Pc facade objects proxy Secondary memory Swap in bytes (A,B,C,E,F) 19
  • 63. Primary memory Y A D B C facade objects proxy E F Secondary memory 19
  • 64. How to efficiently detect and manage facade objects? • Back-pointers. • Whole memory scan. Y A D B C E F 20
  • 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. Primary memory Swapping out A D GraphTable B C Secondary memory 21
  • 67. Primary memory Swapping out A D GraphTable B C Secondary memory 21
  • 68. Primary memory Swapping out Graph ID: 42 A D GraphTable B C Secondary memory 1) Assign graph ID 21
  • 69. Primary memory Swapping out Graph ID: 42 A D GraphTable B C Secondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 21
  • 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. 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 proxiesDict Secondary 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. Primary memory Swapping out Pa Pc 42 Pa nil Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc C Secondary 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. Primary memory Swapping out Pa Pc 42 Pa nil Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc C Secondary 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. Primary memory Swapping out Pa Pc 42 Pa Pc D (weak array) 42 2 42 3 Pa A GraphTable Pb B Pc C Secondary 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. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTable Secondary memory B’ A’ C’ 1 2 3 42.swap 22
  • 84. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTable Secondary memory 0) A proxy intercepts a message... B’ A’ C’ 1 2 3 42.swap 22
  • 85. Primary memory Swapping in Pa Pc D 42 Pa Pc 42 2 42 3 (weak array) GraphTable Secondary memory 0) A proxy intercepts a message... B’ A’ C’ 1 2 3 42.swap 22
  • 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 materializedObjects Secondary memory 0) A proxy intercepts a message... 1) Materialize the object graph B’ A’ C’ 1 2 3 42.swap 22
  • 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. 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 materializedObjects Secondary 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. Primary memory Swapping in Pa Pc D 42 2 A’ 42 3 B’ C’ GraphTable C’ Pc Secondary 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. Primary memory Swapping in A’ D B’ C’ GraphTable C’ Pc Secondary 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. Primary memory Swapping in A’ D B’ C’ GraphTable C’ Pc Secondary 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. Primary memory Swapping in A’ D B’ C’ GraphTable C’ Pc Secondary 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. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory B’ A’ C’ 1 2 3 42.swap 23
  • 104. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory B’ A’ C’ 1 2 3 42.swap 23
  • 105. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory 1) Assign graph ID B’ A’ C’ 1 2 3 42.swap 23
  • 106. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 23
  • 107. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory 1) Assign graph ID 2) Serialize the object graph B’ A’ C’ 1 2 3 42.swap 23
  • 108. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTable Secondary memory 1) Assign graph ID 2) Serialize the object graph 23
  • 109. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTable Secondary memory 1) Assign graph ID 2) Serialize the object graph D’ C’ 1 2 43.swap 23
  • 110. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTable Secondary memory 1) Assign graph ID 2) Serialize the object graph ...) as usually... D’ C’ 1 2 43.swap 23
  • 111. Primary memory Graph ID: 43 Intersections... Pc A’ D B’ C’ GraphTable Secondary 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. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory B’ A’ C’ 1 2 3 42.swap 24
  • 113. Primary memory Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory B’ A’ C’ 1 2 3 42.swap 24
  • 114. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary memory 1) Assign graph ID B’ A’ C’ 1 2 3 42.swap 24
  • 115. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 GraphTable Secondary 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. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1 Secondary 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. Primary memory Graph ID: 43 Intersections... Pa Pc Pa Pc D 42 (weak array) 42 2 42 3 Ppc Pd GraphTable 43 2 43 1 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 D’ Pc’ 1 2 43.swap 24
  • 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 1 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 D’ Pc’ 1 2 43.swap 24
  • 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 1 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 D’ Pc’ 1 2 43.swap 24
  • 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 2 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’ 1 2 43.swap 24
  • 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 2 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
  • 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. 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. 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. 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. 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. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3 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 6) GC runs 7) Swap in graph 42 8) Swap in graph 43... 24
  • 128. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3 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 6) GC runs 7) Swap in graph 42 8) Swap in graph 43... 24
  • 129. Primary memory Intersections... D’ nil A’ GraphTable B’ C’ Pc’ 42 3 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 6) GC runs INCORRECT!!! 7) Swap in graph 42 8) Swap in graph 43... 24
  • 130. Graph intersections • Avoiding proxies for proxies (Ppc) does not solve the problem either. • Several scenarios for swapping in swapped intersecting graphs. 25
  • 131. Graph intersections • Avoiding proxies for proxies (Ppc) does not solve the problem either. • Several scenarios for swapping in swapped intersecting graphs. Marea solves all these scenarios and challenges. 25
  • 132. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 26
  • 133. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 26
  • 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. Original = 100% With Marea Measured minimun 100 75 % of memory 50 25 0 DBXTalk Moose DrGeo Pharo 28
  • 136. Original = 100% With Marea Measured minimun 100 75 % of memory 50 25 0 DBXTalk Moose DrGeo Pharo Marea released between 25% and 40% of the used memory. 28
  • 137. Original = 100% With Marea Measured minimun 100 75 % of memory 50 25 0 DBXTalk Moose DrGeo Pharo Marea released between 25% There is still and 40% of the used memory. room for improvement. 28
  • 138. Speed overhead • For typical uses is 0%. • For non covered uses: 29
  • 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. 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. 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. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 30
  • 143. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 30
  • 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. Language level and libraries Runtimes OS related 32
  • 146. Language level and libraries Runtimes OS related 32
  • 147. Language level and libraries Runtimes OS related 32
  • 148. Language level and libraries Runtimes OS related 32
  • 149. Language level and libraries Runtimes OS related 32
  • 150. Language level and libraries Runtimes OS related In progress 32
  • 151. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 33
  • 152. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 33
  • 153. in Object Proxy Graph Toolbox Swapper Object Graph Object Serializer Graph Storage 34
  • 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. • 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. • Proxify all kind of objects. • Low memory footprint. • Intercepting all messages. • Clear division between proxies and handlers. • General-purpose. 36
  • 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. 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. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 38
  • 160. Outline 1. Context, problem and introduction. 2. My proposal. 3. Validation. 4. Related work. 5. Implementation. 6. Conclusion and future work 38
  • 161. Conclusion For an improved automatic memory management we need: GC + An application-level virtual memory We propose 39
  • 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. 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. Future Work • Automatic graphs detection. 42
  • 166. Cus Visualizing Objects Usage trac tom eo ized bjec VM t us to age 43
  • 167. Cus Visualizing Objects Usage trac tom eo ized bjec VM t us to age 43
  • 168. Future Work • Automatic graphs detection. • Study possible integration with GC. • Partial swap in. 44
  • 169. List of publications Conferences [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. List of publications Journals [Martinez Peck 2011c] 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. [Dias 2012] 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. [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). [Martinez Peck 2012b] Mariano Martinez Peck, Noury Bouraqadi, Marcus Denker, Stéphane Ducasse and Luc Fabresse. Object-Based Virtual Memory Brought To The Application Level. Journal of Object Technology, 2012 (submitted). 46
  • 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.
  • 173.
  • 174. 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.
  • 175. 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.
  • 176. 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.
  • 177. Traditional proxies Usage of a minimal object together with an implementation of a custom #doesNotUnderstand ProtoObject identityHash pointersTo nextObject ... Proxy target doesNotUnderstand: executeBeforeHandling executeAfterHandling
  • 178. Problems #doesNotUnderstand: cannot be trapped like a regular message. Mix of handling procedure and proxy interception. Only methods that are not understood are intercepted. No separation between proxies and handlers This approach is not stratified
  • 179. 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.
  • 180. Traditional Ghost #doesNotUnderstand: #cannotInterpret: is cannot be trapped like a trapped like a regular regular message. message. Mix of handling No mix of handling procedure and proxy procedure and proxy interception. interception. Only methods that are “All” methods are not understood are intercepted. intercepted. No separation between Clear separation between proxies and handlers. proxies and handlers.
  • 181. 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 to the receiver but starting the lookup in the superclass
  • 182. 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 proxyInitialize Framework Application 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:
  • 183. Conclusion With a little bit of special support from the VM (#cannotInterpret hook), we can have an image-side proxy solution much better than the 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).
  • 184. 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
  • 186. 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.
  • 187. Forwarding pointers • To maintain correctness when we cannot proxify certain objects.
  • 189. 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
  • 190. 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
  • 191. 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
  • 192. 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
  • 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’ 1 2 3 42.swap D’ Pc’ 1 2 43.swap
  • 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 42.swap D’ Pc’ 1 2 43.swap
  • 195. 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
  • 196. 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
  • 197. 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
  • 198. 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
  • 199. 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
  • 200. 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
  • 201. 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 8) Swap in graph 42 43.swap
  • 202. Primary memory Intersections... Pa C’ 42 (weak array) Pc 42 3 43 Pd C’ A’ Pd GraphTable (weak array) 43 1 B’ C’ 49194 C’ 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 8) Swap in graph 42 43.swap