Memoria Simulada
Transcript of Memoria Simulada
![Page 1: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/1.jpg)
IMPLEMENTANDO LA CLASE MEMORIA
0
1
2
3
4
5
6
7
8
Lib
re =
0
M
1
2
3
4
5
6
7
8
-1
Dato Link
1
0
2
1
3
2
4
3
5
4
6
5
7
6
8
7
-1
8
Libre = 0max
![Page 2: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/2.jpg)
DEFINIENDO LA ESTRUCTURA DE LA ZONA DATO
0
1
2
3
4
5
6
7
8
Lib
re =
0
M
1
2
3
4
5
6
7
8
-1
Dato Link
Dato Siguiente
![Page 3: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/3.jpg)
IMPLEMENTANDO METODOS DE LA CLASE MEMORIA
CONSTRUCTOR SMEMORIA::CREAR() INICIO PARA CADA I DESDE 0 HASTA max M[ I ].LINK = I+1 FIN M[ max ].LINK = -1 LIBRE = 0FIN
10
21
32
43
54
65
76
87
-18
Libre = 0
Dato Link
M
![Page 4: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/4.jpg)
IMPLEMENTANDO METODOS DE LA CLASE MEMORIA
FUNCION SMEMORIA::PEDIR_ESPACIO() INICIO X = LIBRE SI X<> -1 ENTONCES LIBRE = M [ X ].LINK FIN SI // RETORNAR VALOR X FIN
SUPOGASE EL OBJETO A DE TIPO SMEMORIA
X = A.PEDIR_ESPACIO()Y = A.PEDIR_ESPACIO()Z = A.PEDIR_ESPACIO()
X = 0Y = 1Z = 2
1
0
2
1
3
2
4
3
5
4
6
5
7
6
8
7
-1
8
Libre = 3
![Page 5: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/5.jpg)
IMPLEMENTANDO METODOS DE LA CLASE MEMORIA
FUNCION SMEMORIA::LIBERAR_ESPACIO( DIR) INICIO SI DIR <> -1 ENTONCES M [ DIR ].LINK = LIBRE
LIBRE = DIR FIN SIFIN
SUPOGASE EL OBJETO A DE TIPO SMEMORIA
LIBERAR_ESPACIO( 0 )LIBERAR_ESPACIO( 2 )
3
0
1
1
0
2
4
3
5
4
6
5
7
6
8
7
-1
8
Libre = 2
![Page 6: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/6.jpg)
IMPLEMENTANDO METODOS DE LA CLASE MEMORIA
FUNCION SMEMORIA::DISPONIBLE( )INICIO X = LIBRE C = 0 // CONTADOR MIENTRAS X <> -1 C=C+1 X=M[ X ].LINK FIN // RETORNAR CFINFUNCTION SMEMORIA::OCUPADO()INICIO C= ( max +1 ) - DISPONIBLE // RETORNAR CFINFUNCION SMEMORIA::ESTADO( DIR )INICIO X = LIBRE C = FALSO // BANDERA MIENTRAS ( X <> -1) Y (C = FALSO) SI X = DIR ENTONCES C = VERDADERO FIN SI X=M[ X ].LINK FIN // RETORNAR C // VERDADERO SI DIR ESTA LIBREFIN // FALSO SI DIR ESTA OCUPADA
3
0
1
1
0
2
4
3
5
4
6
5
7
6
8
7
-1
8
Libre = 2
![Page 7: Memoria Simulada](https://reader036.fdocumento.com/reader036/viewer/2022082503/557be0cfd8b42a03748b4ebd/html5/thumbnails/7.jpg)
PRACTICO
CREAR LA CLASE MEMORIA
FECHA DE PRESENTACION
PROXIMA CLASE
HOY ES 20/MAYO/2008