Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out
Your Federal Quarterly Tax Payments are due April 15th Get Help Now >>

18-VirtualMemory

VIEWS: 17 PAGES: 7

									                             Virtual Memory
Lecture 18:
Virtual Memory                   #        #     "    !   %         +, "          !
                                                                                % %(                -

                                 .        %           %
                                                    #/ !% (                        #"   %       #

                             0        " "!               %          #         "" "
                             0 .   %    "" "              !                   #" %   ""
                             0   #" %    ""                    "    #"       %%    (

                      ! "#
                             0       #"   %%                             #        1
                                                                                 "+
                  % '
                   &
                 $% '
                                                 0x800                       Disk: 0x803C4
                                                                             Mem: 0x3C00
                 )
                 (* !   "
                                          Virtual address                    Physical address




Virtual Memory




                                              Virtual Memory


                                                               1
Virtual Memory: Take 1                                                                         A System with Only Physical Memory

2                   #       #            %                   (           "+                     4           % "/ 2 "           #              "    %#         "         %# %%
0                       "                ! % #"             "+                                                                     "#"    "       )


0 2         #               "3 %           !                "
                                                                                                                                   Store 0x10

0                       ""       %       !     3       #                                   #
        "          ""                "
                                                                                                                                   Load 0xf0

        " !         %           #          +               #%    +                (   %%
                                                   "




A System with Virtual Memory                                                                   Page Faults (Similar to “Cache Misses”)

    4       % "/                3 +"           " " ! "               "        )                5        (       6      "       "+                                 #7
                                                                                                )              %           "             !  %              "" "                 #
                                                                                               &)                   % "        !+         !            (           "+               #
                                                                                                    0               "" " " "                  "    "
                                                                                                    0             %
                                                                                                               "( %     %! %                      )


                   Store 0x10




                   Load 0xf0                                                                                  Load 0x05

                                                                                                                                                                                Working
                                                                                                             Store 0xf8
                                                                                                                                                                                 Set
                                                           Virtual Memory: Take 2

                                                                           %# 4                                                  " 3 %%        (              #
                                                           0   "                                   " ""                                       "" "
                                                           0 8 "                       "" "     #    (% (3                                    9                   )
                                                           0 5                            " 3 %% 4                                              %#7
                                                             0 * 9 + 3
                                                             0 2     #                               %%#


          Virtual Memory                                   0               "                         %            "%#             (       3               1
                                                           0 8 #                                                 (


                            2                                 " !              %                         #           !
                                                                                                                                      "
                                                                                                                                                (%    3




Separate Virtual Address Spaces                            Motivation: Process Protection
                                                                       %                   #                     "       ""               " (
0               "
               " ""3 !   %            "
                                      ""
                                                           0 :        3                    (         "           "                        ;           (
0              "     " "
               % 3! % "                 "
                                       # %             #
                                                             !%                                "<

          #         $                 $                                            $           & '           &
                                  &                                                    )                                     (
               &
                                          !
                                                                                       )             )                       *
     !"                 !                                                  !                                         +++++++
              ' !                                                                          ,             ,               ,
                                                                                           ,             ,               ,
                                                                                           ,             ,               ,
                                          "   #$
                                                   %                               $           & '           &
               &
     %"                                                                                )             )                       .
                        !
              ' !
                                                                  -                    )                                     (
                                ( !
                                                                           !                                         +++++++
                                                                                           ,             ,               ,
                                                                                           ,             ,               ,
                                                                                           ,             ,               ,
                                                                                           Virtual Memory: Take 3

                                                                                                     "                       4"              "+
                                                                                           0 = "         "               "                        #6"           +    "
                                                                                                        "+ ("
                                                                                           0         %#    (
                                                                                                           (                            %          "



                                                                                               " !       %               #              !              (                  "
                                                                                                                                                                          #    %
                  Virtual Memory                                                                                         %              (




                                             3

Levels in Memory Hierarchy                                                                 Virtual Memory

                                                                                           > " %+     "                             "              ((
                                                                                           0       ? (                                  %"
                                                                                           0 .    %2    #?                                        % #       %             %"
                                . ,           -% ,                   . /,

                                                                                             %
                                                                                           @ +"                   %%          "
                                                                                           0   !         %              ""        "" " (
                  $                                                                            0     !        %
  ) "                 %&& ,           - % / , + 0 ( , !% . ( ,              %& 3 ,             0                  (("       %
                                                                                                                        ( % ;3                    " (               ""<
        "             -               1               1&                    .
 * +(        "                        * !& & +( ,     * ! 2 & +( ,          * & & 2 +( ,
            ) "       . ,             -% ,            . /,                                                   Virtual page number                       Page offset
                                                                                                         31                                       11                  0
                            4         4
Page Tables                                                   Page Tables




        Each process gets its own page table, why?
                                                              Can’t Execute From Here



Page Faults                                                   Servicing a Page Fault

@%   +"     %%        "                                        ) 2+"                       # #3       "
                                                                                                      # %       +
                                                                                                                "
      8 % "      "%   !   %       #
                                  "       %               "        0      $   "
                                                                   0   = %             7
                                                                                      %#

2"" "      %%   (%";    %   "                  4         <
0 =   !       (   "+                                          &)
                                                                   0              "   %3 "        "
                                                                                                  "       "*2
0 :     ""     %#    "  ( %#%                  ; 3        <
                                                          7
                                                                   0   *2   % "
                                                                            %3        "
                                                                                      "    "          "
                                                                                                      %
0 =            (%" "
0        %     (%" " ( 3     "                  (        3     )              "             "
                                                                                           "A"        %
0 "   3 ?         "    4 "!                   " 3         +        0   *"         "         #(    "
                                                                                                  "       "


            Virtual page number        Page offset
           31                     11                 0
    Servicing a Page Fault                                                   Where Is the Page Table?

                                                 ! 6             ,       9
)     "
      "     %"   %%
   ,=   %+ (%                           $
                                                  - 9
   "      "+   "
               "B                                5
   "  "          #
       "-
      "C
 ) 2
& * =        "
                                            ((       6+
                                                      6+
 ) D      %
          %    "
               %
      %                                                    6+
                                                            6+
    0   D       "     ""           ((
    0       "       ""       "
                             "
                                 % 5( $ 7        8
                                                       5             5




    Making Translation Faster: The TLB                                       TLB Design Issues
    Translation Look-Aside Buffer
                                                                                ""   ( E             %#/ "     "

                                                                             8 @2"" D! %!" ;                           ( "    3           (    /
                                                                                                                                              %<
                                                                                ) %%       %
                                                                                )D
                                                                               & !+                      #"    3
                                                                                                               ;                      <
                                                                                                                                     "7
                                                                                )=                 8 %
                                                                                )5             #       8 @;!       %          <
                                                                                                                             #7
                                                                                )=                 "
                                                                                                                                        MIPS.
                                                                               F)= "                 (
                                                                                                                                  Another HW Option?
TLB Design Issues                                                             Loading Your Program: A Neat Trick

    %       %# 3 3                        8 @      "" "/                       ) " +     #
                                                                                         ""           3                                         "
                                                                                                                                                "
                                                                              &)    "         %(  "   ""
0                  (%%#? ""      ! " ? ""               !                      ) 2 +% %   %     " " !% 3
                                                                                     "+   (
0       (     (%%# ""           !              "       ""        !             ) =                                                                (%
                                                                                    (" "    )
0                     4          "      +
0       "    %%#                      G
                                     & &F                   " ;""    ! #<




Process Interactions                                                          Virtual Memory Summary

.           %  "" "                     ""                                    .     %            #           !   "
            4 3 /             ! ,"    -/ "                               @<
                                                                     % ;8 =       0                      "
                                                                                    %%
                                                                                  0 D"       (%                        #
                                                                                  0                      3
                                                                                                         ;       ! 3       (       "+       "   ! <
8@7
0      %
    % $ " 8@
                                                                              0 .        %2          #       E       " 3       "        #        #
        0 !#       (       4 "3
                                                                                        "" " "                             %        "           8@ )
            %%
        0 =( (   3     "" #"     8
                              " ( @ "" "
             '
        0 H ' % + #% "
                                                                              0 8                "               3                          #    ""
                                                                                  0 8 @ ""
0           % D%                   *
                                "" D 8 3               8@        #
                                                                                  0    ( %
        0 D (" 3                 "" "                       ""
                                                                                  0        ""
        0 I ! 3           "          #"    %       "
                                                                                          Caches and virtual memory?

								
To top