SlideShare une entreprise Scribd logo
1  sur  43
Clock-Pro: An Effective
Replacement in OS Kernel

     Xiaodong Zhang

  College of William and Mary
How to Make LIRS Work in OS Kernels?
q   Most system kernels use the CLOCK algorithm, an
    approximation of LRU.
q   We have made efforts to directly implement LIRS in
    Linux kernels, but …
q   Our experience tells us that we must build on
    existing strength.
q   CLOCK is the base for LIRS.
Basic CLOCK Replacement
        All the resident pages are placed around a circular list, like a clock;
        Each page is associated with a reference bit, indicating if the page has been
       accessed.
                                                 1     0     0
                                                                      0
                                             1                            0
                                         0                                    1
                                                                              0
                                     1           CLOCK hand                        0
                                 0                                                     1
     On a HIT                   0                                                      0
  Set Reference bit to 1
(no algorithm operations)            1                                             0
                                         1                                    0
                                             0                            0
                                                 0           1    1
                                                      0
Basic CLOCK Replacement
 Starts from the currently pointed page, and evicts the page if it is”`0”;
 Move the clock hand until reach a “0” page;
 Give “1” page a second chance, and reset its “1” to “0”

                                                    1     0     0
                                                                         0
                                                1                            0
                                            0                                    0
                                                                                 1
On a sequence of                        1           CLOCK hand                       0
  two MISSes
                                    0                                                    0
                                    0                                                    1

                                        1                                            0
                                            1                                    0
                                                0                            0
                                                    0           1    1
                                                         0
The CLOCK with a Long History




  “In the Multics system a paging algorithm has been developed that
has the implementation ease and low overhead of the FIFO strategy
and is an approximation to the LRU strategy”

                “A paging Expreiment with the Multics System” MIT Project MAC
Report MAC-M-384, May 1968, Fernando J. Corbato (1990 Turing Award Laureate)
The CLOCK has been Widely Used

Major OS                  Major OS Textbooks

Multics                    Tanebaum & Woodhull

UNIX/AIX/Linux/BSD         Silberschatz & Galvin

VAX/VMS                    Stallings (for undergraduate)

DB2

Windows/Oracle/Solaris
Prior Work on LRU versus CLOCK
LRU related work               CLOCK related work
   FBR (1990, SIGMETRICS)
                                 GCLOCK (1978, ACM TDBS)
   LRU-2 (1993, SIGMOD)

   2Q (1994, VLDB)

   SEQ (1997, SIGMETRICS)

   LRFU (1999, OSDI)

   EELRU (1999, SIGMETRICS)

   MQ (2001, USENIX)
                                 1968              2003
   LIRS (2002, SIGMETRICS)    CAR (2004, FAST)

   ARC (2003, FAST)           CLOCK-Pro (2005, USENIX)
GCLOCK Replacement

 Introduce additional page access information.
 A counter is associated with each page rather than a
 single bit;
 The counter is incremented on a page hit;
 The clock hand periodically moves, and decrements
 the counter of each block;
 The page with its counter of 0 is replaced.
Age-Based CLOCK in Linux and FreeBSD

 An age is associated with each page in addition to a
  reference bit;

 When the clock hand sweeps through pages, it
  increases its age if the page’s bit is 1, otherwise it
  decreases its age.

 The page with its age of 0 is replaced.
CAR: CLOCK with Adaptive Replacement
 Two  clocks T1 and T2, one is for cold pages touched only once recently (Recency),
another is for hot pages touched at least twice (“Frequency”);
 Queues B1 and B2 are for pages recently replaced from T1 and T2;
 The memory allocations for T1 or T2 depend on the ratio of references
   to B2 and B1.
Limits of CAR

 A page that is regularly accessed with its reuse distance a little bit
larger memory size has no hits in T1 or T2. (inherited LRU problem).
 A page in T2 can stay in memory without any accesses because
frequency does not reflect ``reuse distance”.
 No system implementations yet
Basic Ideas of CLOCK-Pro

 It is an approximation of LIRS based on the CLOCK infrastructure.
 Pages categorized into two groups: cold pages and hot pages
  based on their reuse distances (or IRR).
 There are three hands: Hand-hot for hot pages,
  Hand-cold for cold pages, and Hand-test for running a reuse
  distance test for a block;
 The allocation of memory pages between hot pages (Mhot) and
  cold pages (Mcold ) are adaptively adjusted. (M = Mhot + Mcold)
 All hot pages are resident (=Lir blocks), some cold pages are also
  resident (= Hir Blocks); keep track of recently replaced pages
  (=non-resident Hir blocks)
0   1 Cold resident        CLOCK-Pro Structure
0   1   Hot
                                                             1   24
    Cold non-resident                             2                    23
                                 Hand-hot: find a hot     0
                                         3       0               0
                                 page to be demoted                   0         22
                                 into a cold 0
                                             page.                          1
                                    4
                                         0
                                                                                 0 21
                                5    0                hand-hot
                                                                                     0 20
Two reasons for a resident cold page:                  All hands move
                              6                                                       1 19
• A fresh replacement: a first access.       hand-cold in the clockwise
• It is demoted from a hotused to find
              Hand-cold is page.                       direction. hand-test
                              7
              a page for replacement.                                                 0 18

                                8                                                    0 17
                        Hand-test: (1) to determine if a
                                         0
                        cold page is promoted to be hot; (2)
                                      9                                              16
                        remove non-resident cold pages out                 0
                        of the clock.    10                                 15
                                                          1      0
                                                11                    14
                                                        12       13
Accessing Sequence:                                                       1           24                                        1                5
….27, 7, 26, 25, 4, 23                                           2                               23                                 0        0
                                                                          0           0
                                                    3                0                       0             22
                                                        0                                             1                             0        04
                                            4                                                                                   3
                                                0                                                                   21
                                                                                                               0                     Resident
                                    5                                                                                               Cold Pages
                                            0                        hand-hot                                              20
                                                                                                                    0
                               6
                                                    hand-cold                 Clock
                                                                                                                       1    19


                               7                                                           hand-test                 0      18


                                   8                                                                               0       17
              2       24

      9       0       0        23               0
          0                0                9
                                                                                                                   16
                                                                                                      0                         7        6
                                       22
13   0                         1                10
                                                                                  0                       15
                                                            11                               14                        8                         16
15
     0                         0       21
                                                                         12           13

          0                0                                                                                        10                               14
     17           0   1        20

              18     19                                                                                                   11      12
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1           24                                      1                5
Page 23                                                          2                             23                                 0        0
                                                                          0           0
Hit!                                                3                0                       0
                                                                                             1           22
Set reference bit of                                    0                                           1                             0        04
Page 23 to 1.                               4                                                                                 3
                                                                                                                  21
No other operation                              0
                                                                                                             0                     Resident
                                    5                                                                                             Cold Pages
                                            0                        hand-hot                                            20
                                                                                                                  0
                               6
                                                    hand-cold                 Clock
                                                                                                                     1    19


                               7                                                           hand-test               0      18


                                   8                                                                             0       17
              2       24

      9       0       0        23               0
          0                0
                           1                9                                                                    16
                                                                                                    0                         7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                        15
                                                            11                               14                      8                         16
15
     0                         0       21
                                                                         12           13

          0                0                                                                                      10                               14
     17           0   1        20

              18     19                                                                                                 11      12
              Hot Pages                                                                                          Non-resident Cold Pages
Current accessing:                                                        1           24                                        1                5
Page 4                                                           2                               23                                 0        0
                                                                          0           0
Hit!                                                3                0                       1             22
Set reference bit of                                    0                                             1                             0        04
                                                                                                                                             1
Page 4 to 1.                                4                                                                                   3
                                                                                                                    21
No other operation                              0
                                                1                                                              0                     Resident
                                    5                                                                                               Cold Pages
                                            0                        hand-hot                                              20
                                                                                                                    0
                               6
                                                    hand-cold                 Clock
                                                                                                                       1    19


                               7                                                           hand-test                 0      18


                                   8                                                                               0       17
              2       24

      9       0       0        23               0
          0                1                9                                                                      16
                                                                                                      0                         7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                          15
                                                            11                               14                        8                         16
15
     0                         0       21
                                                                         12           13

          0                0                                                                                        10                               14
     17           0   1        20

              18     19                                                                                                   11      12
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1           24                                        1                5
Page 25                                                          2                               23                                 0        0
                                                                          0           0
Miss!                                               3                0                       1             22
                                                        0                                             1                             0        14
(1) run hand-cold---                        4                                                                                   3
                                                                                                                    21
reclaim the first met                           1
cold page with ref bit 0                                                                                       0                     Resident
                                    5                                                                                               Cold Pages
(Page 5)                                    0                        hand-hot                                              20
                                                                                                                    0
(2) Reclaim cold page
5 and remove it from           6
resident cold page list                             hand-cold                 Clock
                                                                                                                       1    19


                               7                                                           hand-test                 0      18


                                   8                                                                               0       17
              2       24

      9       0       0        23               0
          0                1                9                                                                      16
                                                                                                      0                         7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                          15
                                                            11                               14                        8                         16
15
     0                         0       21
                                                                         12           13

          0                0                                                                                        10                               14
     17           0   1        20

              18     19                                                                                                   11      12
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1           24                                        1
Page 25                                                          2                               23                                 0
                                                                          0           0
(3) Leave non-resident                              3                0                       1             22
cold page 5 in the                                      0                                             1                             0          14
original position of                        4                                                                                   3
                                                                                                                    21
clock list                                      1
                                                                                                               0                     Resident
                                       5                                                                                            Cold Pages
(4) Add page 5 into                                                  hand-hot                                              20
non-resident cold                                                                                                   0
page list
                               6
(5) run hand-test to                                hand-cold                 Clock
                                                                                                                       1    19

find a position for
page 5                         7                                                           hand-test                 0      18


                                   8                                                                               0       17
              2       24

      9       0       0        23               0
          0                1                9                                                                      16
                                                                                                      0                         7         Non-
                                                                                                                                             6
                                                                                                                                        resident
                                       22
13   0                         1                10
                                                                                  0
                                                                                                          15                             colde
                                                                                                                                        page list
                                                            11                               14                        8                 is full!   16
15
     0                         0       21
                                                                         12           13

          0                0                                                                                        10                              14
     17           0   1        20

              18     19                                                                                                   11      12
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1           24                                        1
Page 25                                                          2                               23                                 0
                                                                          0           0
(5) Add page 5 to non-                              3                0                       1             22
resident cold page list                                 0                                             1                             0        14
                                            4                                                                                   3
                                                                                                                    21
Reorganize clock list                           1
                                                                                                               0                     Resident
                                       5                                                                                            Cold Pages
                                                                     hand-hot                                              20
                                                                                                                    0
                               6
                                                    hand-cold                 Clock
                                                                                                                       1    19


                               7                                                           hand-test                 0      18


                                   8                                                                               0       17
              2       24

      9       0       0        23               0
          0                1                9
                                                                                                      0                         7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                          15
                                                                                                                                                 5
                                                            11                                                         8
     0
                                                                                             14                                              0
15                             0       21
                                                                         12           13

          0                0                                                                                        10                           14
     17           0   1        20

              18     19                                                                                                   11      12
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1           25                                        1               25
Page 25                                                          2                              24                                  0      0
                                                                          0       0
Now we already have                                 3                0                         0          23
one empty room for                                      0                                            1                              0       14
page 25                                     4                                                                                   3
                                                                                                                   22
                                                1                                                             1                      Resident
(6) Check page 25 in
                                                                         hand-hot
                                       5                                                                                            Cold Pages
non-resident page                                                                                                          21
list---it is not in it                                                                                             0
(7) Add page 25 into           6
clock and resident                                  hand-cold                 Clock
                                                                                                                       0    20

cold page list
                               7                                                                                       1    19
                                                                                           hand-test
                                   8                                                                              0        18
              2       24

      9       0       0        23               0                                                             0
          0                1                9                                                                     17
                                                                                                     0                          7
                                                                                                                                        page 25
                                                                                                                                        does not
                                                                                                                                         6
                                       22                                                                                                 exit!
13   0                         1                10
                                                                                  0
                                                                                                         15
                                                                                                                                                5
                                                            11                                                         8
     0
                                                                                               14                                           0
15                             0       21
                                                                         12           13

          0                0                                                                                       10                              14
     17           0   1        20

              18     19                                                                                                  11      12
              Hot Pages                                                                                           Non-resident Cold Pages
Current accessing:                                                        1           25                                        1                25
Page 26                                                          2                              24                                  0        0
                                                                          0       0
Miss!                                               3                0                         0          23
                                                        0                                            1                              0        14
(1) run hand-cold to                        4                                                                                   3
                                                                                                                   22
reach the first met                             1                                                             1                      Resident
cold resident page                                                       hand-hot
                                       5                                                                                            Cold Pages
with reference bit 0                                                                                                       21
                                                                                                                   0
                               6
                                                    hand-cold                 Clock
                                                                                                                       0    20


                               7                                                                                       1    19
                                                                                           hand-test
                                   8                                                                              0        18
              2       24

      9       0       0        23               0                                                             0
          0                1                9                                                                     17
                                                                                                     0                          7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                         15
                                                                                                                                                 5
                                                            11                                                         8
     0
                                                                                               14                                            0
15                             0       21
                                                                         12           13

          0                0                                                                                       10                             14
     17           0   1        20

              18     19                                                                                                  11      12
              Hot Pages                                                                                           Non-resident Cold Pages
Current accessing:                                                        1           25                                        1                25
Page 26                                                          2                              24                                  0        0
                                                                          0       0
Page 4 has reference                                3                0                         0          23
bit 1, it should be                                     0                                            1                              0        14
upgraded to hot list.                       4                                                                                   3
                                                                                                                   22
                                                1                                                             1                      Resident
                                                                         hand-hot
1. Remove it from                      5                                                                                            Cold Pages
resident cold page list                                                                                                    21
                                                                                                                   0
                               6
                                                    hand-cold                 Clock
                                                                                                                       0    20


                               7                                                                                       1    19
                                                                                           hand-test
                                   8                                                                              0        18
              2       24

      9       0       0        23               0                                                             0
          0                1                9                                                                     17
                                                                                                     0                          7        6
                                       22
13   0                         1                10
                                                                                  0
                                                                                                         15
                                                                                                                                                 5
                                                            11                                                         8
     0
                                                                                               14                                            0
15                             0       21
                                                                         12           13

          0                0                                                                                       10                             14
     17           0   1        20

              18     19                                                                                                  11      12
              Hot Pages                                                                                           Non-resident Cold Pages
Current accessing:                                                                        1           25                                        1                25
Page 26                                                                          2                              24                                  0        0
                                                                                          0       0
Page 4 has reference                                                3                0                         0          23
bit 1, it should                                                        0                                            1                              0
upgrade to a hot page.                                                                                                                          3
                                                                                                                                   22
1. Remove it from
                                                                                         hand-hot                             1                      Resident
                                                       5                                                                                            Cold Pages
resident cold page list                                                                                                                    21
                                                                                                                                   0
2. Reset the reference                                               hand-cold
bit of page 4 and add it                       6
to hot page list                                                                              Clock
                                                                                                                                       0    20



                          4
                                              7                                                                                        1    19

                      0                                                                                    hand-test
                                                   8                                                                              0        18
              2               24

      9       0               0              23                 0                                                             0
          0                          1                      9                                                                     17
                                   Hot page
                                                                                                                     0                          7        6
                                                       22
13   0                                       1
                                   list is full!                10
                                                                                                  0
                                                                                                                         15
                                                                                                                                                                 5
                                                                            11                                                         8
     0
                                                                                                               14                                            0
15                                           0         21
                                                                                         12           13

          0                            0                                                                                           10                             14
     17           0           1              20

              18     19                                                                                                                  11      12
              Hot Pages                                                                                                           Non-resident Cold Pages
Current accessing:                                                                1           25                                        1                25
Page 26                                                                  2                              24                                  0        0
                                                                                  0       0
run hand-hot: degrade                                       3                0                         0          23
the first met hot page                                          0                                            1                              0
with reference bit 0 to                                                                                                                 3
                                                                                                                           22
a cold resident page
                                                                                 hand-hot                             1                      Resident
                                               5                                                                                            Cold Pages
                                                                                                                                   21
                                                                                                                           0
                                                             hand-cold
                                       6
                                                                                      Clock
                                                                                                                               0    20



                          4
                                       7                                                                                       1    19

                      0                                                                            hand-test
                                           8                                                                              0        18
              2               24

      9       0               0        23               0                                                             0
          0                        1                9                                                                     17
                                                                                                             0                          7        6
                                               22
13   0                                 1                10
                                                                                          0
                                                                                                                 15
                                                                                                                                                         5
                                                                    11                                                         8
     0
                                                                                                       14                                            0
15                                     0       21
                                                                                 12           13

          0                        0                                                                                       10                             14
     17           0           1        20

              18     19                                                                                                          11      12
              Hot Pages                                                                                                   Non-resident Cold Pages
Current accessing:                                                               1           25                                       1                 25
Page 26                                                                 2                                                                 0        0
                                                                                 0       0
Run hand-hot:                                              3                0                                   23
degrade first met hot                                          0                                           1                              0
page with ref bit 0 to a                                                                                                              3
                                                                                                                         22
cold resident page
                                                                                hand-hot                            1                      Resident
                                              5                                                                                           Cold Pages
Reorganize clock list                                                                                                            21
                                                                                                                         0                     24
                                                            hand-cold
                                      6
                                                                                                                             0    20           0
                                                                                     Clock


                          4
                                      7                                                                                      1    19

                      0                                                                           hand-test
                                          8                                                                             0        18
              2

      9       0                       23               0                                                            0
          0                       1                9                                                                    17
                                                                                                           0                          7        6
                                              22
13   0                                1                10
                                                                                         0
                                                                                                               15
                                                                                                                                                        5
                                                                   11                                                        8
     0
                                                                                                      14                                            0
15                                    0       21
                                                                                12           13

          0                       0                                                                                      10                              14
     17           0           1       20

              18     19                                                                                                        11      12
              Hot Pages                                                                                                 Non-resident Cold Pages
Current accessing:                                                          1           25                                      1                25
Page 26                                                            2                             4                                  0        0
                                                                            0       0
Page 4 is added into                                 3                 0                     0       24
hot page list.                                            0                                          0                              0        0 24
                                               5                                                                                3
                                                                                                                   23
Page 24 is added into
cold page list.
                                                                                                              1                      Resident
                                       6                                                                                            Cold Pages
                                                                                   hand-hot                                22
                                                                                                                   1
                                                         hand-cold
                                  7
                                                                                Clock
                                                                                                                       0    21


                                  8                                                                                    0    20


                                      9        0                                         hand-test                1        19
              2           4
      9       0       0           23                                                                          0
          0                   1                10
                                                                                                     0            18
                                                                                                                                7        6
                                          22
13   0                            1                 11                                       0           17
                                                              12
                                                                            0                                          8
                                                                                                                                                 5
     0
                                                                                             15                                              0
15                                0       21
                                                                           13           14

          0                   0                                                                                    10                             14
     17           0   1           20

              18     19                                                                                                  11      12
              Hot Pages                                                                                           Non-resident Cold Pages
Current accessing:                                                          1           25                                      1                25
Page 26                                                            2                             4                                  0        0
                                                                            0       0
run hand-cold:                                       3                 0                     0       24
Page 3 has reference                                      0                                          0                              0        0 24
bit 0, reclaim it and                          5                                                                                3
                                                                                                                   23
move hand-cold to the                                                                                         1                      Resident
next position                          6                                                                                            Cold Pages
                                                                                   hand-hot                                22
                                                                                                                   1
                                                         hand-cold
                                  7
                                                                                Clock
                                                                                                                       0    21


                                  8                                                                                    0    20


                                      9        0                                         hand-test                1        19
              2           4
      9       0       0           23                                                                          0
          0                   1                10
                                                                                                     0            18
                                                                                                                                7        6
                                          22
13   0                            1                 11                                       0           17
                                                              12
                                                                            0                                          8
                                                                                                                                                 5
     0
                                                                                             15                                              0
15                                0       21
                                                                           13           14

          0                   0                                                                                    10                             14
     17           0   1           20

              18     19                                                                                                  11      12
              Hot Pages                                                                                           Non-resident Cold Pages
Current accessing:                                                     1           25                                      1                   25
Page 26                                                       2                             4                                  0        0
                                                                       0       0
Reclaim page 3 and                                   3            0                     0       24
add it into non-                                                                                0                                       0 24
resident cold page list.                       5                                                              23
1. Leave non-resident
                                                                                                         1                      Resident
                                       6                                                                                       Cold Pages
cold page 3 in the old                                   hand-cold            hand-hot                                22
position in clock list.                                                                                       1
2. run hand-test: move            7
14 from non-resident                                                       Clock
                                                                                                                  0    21

cold page list.
                                  8                                                                               0    20


                                      9        0                                    hand-test                1        19               3
              2           4                                                                                                        0
      9       0       0           23                                                                     0
          0                   1                10
                                                                                                0            18
                                                                                                                                      Non-
                                                                                                                                    resident
                                                                                                                           7          6
                                                                                                                                   cold page
                                          22
13   0                            1                 11                                  0           17                             list is full!

                                                         12
                                                                       0                                          8
                                                                                                                                               5
     0
                                                                                        15                                                 0
15                                0       21
                                                                      13           14

          0                   0                                                                               10                                   14
     17           0   1           20

              18     19                                                                                             11      12
              Hot Pages                                                                                      Non-resident Cold Pages
Current accessing:                                                     1           25                                      1                25
Page 26                                                       2                             4                                  0        0
                                                                       0       0
Add page 3 into non-                                 3            0                     0       24
resident cold page list.                                                                        0                                       0 24
                                               5                                                              23
Reorganize clock list
                                                                                                         1                      Resident
                                       6                                                                                       Cold Pages
                                                         hand-cold            hand-hot                                22
                                                                                                              1
                                  7
                                                                           Clock
                                                                                                                  0    21


                                  8                                                                               0    20


                                      9        0                            hand-test                        1        19
              2           4
      9       0       0           23                                                                     0
          0                   1                10
                                                                                                0            18
                                                                                                                           7        6
                                          22
13   0                            1                 11                                  0           17
                                                         12
                                                                       0                                          8
                                                                                                                                            5
     0
                                                                                        15                                              0
15                                0       21
                                                                      13

          0                   0                                                                               10                                 3
     17           0   1           20

              18     19                                                                                             11      12
              Hot Pages                                                                                      Non-resident Cold Pages
Current accessing:                                                     1           25                                         1                 25
Page 26                                                       2                                4                                   0        0
                                                                       0       0
Add page 26 into                                     3            0                        0       24
resident cold page list                                                                            0                          26
                                                                                                                                   0        0 24
and clock list                                 5                                                                 26
                                                                                                            0                       Resident
                                       6                                                                                           Cold Pages
                                                         hand-cold                                                       23
                                                                                        hand-hot                 1
                                  7
                                                                           Clock
                                                                                                                     1    22


                                  8                                                                                  0    21


                                      9        0                            hand-test                           0        20
              2           4
      9       0       0           23                                                                        1
          0                   1                10
                                                                                                   0            19
                                                                                                                              7         6
                                          22
13   0                            1                 11                                     0           18
                                                         12
                                                                       0       0                                     8
                                                                                                                                                5
     0
                                                                                           17                                               0
15                                0       21
                                                                      13           15

          0                   0                                                                                  10                                  3
     17           0   1           20

              18     19                                                                                                11      12
              Hot Pages                                                                                         Non-resident Cold Pages
Current accessing:                                                     1           25                                         1                 25
Page 7                                                        2                                4                                   0        0
                                                                       0       0
Miss!                                                3            0                        0       24

(1) run hand-cold:                                                                                 0                          26
                                                                                                                                   0        0 24
                                               5                                                                 26
reclaim the first met
resident cold page                                                                                          0                       Resident
                                       6                                                                                           Cold Pages
(page 1)                                                 hand-cold                                                       23
                                                                                        hand-hot                 1
                                  7
                                                                           Clock
                                                                                                                     1    22


                                  8                                                                                  0    21


                                      9        0                            hand-test                           0        20
              2           4
      9       0       0           23                                                                        1
          0                   1                10
                                                                                                   0            19
                                                                                                                              7         6
                                          22
13   0                            1                 11                                     0           18
                                                         12
                                                                       0       0                                     8
                                                                                                                                                5
     0
                                                                                           17                                               0
15                                0       21
                                                                      13           15

          0                   0                                                                                  10                                  3
     17           0   1           20

              18     19                                                                                                11      12
              Hot Pages                                                                                         Non-resident Cold Pages
Current accessing:                                                    1            25                                                             25
Page 7                                                        2                                4                                            0
                                                     3            0            0           0       24
1. Leave page 1 in the
old position in clock                                                                              0                          26
                                                                                                                                   0        0 24
list.                                          5                                                                 26

2. run hand-test: to
                                                                                                            0                       Resident
                                       6                                                                                           Cold Pages
find a position for                                      hand-cold                                                       23
page 1                                                                                  hand-hot                 1
                                  7
                                                                           Clock
                                                                                                                     1    22


                                  8                                                                                  0    21


                                      9        0                            hand-test                           0        20
              2           4
      9       0       0           23                                                                        1
          0                   1                10
                                                                                                   0            19
                                                                                                                                          Non-
                                                                                                                                        resident
                                                                                                                              7           6
                                                                                                                                       cold page
                                          22
13   0                            1                 11                                     0           18                              list is full!

                                                         12
                                                                       0       0                                     8
                                                                                                                                                   5
     0
                                                                                           17                                                 0
15                                0       21
                                                                      13           15

          0                   0                                                                                  10                                    3
     17           0   1           20

              18     19                                                                                                11      12
              Hot Pages                                                                                         Non-resident Cold Pages
Current accessing:                                                1            25                                                           25
Page 7                                                    2                                4                                            0
                                                     3        0            0           0       24
3. Add page 1 into
non-resident cold                                                                              0                          26
                                                                                                                               0        0 24
page list.                                     5                                                             26
                                                                                                        0                       Resident
                                       6                                                                                       Cold Pages
                                                         hand-cold                                                   23
                                                                                    hand-hot                 1
                                  7
                                                                       Clock
                                                                                                                 1    22


                                  8                                                                              0    21


                                      9        0                        hand-test                           0        20
              2           4
      9       0       0           23                                                                    1
          0                   1                10
                                                                                               0            19
                                                                                                                          7         6
                                          22
13   0                            1                 11                                 0           18
                                                                   0       0                                     8
                                                                                                                                            5
     0
                                                                                       17                                               0
15                                0       21
                                                                  13           15

          0                   0                                                                              10                                  3
     17           0   1           20

              18     19                                                                                            11       1
              Hot Pages                                                                                     Non-resident Cold Pages
Current accessing:                                                        1            25                                                           25
Page 7                                                            2                                4                                            0
                                                             3        0            0           0       24
Now we have one
empty slot in memory                                                                                   0                          26
                                                                                                                                       0        0 24
                                                       5                                                             26
(1) check non-resident
cold page list and find                                                                                         0                       Resident
                                              6                                                                                        Cold Pages
it---we need to                                                  hand-cold                                                   23
upgrade it to hot page
                                                                                            hand-hot                 1
(2) run hand-hot:                         7
degrade the first met                                                          Clock
                                                                                                                         1    22

hot page with
reference bit 0 to cold                  8                                                                               0    21
page

                                              9        0                        hand-test                           0        20
              2           4
      9       0       0                 23                                                                      1
          0                     1                      10
                                                                                                       0            19
                              Hot page                                                                                            7         6
                                                  22
13   0                                  1
                              list is full!                 11                                 0           18
                                                                           0       0                                     8
                                                                                                                                                    5
     0
                                                                                               17                                               0
15                                      0         21
                                                                          13           15

          0                       0                                                                                  10                                  3
     17           0   1                 20

              18     19                                                                                                    11       1
              Hot Pages                                                                                             Non-resident Cold Pages
Current accessing:                                                        1            25                                                           25
Page 7                                                            2                                4                                            0
                                                             3        0            0           0       24
Page 23 has reference
bit 1---reset it to 0                                                                                  0                          26
                                                                                                                                       0        0 24
                                                       5                                                             26
                                                                                                                0                       Resident
                                               6                                                                                       Cold Pages
                                                                 hand-cold                                                   23
                                                                                            hand-hot                 0
                                                                                                                     1

                                                                               Clock
                                                                                                                         1    22


                          7               8                                                                              0    21
                      0
                                              9        0                        hand-test                           0        20
              2                   4
      9       0               0           23                                                                    1
          0                           0
                                      1                10
                                                                                                       0            19
                                                                                                                                            6
                                                  22
13   0                                    1                 11                                 0           18
                                                                           0       0                                     8
                                                                                                                                                    5
     0
                                                                                               17                                               0
15                                        0       21
                                                                          13           15

          0                           0                                                                              10                                  3
     17           0           1           20

              18     19                                                                                                    11       1
              Hot Pages                                                                                             Non-resident Cold Pages
Current accessing:                                                        1            25                                                           25
Page 7                                                            2                                4                                            0
                                                             3        0            0           0       24
Page 22 has reference
bit 1---reset it to 0                                                                                  0                          26
                                                                                                                                       0        0 24
                                                       5                                                             26
                                                                                                                0                       Resident
                                               6                                                                                       Cold Pages
                                                                 hand-cold                                                   23
                                                                                                                     0
                                                                                            hand-hot
                                                                               Clock
                                                                                                                         0
                                                                                                                         1    22


                          7               8                                                                              0    21
                      0
                                              9        0                        hand-test                           0        20
              2                   4
      9       0               0           23                                                                    1
          0                           0                10
                                                                                                       0            19
                                                                                                                                            6
                                                  22
13   0                                    0
                                          1                 11                                 0           18
                                                                           0       0                                     8
                                                                                                                                                    5
     0
                                                                                               17                                               0
15                                        0       21
                                                                          13           15

          0                           0                                                                              10                                  3
     17           0           1           20

              18     19                                                                                                    11       1
              Hot Pages                                                                                             Non-resident Cold Pages
Current accessing:                                                        1            25                                                          25
Page 7                                                            2                               4                                            0
                                                             3        0            0          0       24
Page 21 has reference
bit 0---degrade it                                                                                    0                          26
                                                                                                                                      0        0 24
                                                       5                                                            26
                                                                                                               0                       Resident
                                               6                                                                                      Cold Pages
                                                                 hand-cold                                                  23
                                                                                                                    0

                                                                               Clock        hand-hot                    0    22


                          7               8                                                                             0    21
                      0
                                              9        0                        hand-test                          0        20
              2                   4
      9       0               0           23                                                                   1
          0                           0                10
                                                                                                      0            19
                                                                                                                                           6
                                                  22
13   0                                    0                 11                               0            18
                                                                           0       0                                    8
                                                                                                                                                   5
     0
                                                                                              17                                               0
15                                        0       21
                                                                          13           15

          0                           0                                                                             10                                  3
     17           0           1           20

              18     19                                                                                                   11       1
              Hot Pages                                                                                            Non-resident Cold Pages
Current accessing:                                                        1            25                                                              25
Page 7                                                            2                               4                                                0
                                                             3        0            0          0       24
(3) Degrade page 21 to
resident cold page                                                                                    0                          26
                                                                                                                                      0            0 24
                                                       5                                                            26
Reorganize clock list
                                                                                                               0                       Resident
                                               6                                                                                      Cold Pages
                                                                 hand-cold                                                  23
                                                                                                                    0

                                                                               Clock
                                                                                            hand-hot                    0    22


                          7                                                                                                               21
                                          8
                      0                                                                                                                        0
                                              9        0                        hand-test                          0        20
              2                   4
      9       0               0           23                                                                   1
          0                           0                10
                                                                                                      0            19
                                                                                                                                               6
                                                  22
13   0                                    0                 11                               0            18
                                                                           0       0                                    8
                                                                                                                                                       5
     0                                                                    13           15
                                                                                              17                                                   0
15
          0                           0                                                                             10                                      3
     17           0           1           20

              18     19                                                                                                   11       1
              Hot Pages                                                                                            Non-resident Cold Pages
clock-pro
clock-pro
clock-pro
clock-pro
clock-pro

Contenu connexe

Tendances

Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcachedJurriaan Persyn
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseenissoz
 
Enabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache SparkEnabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache SparkKazuaki Ishizaki
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotFlink Forward
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkFlink Forward
 
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon
 
Rainbird: Realtime Analytics at Twitter (Strata 2011)
Rainbird: Realtime Analytics at Twitter (Strata 2011)Rainbird: Realtime Analytics at Twitter (Strata 2011)
Rainbird: Realtime Analytics at Twitter (Strata 2011)Kevin Weil
 
Introduction to GraphQL using Nautobot and Arista cEOS
Introduction to GraphQL using Nautobot and Arista cEOSIntroduction to GraphQL using Nautobot and Arista cEOS
Introduction to GraphQL using Nautobot and Arista cEOSJoel W. King
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & FeaturesDataStax Academy
 
Hadoop Security Architecture
Hadoop Security ArchitectureHadoop Security Architecture
Hadoop Security ArchitectureOwen O'Malley
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)DataWorks Summit
 
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...Daniel Hochman
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm Chandler Huang
 
Geohashing with Uber’s H3 Geospatial Index
Geohashing with Uber’s H3 Geospatial Index Geohashing with Uber’s H3 Geospatial Index
Geohashing with Uber’s H3 Geospatial Index HPCC Systems
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedis Labs
 
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...InfluxData
 
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh BhatnagarScalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh BhatnagarDatabricks
 
Zipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering FrameworkZipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering FrameworkDatabricks
 

Tendances (20)

Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
HBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBaseHBase and HDFS: Understanding FileSystem Usage in HBase
HBase and HDFS: Understanding FileSystem Usage in HBase
 
Enabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache SparkEnabling Vectorized Engine in Apache Spark
Enabling Vectorized Engine in Apache Spark
 
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and PinotExactly-Once Financial Data Processing at Scale with Flink and Pinot
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
 
Evening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in FlinkEvening out the uneven: dealing with skew in Flink
Evening out the uneven: dealing with skew in Flink
 
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBaseHBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
HBaseCon 2015: Taming GC Pauses for Large Java Heap in HBase
 
Rainbird: Realtime Analytics at Twitter (Strata 2011)
Rainbird: Realtime Analytics at Twitter (Strata 2011)Rainbird: Realtime Analytics at Twitter (Strata 2011)
Rainbird: Realtime Analytics at Twitter (Strata 2011)
 
Introduction to GraphQL using Nautobot and Arista cEOS
Introduction to GraphQL using Nautobot and Arista cEOSIntroduction to GraphQL using Nautobot and Arista cEOS
Introduction to GraphQL using Nautobot and Arista cEOS
 
Cassandra Introduction & Features
Cassandra Introduction & FeaturesCassandra Introduction & Features
Cassandra Introduction & Features
 
Hadoop Security Architecture
Hadoop Security ArchitectureHadoop Security Architecture
Hadoop Security Architecture
 
Memory in go
Memory in goMemory in go
Memory in go
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
 
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
Geospatial Indexing at Scale: The 15 Million QPS Redis Architecture Powering ...
 
Introduction to Storm
Introduction to Storm Introduction to Storm
Introduction to Storm
 
Geohashing with Uber’s H3 Geospatial Index
Geohashing with Uber’s H3 Geospatial Index Geohashing with Uber’s H3 Geospatial Index
Geohashing with Uber’s H3 Geospatial Index
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with Redisson
 
Understanding jvm gc advanced
Understanding jvm gc advancedUnderstanding jvm gc advanced
Understanding jvm gc advanced
 
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...
Improving Clinical Data Accuracy: How to Streamline a Data Pipeline Using Nod...
 
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh BhatnagarScalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
Scalable Monitoring Using Apache Spark and Friends with Utkarsh Bhatnagar
 
Zipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering FrameworkZipline—Airbnb’s Declarative Feature Engineering Framework
Zipline—Airbnb’s Declarative Feature Engineering Framework
 

En vedette

cache2k, Java Caching, Turbo Charged, FOSDEM 2015
cache2k, Java Caching, Turbo Charged, FOSDEM 2015cache2k, Java Caching, Turbo Charged, FOSDEM 2015
cache2k, Java Caching, Turbo Charged, FOSDEM 2015cruftex
 
Operating system lecture1
Operating system lecture1Operating system lecture1
Operating system lecture1AhalyaSri
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory managementRai University
 
General Electric Company
General Electric CompanyGeneral Electric Company
General Electric CompanyAgatha Asuncion
 
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014cdmaxime
 
Oozie sweet
Oozie sweetOozie sweet
Oozie sweetmislam77
 
CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지충섭 김
 
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례Docker + Kubernetes를 이용한 빌드 서버 가상화 사례
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례NAVER LABS
 
처음 접하는 Oozie Workflow, Coordinator
처음 접하는 Oozie Workflow, Coordinator처음 접하는 Oozie Workflow, Coordinator
처음 접하는 Oozie Workflow, CoordinatorKim Log
 
하둡 (Hadoop) 및 관련기술 훑어보기
하둡 (Hadoop) 및 관련기술 훑어보기하둡 (Hadoop) 및 관련기술 훑어보기
하둡 (Hadoop) 및 관련기술 훑어보기beom kyun choi
 
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!pyrasis
 
3 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 20173 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 2017Drift
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 

En vedette (16)

cache2k, Java Caching, Turbo Charged, FOSDEM 2015
cache2k, Java Caching, Turbo Charged, FOSDEM 2015cache2k, Java Caching, Turbo Charged, FOSDEM 2015
cache2k, Java Caching, Turbo Charged, FOSDEM 2015
 
Sistemas Operativos
Sistemas OperativosSistemas Operativos
Sistemas Operativos
 
Operating system lecture1
Operating system lecture1Operating system lecture1
Operating system lecture1
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory management
 
General Electric Company
General Electric CompanyGeneral Electric Company
General Electric Company
 
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
 
OS tutoring #1
OS tutoring #1OS tutoring #1
OS tutoring #1
 
Oozie sweet
Oozie sweetOozie sweet
Oozie sweet
 
CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지CoreOS : 설치부터 컨테이너 배포까지
CoreOS : 설치부터 컨테이너 배포까지
 
HBase 훑어보기
HBase 훑어보기HBase 훑어보기
HBase 훑어보기
 
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례Docker + Kubernetes를 이용한 빌드 서버 가상화 사례
Docker + Kubernetes를 이용한 빌드 서버 가상화 사례
 
처음 접하는 Oozie Workflow, Coordinator
처음 접하는 Oozie Workflow, Coordinator처음 접하는 Oozie Workflow, Coordinator
처음 접하는 Oozie Workflow, Coordinator
 
하둡 (Hadoop) 및 관련기술 훑어보기
하둡 (Hadoop) 및 관련기술 훑어보기하둡 (Hadoop) 및 관련기술 훑어보기
하둡 (Hadoop) 및 관련기술 훑어보기
 
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
도커 무작정 따라하기: 도커가 처음인 사람도 60분이면 웹 서버를 올릴 수 있습니다!
 
3 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 20173 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 2017
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 

Dernier

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Dernier (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

clock-pro

  • 1. Clock-Pro: An Effective Replacement in OS Kernel Xiaodong Zhang College of William and Mary
  • 2. How to Make LIRS Work in OS Kernels? q Most system kernels use the CLOCK algorithm, an approximation of LRU. q We have made efforts to directly implement LIRS in Linux kernels, but … q Our experience tells us that we must build on existing strength. q CLOCK is the base for LIRS.
  • 3. Basic CLOCK Replacement  All the resident pages are placed around a circular list, like a clock;  Each page is associated with a reference bit, indicating if the page has been accessed. 1 0 0 0 1 0 0 1 0 1 CLOCK hand 0 0 1 On a HIT 0 0 Set Reference bit to 1 (no algorithm operations) 1 0 1 0 0 0 0 1 1 0
  • 4. Basic CLOCK Replacement Starts from the currently pointed page, and evicts the page if it is”`0”; Move the clock hand until reach a “0” page; Give “1” page a second chance, and reset its “1” to “0” 1 0 0 0 1 0 0 0 1 On a sequence of 1 CLOCK hand 0 two MISSes 0 0 0 1 1 0 1 0 0 0 0 1 1 0
  • 5. The CLOCK with a Long History “In the Multics system a paging algorithm has been developed that has the implementation ease and low overhead of the FIFO strategy and is an approximation to the LRU strategy” “A paging Expreiment with the Multics System” MIT Project MAC Report MAC-M-384, May 1968, Fernando J. Corbato (1990 Turing Award Laureate)
  • 6. The CLOCK has been Widely Used Major OS Major OS Textbooks Multics Tanebaum & Woodhull UNIX/AIX/Linux/BSD Silberschatz & Galvin VAX/VMS Stallings (for undergraduate) DB2 Windows/Oracle/Solaris
  • 7. Prior Work on LRU versus CLOCK LRU related work CLOCK related work FBR (1990, SIGMETRICS) GCLOCK (1978, ACM TDBS) LRU-2 (1993, SIGMOD) 2Q (1994, VLDB) SEQ (1997, SIGMETRICS) LRFU (1999, OSDI) EELRU (1999, SIGMETRICS) MQ (2001, USENIX) 1968 2003 LIRS (2002, SIGMETRICS) CAR (2004, FAST) ARC (2003, FAST) CLOCK-Pro (2005, USENIX)
  • 8. GCLOCK Replacement  Introduce additional page access information.  A counter is associated with each page rather than a single bit;  The counter is incremented on a page hit;  The clock hand periodically moves, and decrements the counter of each block;  The page with its counter of 0 is replaced.
  • 9. Age-Based CLOCK in Linux and FreeBSD  An age is associated with each page in addition to a reference bit;  When the clock hand sweeps through pages, it increases its age if the page’s bit is 1, otherwise it decreases its age.  The page with its age of 0 is replaced.
  • 10. CAR: CLOCK with Adaptive Replacement  Two clocks T1 and T2, one is for cold pages touched only once recently (Recency), another is for hot pages touched at least twice (“Frequency”);  Queues B1 and B2 are for pages recently replaced from T1 and T2;  The memory allocations for T1 or T2 depend on the ratio of references to B2 and B1.
  • 11. Limits of CAR  A page that is regularly accessed with its reuse distance a little bit larger memory size has no hits in T1 or T2. (inherited LRU problem).  A page in T2 can stay in memory without any accesses because frequency does not reflect ``reuse distance”.  No system implementations yet
  • 12. Basic Ideas of CLOCK-Pro  It is an approximation of LIRS based on the CLOCK infrastructure.  Pages categorized into two groups: cold pages and hot pages based on their reuse distances (or IRR).  There are three hands: Hand-hot for hot pages, Hand-cold for cold pages, and Hand-test for running a reuse distance test for a block;  The allocation of memory pages between hot pages (Mhot) and cold pages (Mcold ) are adaptively adjusted. (M = Mhot + Mcold)  All hot pages are resident (=Lir blocks), some cold pages are also resident (= Hir Blocks); keep track of recently replaced pages (=non-resident Hir blocks)
  • 13. 0 1 Cold resident CLOCK-Pro Structure 0 1 Hot 1 24 Cold non-resident 2 23 Hand-hot: find a hot 0 3 0 0 page to be demoted 0 22 into a cold 0 page. 1 4 0 0 21 5 0 hand-hot 0 20 Two reasons for a resident cold page: All hands move 6 1 19 • A fresh replacement: a first access. hand-cold in the clockwise • It is demoted from a hotused to find Hand-cold is page. direction. hand-test 7 a page for replacement. 0 18 8 0 17 Hand-test: (1) to determine if a 0 cold page is promoted to be hot; (2) 9 16 remove non-resident cold pages out 0 of the clock. 10 15 1 0 11 14 12 13
  • 14. Accessing Sequence: 1 24 1 5 ….27, 7, 26, 25, 4, 23 2 23 0 0 0 0 3 0 0 22 0 1 0 04 4 3 0 21 0 Resident 5 Cold Pages 0 hand-hot 20 0 6 hand-cold Clock 1 19 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 0 9 16 0 7 6 22 13 0 1 10 0 15 11 14 8 16 15 0 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 15. Current accessing: 1 24 1 5 Page 23 2 23 0 0 0 0 Hit! 3 0 0 1 22 Set reference bit of 0 1 0 04 Page 23 to 1. 4 3 21 No other operation 0 0 Resident 5 Cold Pages 0 hand-hot 20 0 6 hand-cold Clock 1 19 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 0 1 9 16 0 7 6 22 13 0 1 10 0 15 11 14 8 16 15 0 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 16. Current accessing: 1 24 1 5 Page 4 2 23 0 0 0 0 Hit! 3 0 1 22 Set reference bit of 0 1 0 04 1 Page 4 to 1. 4 3 21 No other operation 0 1 0 Resident 5 Cold Pages 0 hand-hot 20 0 6 hand-cold Clock 1 19 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 1 9 16 0 7 6 22 13 0 1 10 0 15 11 14 8 16 15 0 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 17. Current accessing: 1 24 1 5 Page 25 2 23 0 0 0 0 Miss! 3 0 1 22 0 1 0 14 (1) run hand-cold--- 4 3 21 reclaim the first met 1 cold page with ref bit 0 0 Resident 5 Cold Pages (Page 5) 0 hand-hot 20 0 (2) Reclaim cold page 5 and remove it from 6 resident cold page list hand-cold Clock 1 19 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 1 9 16 0 7 6 22 13 0 1 10 0 15 11 14 8 16 15 0 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 18. Current accessing: 1 24 1 Page 25 2 23 0 0 0 (3) Leave non-resident 3 0 1 22 cold page 5 in the 0 1 0 14 original position of 4 3 21 clock list 1 0 Resident 5 Cold Pages (4) Add page 5 into hand-hot 20 non-resident cold 0 page list 6 (5) run hand-test to hand-cold Clock 1 19 find a position for page 5 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 1 9 16 0 7 Non- 6 resident 22 13 0 1 10 0 15 colde page list 11 14 8 is full! 16 15 0 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 19. Current accessing: 1 24 1 Page 25 2 23 0 0 0 (5) Add page 5 to non- 3 0 1 22 resident cold page list 0 1 0 14 4 3 21 Reorganize clock list 1 0 Resident 5 Cold Pages hand-hot 20 0 6 hand-cold Clock 1 19 7 hand-test 0 18 8 0 17 2 24 9 0 0 23 0 0 1 9 0 7 6 22 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 20. Current accessing: 1 25 1 25 Page 25 2 24 0 0 0 0 Now we already have 3 0 0 23 one empty room for 0 1 0 14 page 25 4 3 22 1 1 Resident (6) Check page 25 in hand-hot 5 Cold Pages non-resident page 21 list---it is not in it 0 (7) Add page 25 into 6 clock and resident hand-cold Clock 0 20 cold page list 7 1 19 hand-test 8 0 18 2 24 9 0 0 23 0 0 0 1 9 17 0 7 page 25 does not 6 22 exit! 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 21. Current accessing: 1 25 1 25 Page 26 2 24 0 0 0 0 Miss! 3 0 0 23 0 1 0 14 (1) run hand-cold to 4 3 22 reach the first met 1 1 Resident cold resident page hand-hot 5 Cold Pages with reference bit 0 21 0 6 hand-cold Clock 0 20 7 1 19 hand-test 8 0 18 2 24 9 0 0 23 0 0 0 1 9 17 0 7 6 22 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 22. Current accessing: 1 25 1 25 Page 26 2 24 0 0 0 0 Page 4 has reference 3 0 0 23 bit 1, it should be 0 1 0 14 upgraded to hot list. 4 3 22 1 1 Resident hand-hot 1. Remove it from 5 Cold Pages resident cold page list 21 0 6 hand-cold Clock 0 20 7 1 19 hand-test 8 0 18 2 24 9 0 0 23 0 0 0 1 9 17 0 7 6 22 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 23. Current accessing: 1 25 1 25 Page 26 2 24 0 0 0 0 Page 4 has reference 3 0 0 23 bit 1, it should 0 1 0 upgrade to a hot page. 3 22 1. Remove it from hand-hot 1 Resident 5 Cold Pages resident cold page list 21 0 2. Reset the reference hand-cold bit of page 4 and add it 6 to hot page list Clock 0 20 4 7 1 19 0 hand-test 8 0 18 2 24 9 0 0 23 0 0 0 1 9 17 Hot page 0 7 6 22 13 0 1 list is full! 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 24. Current accessing: 1 25 1 25 Page 26 2 24 0 0 0 0 run hand-hot: degrade 3 0 0 23 the first met hot page 0 1 0 with reference bit 0 to 3 22 a cold resident page hand-hot 1 Resident 5 Cold Pages 21 0 hand-cold 6 Clock 0 20 4 7 1 19 0 hand-test 8 0 18 2 24 9 0 0 23 0 0 0 1 9 17 0 7 6 22 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 25. Current accessing: 1 25 1 25 Page 26 2 0 0 0 0 Run hand-hot: 3 0 23 degrade first met hot 0 1 0 page with ref bit 0 to a 3 22 cold resident page hand-hot 1 Resident 5 Cold Pages Reorganize clock list 21 0 24 hand-cold 6 0 20 0 Clock 4 7 1 19 0 hand-test 8 0 18 2 9 0 23 0 0 0 1 9 17 0 7 6 22 13 0 1 10 0 15 5 11 8 0 14 0 15 0 21 12 13 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 26. Current accessing: 1 25 1 25 Page 26 2 4 0 0 0 0 Page 4 is added into 3 0 0 24 hot page list. 0 0 0 0 24 5 3 23 Page 24 is added into cold page list. 1 Resident 6 Cold Pages hand-hot 22 1 hand-cold 7 Clock 0 21 8 0 20 9 0 hand-test 1 19 2 4 9 0 0 23 0 0 1 10 0 18 7 6 22 13 0 1 11 0 17 12 0 8 5 0 15 0 15 0 21 13 14 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 27. Current accessing: 1 25 1 25 Page 26 2 4 0 0 0 0 run hand-cold: 3 0 0 24 Page 3 has reference 0 0 0 0 24 bit 0, reclaim it and 5 3 23 move hand-cold to the 1 Resident next position 6 Cold Pages hand-hot 22 1 hand-cold 7 Clock 0 21 8 0 20 9 0 hand-test 1 19 2 4 9 0 0 23 0 0 1 10 0 18 7 6 22 13 0 1 11 0 17 12 0 8 5 0 15 0 15 0 21 13 14 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 28. Current accessing: 1 25 1 25 Page 26 2 4 0 0 0 0 Reclaim page 3 and 3 0 0 24 add it into non- 0 0 24 resident cold page list. 5 23 1. Leave non-resident 1 Resident 6 Cold Pages cold page 3 in the old hand-cold hand-hot 22 position in clock list. 1 2. run hand-test: move 7 14 from non-resident Clock 0 21 cold page list. 8 0 20 9 0 hand-test 1 19 3 2 4 0 9 0 0 23 0 0 1 10 0 18 Non- resident 7 6 cold page 22 13 0 1 11 0 17 list is full! 12 0 8 5 0 15 0 15 0 21 13 14 0 0 10 14 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 29. Current accessing: 1 25 1 25 Page 26 2 4 0 0 0 0 Add page 3 into non- 3 0 0 24 resident cold page list. 0 0 24 5 23 Reorganize clock list 1 Resident 6 Cold Pages hand-cold hand-hot 22 1 7 Clock 0 21 8 0 20 9 0 hand-test 1 19 2 4 9 0 0 23 0 0 1 10 0 18 7 6 22 13 0 1 11 0 17 12 0 8 5 0 15 0 15 0 21 13 0 0 10 3 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 30. Current accessing: 1 25 1 25 Page 26 2 4 0 0 0 0 Add page 26 into 3 0 0 24 resident cold page list 0 26 0 0 24 and clock list 5 26 0 Resident 6 Cold Pages hand-cold 23 hand-hot 1 7 Clock 1 22 8 0 21 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 1 10 0 19 7 6 22 13 0 1 11 0 18 12 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 31. Current accessing: 1 25 1 25 Page 7 2 4 0 0 0 0 Miss! 3 0 0 24 (1) run hand-cold: 0 26 0 0 24 5 26 reclaim the first met resident cold page 0 Resident 6 Cold Pages (page 1) hand-cold 23 hand-hot 1 7 Clock 1 22 8 0 21 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 1 10 0 19 7 6 22 13 0 1 11 0 18 12 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 32. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 1. Leave page 1 in the old position in clock 0 26 0 0 24 list. 5 26 2. run hand-test: to 0 Resident 6 Cold Pages find a position for hand-cold 23 page 1 hand-hot 1 7 Clock 1 22 8 0 21 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 1 10 0 19 Non- resident 7 6 cold page 22 13 0 1 11 0 18 list is full! 12 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 12 Hot Pages Non-resident Cold Pages
  • 33. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 3. Add page 1 into non-resident cold 0 26 0 0 24 page list. 5 26 0 Resident 6 Cold Pages hand-cold 23 hand-hot 1 7 Clock 1 22 8 0 21 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 1 10 0 19 7 6 22 13 0 1 11 0 18 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages
  • 34. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 Now we have one empty slot in memory 0 26 0 0 24 5 26 (1) check non-resident cold page list and find 0 Resident 6 Cold Pages it---we need to hand-cold 23 upgrade it to hot page hand-hot 1 (2) run hand-hot: 7 degrade the first met Clock 1 22 hot page with reference bit 0 to cold 8 0 21 page 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 1 10 0 19 Hot page 7 6 22 13 0 1 list is full! 11 0 18 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages
  • 35. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 Page 23 has reference bit 1---reset it to 0 0 26 0 0 24 5 26 0 Resident 6 Cold Pages hand-cold 23 hand-hot 0 1 Clock 1 22 7 8 0 21 0 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 0 1 10 0 19 6 22 13 0 1 11 0 18 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages
  • 36. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 Page 22 has reference bit 1---reset it to 0 0 26 0 0 24 5 26 0 Resident 6 Cold Pages hand-cold 23 0 hand-hot Clock 0 1 22 7 8 0 21 0 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 0 10 0 19 6 22 13 0 0 1 11 0 18 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages
  • 37. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 Page 21 has reference bit 0---degrade it 0 26 0 0 24 5 26 0 Resident 6 Cold Pages hand-cold 23 0 Clock hand-hot 0 22 7 8 0 21 0 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 0 10 0 19 6 22 13 0 0 11 0 18 0 0 8 5 0 17 0 15 0 21 13 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages
  • 38. Current accessing: 1 25 25 Page 7 2 4 0 3 0 0 0 24 (3) Degrade page 21 to resident cold page 0 26 0 0 24 5 26 Reorganize clock list 0 Resident 6 Cold Pages hand-cold 23 0 Clock hand-hot 0 22 7 21 8 0 0 9 0 hand-test 0 20 2 4 9 0 0 23 1 0 0 10 0 19 6 22 13 0 0 11 0 18 0 0 8 5 0 13 15 17 0 15 0 0 10 3 17 0 1 20 18 19 11 1 Hot Pages Non-resident Cold Pages

Notes de l'éditeur

  1. Then LRU is approximated by the CLOCK replacement in VM. In CLOCK, All the resident pages are placed around the a circular list, like a clock. There is a clock hand turning in the clockwise direction to search victim pages. Each page is associated with a reference bit, indicating if the page has been accessed. On a hit access, the bit is set automatically by hardware, there are no algorithm operations.
  2. On a miss access, CLOCK t urns the clock hand, evict the first “0” page; CLOCK inserts the missed page at the head, initialize its reference bit to 0. If the ref-bit of page pointed by the hand is “1”, CLOCK gives it a second chance without replacing it, And reset its “1” to “0” and continue to look for a page with its bit of “0” CLOCK simulates LRU replacement very well, and its hit ratios are very close to LRU.
  3. The CLOCK replacement has a long history. It dates back to 1968, F. Corbato describes the CLOCK in his report on Multics system: … Corbato later won Turing Award in 1990.
  4. CLOCK or its variants have been widely used in major OS and described in textbooks. It still plays a dominant role in today’s systems, even with its performance concerns with certain access patterns.
  5. Now let’s see the prior research work on LRU and CLOCK. Because the importance of replacement algorithms and the well-known LRU performance problems, there are a large number of new algorithms proposed for better performance, but almost all of them target at LRU. See the long list over the decades. However, the list for CLOCK is much shorter. See, from 1968 to 1998, it is a really a long time for a person! Only GCLOCK and several CLOCK variants are proposed during the long time. The very stringent low cost requirement poses a big challenge on inventing new VM replacement. Recently there is a VM replacement algorithm called CAR proposed by the researchers at IBM. And we proposed the CLOCK-Pr n pljn.o.
  6. FCLOCK introduce …
  7. Linux and FreeBSD use age-based CLOCK replacements. … However, GCLOCK and age-based CLCOK cannot provide consistent performance improvements. Their performance can be either better or worse than CLOCK. Another problem is that they will consume too many CPU cycles and adjust to changes in the access patterns slowly.
  8. CAR is a recently proposed VM replacement algorithm. In CAR, ….
  9. However, in CAR, …. So some undesirable situation can occur. E.g. … So CAR also can not consistently improve CLOCK performance.
  10. Now let’s see CLOCK-Pro, which uses the same principle as that of LIRS …
  11. I would like to use the figure to illustrate CLOCK-Pro. There are several kinds of pages on the clock. …. I associate a test period to a cold page to test its reuse distance.