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

HyperLogLog in Hive - How to count sheep efficiently?
HyperLogLog in Hive - How to count sheep efficiently?HyperLogLog in Hive - How to count sheep efficiently?
HyperLogLog in Hive - How to count sheep efficiently?bzamecnik
 
Ceph - A distributed storage system
Ceph - A distributed storage systemCeph - A distributed storage system
Ceph - A distributed storage systemItalo Santos
 
Seamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive WarehouseSeamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive WarehouseDataWorks Summit
 
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware OffloadsQuality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware OffloadsNetronome
 
The Linux Scheduler: a Decade of Wasted Cores
The Linux Scheduler: a Decade of Wasted CoresThe Linux Scheduler: a Decade of Wasted Cores
The Linux Scheduler: a Decade of Wasted Coresyeokm1
 
Real-time Stream Processing with Apache Flink
Real-time Stream Processing with Apache FlinkReal-time Stream Processing with Apache Flink
Real-time Stream Processing with Apache FlinkDataWorks Summit
 
Build a High Available NFS Cluster Based on CephFS - Shangzhong Zhu
Build a High Available NFS Cluster Based on CephFS - Shangzhong ZhuBuild a High Available NFS Cluster Based on CephFS - Shangzhong Zhu
Build a High Available NFS Cluster Based on CephFS - Shangzhong ZhuCeph Community
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Labs
 
Process Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelProcess Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelHaifeng Li
 
Apache Hadoop YARN: best practices
Apache Hadoop YARN: best practicesApache Hadoop YARN: best practices
Apache Hadoop YARN: best practicesDataWorks Summit
 
AMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD
 
Manage your bare-metal infrastructure with a CI/CD-driven approach
Manage your bare-metal infrastructure with a CI/CD-driven approachManage your bare-metal infrastructure with a CI/CD-driven approach
Manage your bare-metal infrastructure with a CI/CD-driven approachinovex GmbH
 
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...confluent
 
Ozone: scaling HDFS to trillions of objects
Ozone: scaling HDFS to trillions of objectsOzone: scaling HDFS to trillions of objects
Ozone: scaling HDFS to trillions of objectsDataWorks Summit
 
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...Spark Summit
 
Apache Flink and Apache Hudi.pdf
Apache Flink and Apache Hudi.pdfApache Flink and Apache Hudi.pdf
Apache Flink and Apache Hudi.pdfdogma28
 
Intel vs amd
Intel vs amdIntel vs amd
Intel vs amdAhmed Vic
 

Tendances (20)

HyperLogLog in Hive - How to count sheep efficiently?
HyperLogLog in Hive - How to count sheep efficiently?HyperLogLog in Hive - How to count sheep efficiently?
HyperLogLog in Hive - How to count sheep efficiently?
 
Ceph - A distributed storage system
Ceph - A distributed storage systemCeph - A distributed storage system
Ceph - A distributed storage system
 
Seamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive WarehouseSeamless replication and disaster recovery for Apache Hive Warehouse
Seamless replication and disaster recovery for Apache Hive Warehouse
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware OffloadsQuality of Service Ingress Rate Limiting and OVS Hardware Offloads
Quality of Service Ingress Rate Limiting and OVS Hardware Offloads
 
The Linux Scheduler: a Decade of Wasted Cores
The Linux Scheduler: a Decade of Wasted CoresThe Linux Scheduler: a Decade of Wasted Cores
The Linux Scheduler: a Decade of Wasted Cores
 
Real-time Stream Processing with Apache Flink
Real-time Stream Processing with Apache FlinkReal-time Stream Processing with Apache Flink
Real-time Stream Processing with Apache Flink
 
Cat @ scale
Cat @ scaleCat @ scale
Cat @ scale
 
Build a High Available NFS Cluster Based on CephFS - Shangzhong Zhu
Build a High Available NFS Cluster Based on CephFS - Shangzhong ZhuBuild a High Available NFS Cluster Based on CephFS - Shangzhong Zhu
Build a High Available NFS Cluster Based on CephFS - Shangzhong Zhu
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & Innovation
 
Process Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux KernelProcess Scheduler and Balancer in Linux Kernel
Process Scheduler and Balancer in Linux Kernel
 
Apache Hadoop YARN: best practices
Apache Hadoop YARN: best practicesApache Hadoop YARN: best practices
Apache Hadoop YARN: best practices
 
AMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor ArchitectureAMD EPYC™ Microprocessor Architecture
AMD EPYC™ Microprocessor Architecture
 
Manage your bare-metal infrastructure with a CI/CD-driven approach
Manage your bare-metal infrastructure with a CI/CD-driven approachManage your bare-metal infrastructure with a CI/CD-driven approach
Manage your bare-metal infrastructure with a CI/CD-driven approach
 
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...
Everything You Always Wanted to Know About Kafka’s Rebalance Protocol but Wer...
 
Ozone: scaling HDFS to trillions of objects
Ozone: scaling HDFS to trillions of objectsOzone: scaling HDFS to trillions of objects
Ozone: scaling HDFS to trillions of objects
 
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...
Cost-Based Optimizer Framework for Spark SQL: Spark Summit East talk by Ron H...
 
Microkernel Evolution
Microkernel EvolutionMicrokernel Evolution
Microkernel Evolution
 
Apache Flink and Apache Hudi.pdf
Apache Flink and Apache Hudi.pdfApache Flink and Apache Hudi.pdf
Apache Flink and Apache Hudi.pdf
 
Intel vs amd
Intel vs amdIntel vs amd
Intel vs amd
 

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

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Dernier (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

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.