Solución de los ejercicios de memoria virtual

De Wiki de Sistemas Operativos
Revisión del 16:21 20 dic 2016 de Carcasdel1 (discusión | contribuciones) (NRU)
(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

NRU

Acceso
  a        1(R)  3(R)  3(W)  3(R)  4(R)  5(R)  1(R)  2(W)  5(W)  1(W)  3(R)  4(R)
página
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
         |  1  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |
Marco 1  | R=1 |  =  |  =  |  =  |  =  |  =  |  =  | R=0 |  =  |  =  |  =  | R=0 |
         | M=0 |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  | M=1 |  =  | M=0 |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
         |     |  3  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  4  |
Marco 2  |     | R=1 |  =  |  =  |  =  |  =  |  =  | R=0 |  =  |  =  | R=1 | R=1 |
         |     | M=0 | M=1 |  =  |  =  |  =  |  =  | M=0 |  =  |  =  |  =  | M=0 |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
         |     |     |     |     |  4  |  =  |  =  |  2  |  =  |  =  |  =  |  2  |
Marco 3  |     |     |     |     | R=1 |  =  |  =  | R=1 |  =  |  =  |  =  | R=0 |
         |     |     |     |     | M=0 |  =  |  =  | M=1 |  =  |  =  |  =  | M=0 |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
         |     |     |     |     |     |  5  |  =  |  =  |  =  |  =  |  =  |  =  |
Marco 4  |     |     |     |     |     | R=1 |  =  | R=0 | R=1 |  =  |  =  | R=0 |
         |     |     |     |     |     | M=0 |  =  | M=0 | M=1 |  =  |  =  | M=0 |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Fallo    |     |     |     |     |     |     |     |     |     |     |     |     |
 de      |  x  |  x  |     |     |  x  |  x  |     |  x  |     |     |     |  x  |
página   |     |     |     |     |     |     |     |     |     |     |     |     |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+

Tiempo      1     2     3     4     5     6     7     8     9    10    11    12

                            nº fallos de página     6
Tasa de fallos de página = --------------------- = ---- = 0,5
                            nº accesos a páginas    12

Sustitución por envejecimiento

Periodo = 4

Registro R de 3 bits.

En caso de empate = LRU

Acceso
  a         2     3     3     1     -     4     5     4     1     -     5     2     3     4
página
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Marco 1  |  2  |  =  |  =  |  =  |  =  |  =  |  5  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |
Bit R    | 100 |  =  |  =  |  =  | 010 |  =  | 100 |  =  |  =  | 010 | 110 |  =  |  =  |  =  |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Marco 2  |     |  3  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  2  |  =  |  =  |
Bit R    |     | 100 |  =  |  =  | 010 |  =  |  =  |  =  |  =  | 001 |  =  | 100 |  =  |  =  |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Marco 3  |     |     |     |  1  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  =  |  4  |
Bit R    |     |     |     | 100 | 010 | 010 |  =  |  =  | 110 | 011 |  =  |  =  |  =  | 100 |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Marco 4  |     |     |     |     |     |  4  |  =  |  =  |  =  |  =  |  =  |  =  |  3  |  =  |
Bit R    |     |     |     |     |     | 100 |  =  |  =  |  =  | 010 |  =  |  =  | 100 |  =  |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
Fallo    |     |     |     |     |     |     |     |     |     |     |     |     |     |     |
 de      |  x  |  x  |     |  x  |  -  |  x  |  x  |     |     |  -  |     |  x  |  x  |  x  |
página   |     |     |     |     |     |     |     |     |     |     |     |     |     |     |
         +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
 
Tiempo      1     2     3     4     -     5     6     7     8     -     9    10    11    12    
 
Periodo     4     3     2     1     0     4     3     2     1     0     4     3     2     1   
 8
                             nº fallos de página     8
 Tasa de fallos de página = --------------------- = ---- = 0,6666666666666667
                             nº accesos a páginas    12