1 of 33

Está CoverFlow

Porque para entender la recursividad primero hay que comprender la recursividad

http://faqoperativos.com.ar/enunciado-ppt

2 of 33

NADA

No asumir

como real

3 of 33

Arquitectura

C

B

Kernel

A

Programa

PCP

IO

PLP

UMV

n

1

CPU

0

4 of 33

Programa 1/1

Programa A

entendiendo_tp.ansisop

Codigo fuente

PLP

configuracion.config

Direccion del Kernel

5 of 33

Kernel 1/4

PLP

PCP�

New

Ready

Exec

Exit

Block

HIO “Disco

HIO “Floppy

PCB Programa A

6 of 33

Kernel 2/4

PCB

PCB Programa A

  • Identificador único
  • Primer instrucción a ejecutar (!= 0)
  • Índice de etiquetas y funciones serializado
  • Índice de código serializado
  • Tamaño del índice de etiquetas y funciones
  • Tamaño del índice de código
  • Tamaño del Contexto
  • Program Counter

7 of 33

Kernel 3/4

PLP

PCP�

Programa A

New

Ready

Exec

Exit

Block

HIO “Disco

HIO “Floppy

8 of 33

Kernel 4/4

Configuración (ejemplo)

ID_HIO =[Disco, Impresora, Scanner]�HIO =[1000, 2000, 1000]�SEMAFOROS =[SEM1, SEM2, SEM3]�VALOR_SEMAFORO =[0, 0, 5]

MULTIPROGRAMACION = 6�PUERTO_PROG = 5000�PUERTO_CPU = 5001�QUANTUM = 3�RETARDO = 2000

9 of 33

UMV 1/3

Solicitud bytes

Envio bytes

Consola

Kernel

CPU 1

CPU n

10 of 33

UMV 2/3

Segmento 1 (A)

Segmento 2 (A)

Segmento 1 (B)

Segmento 2 (B)

Memoria principal

Segmento 3 (A)

Programa A

  • Segmentos
    • Inicio
    • Fin
    • Ubicación real

Programa B

11 of 33

UMV 3/3

Segmento 1 (A)

Segmento 2 (A)

Segmento 1 (B)

Segmento 2 (B)

Memoria principal

Segmento 3 (A)

Programa A

  • Segmentos
    • Inicio
    • Fin
    • Ubicación real

Programa B

12 of 33

CPU 1/1

Enviar “Hola!

Programa A

printText Hola!

imprimirTexto(“Hola!”)

Program Counter ++

13 of 33

AnSIS P 1/12

  1. Definir variable f
  2. Definir variable a
  3. Definir variable g

variables f, a, g

14 of 33

AnSIS P 2/12

  • Obtener posición de variable a
  • Obtener posición de 3 (parámetro)
  • Dereferenciar esa posición
  • Asignar este valor+0 a esa posición

a = 0+$3

15 of 33

AnSIS P 3/12

  • Obtener posición de variable a
  • Dereferenciar esa posición
  • Asignar este valor a la variable compartida Super

!Super = 1+a

16 of 33

AnSIS P 4/12

  • Obtener valor de variable Super
  • Imprimir este valor

print !Super

17 of 33

AnSIS P 5/12

  • Obtener valor variable compartida Super
  • [Ir a la etiqueta Siguiente]

jnz !Super Siguiente

18 of 33

AnSIS P 6/12

  • Obtener posición de f
  • Dereferenciar esa posición
  • Retornar el valor de f

return f

NO ASIGNA!!

19 of 33

AnSIS P 7/12

  • Ir a entrada y salida del dispositivo impresora por 200 unidades de tiempo

io impresora 200

20 of 33

AnSIS P 8/12

  • Wait a mutexA

wait mutexA

21 of 33

AnSIS P 9/12

  • Signal a Semaforo

signal Semaforo

22 of 33

AnSIS P 10/12

  • Imprimir “Hola Mundo!

textPrint Hola Mundo!

23 of 33

AnSIS P 11/12

g <- mult !Global a+3

  • Obtener valor de variable compartida Global
  • Obtener posición de a
  • Dereferenciar esa posición
  • Obtener posición de g
  • Llamar a la función mult, para retornar en la posicion de g y la instrucción correspondiente
  • Definir variable 0 (parametro)
  • Definir variable 1 (parametro)
  • Asignar lo que valga Global a la nueva variable 0
  • Asignar lo que valga a+3 a la nueva variable 1

24 of 33

AnSIS P 12/12

  • Finalizar contexto actual

end

¿Y begin?

begin no es una instrucción ejecutable.

25 of 33

Stack 1/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

26 of 33

Stack 2/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

43

ee

c6

db

78

60

e4

01

72

82

1c

93

30

aa

4d

0b

b6

50

51

49

57

bf

a6

26

f3

5f

c0

7f

61

08

db

2a

0e

10

58

0xce57f300

bf

9c

13

d6

f2

27 of 33

Stack 3/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

93

30

aa

4d

0b

b6

50

51

49

57

bf

a6

26

f3

5f

c0

7f

61

08

db

2a

0e

10

58

0xce57f300

bf

9c

13

d6

f2

28 of 33

Stack 4/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

93

30

aa

4d

ce

57

f3

00

00

00

00

04

ce

57

f3

0b

0

00

00

00

01

0e

10

58

0xce57f320

bf

9c

13

d6

f2

29 of 33

Stack 5/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

93

30

aa

4d

ce

57

f3

00

00

00

00

04

ce

57

f3

0b

0

00

00

00

01

f

10

58

bf

9c

13

d6

f2

0xce57f320

30 of 33

Stack 6/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

93

30

aa

4d

ce

57

f3

00

00

00

00

04

ce

57

f3

0b

0

00

00

00

01

f

00

00

00

02

13

d6

f2

0xce57f320

31 of 33

Stack 7/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

00

00

00

02

ce

57

f3

00

00

00

00

04

ce

57

f3

0b

0

00

00

00

01

f

00

00

0xce57f300

00

02

13

d6

f2

32 of 33

Stack 8/8

#!/usr/bin/ansisop

begin

variables f, a, g

a = 1

f = 8

g <- doble a

print g

end

function doble

variables f

f = $0 + $0

return f

end

f

00

00

00

08

a

00

00

00

01

g

00

00

00

02

ce

57

f3

00

00

00

00

04

ce

57

f3

0b

0

00

00

00

01

f

00

00

0xce57f300

00

02

13

d6

f2

33 of 33

TERMINATOR

> 2

x

_