SlideShare a Scribd company logo
Gerenciamento de Mem´ria
                    o
Sonho dos usu´rios
                               a
Idealmente, a mem´ria deveria ser
                 o

 • r´pida,
    a
 • de custo baixo,
 • imensa e
 • n˜o vol´til.
    a     a
Realidade para os usu´rios
                                 a
                      Hierarquia de Mem´ria
                                       o

Typical access time                           Typical capacity


       1 nsec                 Registers         <1 KB
       2 nsec                  Cache             1 MB
      10 nsec               Main memory          64-512 MB
      10 msec               Magnetic disk        5-50 GB

     100 sec                Magnetic tape        20-100 GB
Hierarquia de Mem´ria
                          o
                   Registradores
• Internos ` CPU
           a
• Extremamente r´pidos
                a
• Otimiza¸oes de c´digo podem mover temporariamente
          c˜        o
  vari´veis para registradores.
      a
• Programas podem dar palpites sobre o que deve ficar
  armazenado nos registradores
  register int r;
Hierarquia de Mem´ria
                          o
                       Cache
• Internos ou muito pr´ximos ` CPU
                      o      a
• Divididos em linhas de cache
• Controlados por hardware
• Cache hit
• Cache miss
Hierarquia de Mem´ria
                          o
              Mem´ria Principal
                 o
• Random Access Memory (RAM)
• Compromisso entre pre¸o e desempenho
                       c
• Armazenamento vol´til
                   a
Hierarquia de Mem´ria
                        o
               Disco
                  Read/write head (1 per surface)
Surface 7

Surface 6
Surface 5

Surface 4
Surface 3
                          Direction of arm motion
Surface 2
Surface 1

Surface 0
Hierarquia de Mem´ria
                          o
                 Fitas magn´ticas
                           e
• Utilizadas para c´pias de seguran¸a (backups)
                   o               c
• Armazenamento de grandes quantidades de dados
• Acesso seq¨encial
            u
Hierarquia de Mem´ria
                          o
           Outros tipos de mem´ria
                              o
• ROM (Read Only Memory)
  – r´pida e barata
     a
  – bootstrap loader est´ gravado em ROM
                        a
• EEPROM (Electrically Erasable ROM)
  – podem ser apagadas (erros podem ser corrigidos)
• CMOS
  – dependem de uma bateria
  – armazenam rel´gio e configura¸oes
                 o              c˜
Monoprograma¸˜o
                        ca
            0xFFF …
                      Operating           Device
                      system in       drivers in ROM
                        ROM
  User
program                                    User
                                         program
                        User
                      program
Operating                               Operating
system in                               system in
  RAM                                     RAM
            0                     0                    0
   (a)                   (b)               (c)

mainframes            palmtops         MS-DOS
Multiprograma¸˜o e parti¸oes fixas
             ca         c˜
   Multiple
input queues
                             800K
               Partition 4                        Partition 4
                             700K


               Partition 3             Single     Partition 3
                                    input queue


                             400K

               Partition 2                        Partition 2

                             200K
               Partition 1                        Partition 1
                             100K
               Operating                          Operating
                system                             system
                             0
                   (a)                                (b)
Modelagem de multiprograma¸˜o
                           ca

• Quantos processos colocar na mem´ria?
                                  o
• Estimativa de uso da CPU

                                      20% I/O Wait

                                      50% I/O Wait

                                      80% I/O Wait
Modelagem de multiprograma¸˜o
                           ca
• Quantos processos colocar na mem´ria?
                                  o
• Aposta otimista: 5 processos 80
Modelagem de multiprograma¸˜o
                           ca
• Vis˜o probabil´
     a          ıstica
• Taxa de utiliza¸˜o da CPU = 1 - (0.8)n
                 ca

  ...

  ...

  ...

  ...

  ...
Modelagem de multiprograma¸˜o
                          ca
                                                   20% I/O wait
CPU utilization (in percent)


                               100
                                                         50% I/O wait
                               80

                               60                             80% I/O wait

                               40

                               20


                                     0   1     2     3      4    5     6     7   8    9   10
                                                         Degree of multiprogramming
                                             Utiliza¸˜o da CPU = 1 - p
                                                    ca                          n
An´lise de Desempenho
                a
                         CPU
              Arrival   minutes                                               # Processes
        Job    time     needed                                              1    2    3   4
         1    10:00        4                              CPU idle         .80     .64      .51   .41
         2    10:10        3                              CPU busy         .20     .36      .49   .59
        3     10:15          2                            CPU/process      .20     .18      .16   .15
        4     10:20          2
                (a)                                                                 (b)



                2.0                       .9              .8      .3             Job 1 finishes
1
              Job 2 starts                .9              .8      .3              .9         .1
2
                                                          .8      .3              .9
3
                                                                  .3              .9         .1       .7
4

0
    0                            10              15              20 22                    27.6 28.2        31.7
                                      Time (relative to job 1's arrival)
                                                    (c)
Swapping
                                 CPU



                                         CPU scheduler


Arriving
  job
            Input
           queue
                                 Main
                                Memory




                                                  Memory     Disk
                    Admission
                    scheduler                    scheduler
Swapping
                                    Time



                           C           C           C           C           C


               B           B           B           B
                                                                           A

   A           A           A
                                                   D           D           D

Operating   Operating   Operating   Operating   Operating   Operating   Operating
 system      system      system      system      system      system      system
   (a)         (b)         (c)         (d)         (e)         (f)         (g)
Reloca¸˜o e Prote¸˜o
                ca         ca
• Reloca¸˜o: um programa deve poder rodar em endere¸os
          ca                                       c
  f´
   ısicos distintos.
• Prote¸˜o: um programa n˜o pode fazer acesso ` ´rea de
       ca                 a                   aa
  mem´ria reservada a outro programa.
      o
Reloca¸˜o durante a carga
             ca
• Todos os endere¸os precisam ser identificados e alterados
                 c
• N˜o resolve o problema da prote¸˜o
   a                             ca
Bits de prote¸˜o
                            ca
                      1010
                      1010
                      1010
                      0011
                      0011

O PSW de cada processo deve conter os bits de prote¸˜o
                                                   ca
Registradores base e limite
   Address
                                                            Registers
                                                              when
0xFFFFFFFF                                                  program 2
                                                            is running

                 User program   Registers
                                                               Limit-2
                   and data       when
                                program 1    User-2 data
                                is running                     Base-2


   Limit                        Limit-2
                 User program   Base-2       User-1 data
                   and data                                    Limit-1
                                Limit-1      User program
   Base                         Base-1                         Base-1




                  Operating                   Operating
                   System                      System
             0
                     (a)                         (b)
Espa¸o para crescimento
                c
                               B-Stack
            Room for growth
                                          Room for growth

                               B-Data
   B        Actually in use
                              B-Program



                               A-Stack
            Room for growth
                                          Room for growth           Address (hex)
                               A-Data                               FFFF
   A        Actually in use                                 Stack
                              A-Program
                                                            Gap
Operating                     Operating
 system                        system
                                                            Data

   (a)                           (b)                        Text
                                                                    0000
Compacta¸˜o de mem´ria
        ca        o

      A       A


      —       B
      B       C
      —       —
      C       —
Bitmaps e lista de livres
  A                   B          C                   D             E
              8                  16                       24
                                      (a)


11111000          P   0   5          H      5   3         P    8   6   P 14 4
11111111
11001111
                  H 18 2             P 20 6               P 26 3       H 29 3   X
11111000

            Hole Starts Length                       Process
                 at 18    2
   (b)                                              (c)
Atualiza¸˜o da lista
                   ca
      Before X terminates             After X terminates
(a)    A      X      B      becomes   A              B

(b)    A      X             becomes   A

(c)           X      B      becomes                  B

(d)           X             becomes
Algoritmos para aloca¸˜o de mem´ria
                     ca        o
• First fit
• Next fit
• Best fit
• Worst fit
Problema relacionado
               Malloc, free e realloc
       void *malloc(size_t size);
       void free(void *ptr);
       void *realloc(void *ptr, size_t size);
A aloca¸˜o de registros dentro de um processo tem
       ca
problemas semelhantes:
 • administra¸˜o de uma lista de livres
             ca
 • fragmenta¸˜o
            ca
Programas muito grandes
O que fazer se um programa for muito grande para caber na
mem´ria?
    o
Overlays
dados d1, d2, d3, d4, d5;

f1();    g1();    h1();
f2();    g2();    h2();
f3();    g3();    h3();

main() {
  fase_1();   /* fun¸oes f e dados d1, d2, d3 */
                    c
  fase_2();   /* fun¸oes g e dados d1, d2, d4 */
                    c
  fase_3();   /* fun¸oes h e dados d1, d2, d5 */
                    c
  }
Mem´ria Virtual
                 o
                    The CPU sends virtual
        CPU         addresses to the MMU
       package

CPU
                   Memory                     Disk
                  management     Memory     controller
                     unit



                                                         Bus

      The MMU sends physical
      addresses to the memory


        Memory Management Unit (MMU)
Pagina¸˜o
                 ca
 Virtual
address
  space
60K-64K     X
56K-60K    X    Virtual page
52K-56K    X
48K-52K    X
44K-48K    7
40K-44K    X
                               Physical
36K-40K    5                   memory
32K-36K    X                   address
28K-32K    X                   28K-32K
24K-28K    X                   24K-28K
20K-24K    3                   20K-24K
16K-20K    4                   16K-20K
12K-16K    0                   12K-16K
 8K-12K    6                   8K-12K
  4K-8K    1                   4K-8K
  0K-4K    2                      0K-4K

                               Page frame
Mapeamento dos endere¸os
                     c
                                                                 Outgoing
            1 1 0 0 0 0 0 0 0 0 0 0 1 0 0                        physical
                                                                 address
                                                                 (24580)

             15    000     0
             14    000     0
             13    000     0
             12    000     0
             11    111     1
             10    000     0
              9    101     1
                                               12-bit offset
  Page        8    000     0
                                               copied directly
  table       7    000     0                   from input
              6    000     0                   to output
              5    011     1
              4    100     1
              3    000     1
              2    110     1        110
              1    001     1
                                  Present/
              0    010     1
                                  absent bit
              Virtual page = 2 is used
              as an index into the
              page table                                         Incoming
                                                                 virtual
                                                                 address
          0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0
                                                                 (8196)
Espa¸o de endere¸amento
           c           c
• Apenas as p´ginas ocupadas precisam ser mapeadas
             a
                           Address (hex)
                           FFFF
                   Stack

                    Gap

                   Data
                    Text
                           0000
Mem´ria compartilhada
   o
    Processo A   Processo B

      Pilha        Pilha




                  Shmem

     Shmem


      Data         Data
      Texto        Texto
Mem´ria compartilhada
            o
  int shmget(key_t key, size_t size, int shmflg);
  void *shmat(int shmid,
              const void *shmaddr, int shmflg);
• Veja os exemplos: sh1.c sh2,c sh fork.c

More Related Content

Viewers also liked

Veiculoimaginario liquidos
Veiculoimaginario liquidosVeiculoimaginario liquidos
Veiculoimaginario liquidos
lobisomem1973
 
Alias 2012 sales
Alias 2012 salesAlias 2012 sales
Alias 2012 sales
Paulo Russel
 
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
Guillermo Padrés Elías
 
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
SAE - Secretaria de Assuntos Estratégicos da Presidência da República
 
Microsoft surface
Microsoft surfaceMicrosoft surface
Tabletas electronicas sss
Tabletas electronicas sssTabletas electronicas sss
Tabletas electronicas sss
karlagabrielagcasschsjhs
 
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
BIMGENIA S.L.
 
Soluções em dados geográficos
Soluções em dados geográficosSoluções em dados geográficos
Soluções em dados geográficos
Imagem Maps
 
Tabletas
TabletasTabletas
Tabletas
rafaU23
 
Incremental Subdivision for Triangle Meshes
Incremental Subdivision for Triangle MeshesIncremental Subdivision for Triangle Meshes
Incremental Subdivision for Triangle Meshes
Michel Alves
 
Damien Piller - Migros Rapport Annuel
Damien Piller - Migros Rapport AnnuelDamien Piller - Migros Rapport Annuel
Damien Piller - Migros Rapport Annuel
Damien Piller
 
PortFolio AUg.Arquitectos, SLP
PortFolio AUg.Arquitectos, SLPPortFolio AUg.Arquitectos, SLP
PortFolio AUg.Arquitectos, SLP
Salvador G.
 
Metro do Porto
Metro do PortoMetro do Porto
Metro do Porto
tomallen
 
Simbioses Industriais
Simbioses IndustriaisSimbioses Industriais
Simbioses Industriais
Inês Costa
 
Rapport d'activité annuel 2015. Médiathèque Agneaux
Rapport d'activité annuel 2015. Médiathèque AgneauxRapport d'activité annuel 2015. Médiathèque Agneaux
Rapport d'activité annuel 2015. Médiathèque Agneaux
Sylvie Cuesta
 
Fost Plus rapport annuel 2015
Fost Plus rapport annuel 2015Fost Plus rapport annuel 2015
Fost Plus rapport annuel 2015
Kelly Baetens
 
Infnet Infra Day II - Server Core na prática
Infnet Infra Day II - Server Core na práticaInfnet Infra Day II - Server Core na prática
Infnet Infra Day II - Server Core na prática
Invent IT Solutions
 
Gehorthese
GehortheseGehorthese
Gehorthese
medentic
 
Introduction to Hardening: A Short Course
Introduction to Hardening: A Short CourseIntroduction to Hardening: A Short Course
Introduction to Hardening: A Short Course
Michel Alves
 
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
SAE - Secretaria de Assuntos Estratégicos da Presidência da República
 

Viewers also liked (20)

Veiculoimaginario liquidos
Veiculoimaginario liquidosVeiculoimaginario liquidos
Veiculoimaginario liquidos
 
Alias 2012 sales
Alias 2012 salesAlias 2012 sales
Alias 2012 sales
 
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
07-08-2013 El Gobernador Guillermo Padrés colocó la primera piedra de Ellison...
 
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
Cenários de Mudanças Climáticas: Regionalização (‘downscaling’)
 
Microsoft surface
Microsoft surfaceMicrosoft surface
Microsoft surface
 
Tabletas electronicas sss
Tabletas electronicas sssTabletas electronicas sss
Tabletas electronicas sss
 
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
2011 RESIDENTIAL BUILDING DESIGN BROCHURE GD-INCO
 
Soluções em dados geográficos
Soluções em dados geográficosSoluções em dados geográficos
Soluções em dados geográficos
 
Tabletas
TabletasTabletas
Tabletas
 
Incremental Subdivision for Triangle Meshes
Incremental Subdivision for Triangle MeshesIncremental Subdivision for Triangle Meshes
Incremental Subdivision for Triangle Meshes
 
Damien Piller - Migros Rapport Annuel
Damien Piller - Migros Rapport AnnuelDamien Piller - Migros Rapport Annuel
Damien Piller - Migros Rapport Annuel
 
PortFolio AUg.Arquitectos, SLP
PortFolio AUg.Arquitectos, SLPPortFolio AUg.Arquitectos, SLP
PortFolio AUg.Arquitectos, SLP
 
Metro do Porto
Metro do PortoMetro do Porto
Metro do Porto
 
Simbioses Industriais
Simbioses IndustriaisSimbioses Industriais
Simbioses Industriais
 
Rapport d'activité annuel 2015. Médiathèque Agneaux
Rapport d'activité annuel 2015. Médiathèque AgneauxRapport d'activité annuel 2015. Médiathèque Agneaux
Rapport d'activité annuel 2015. Médiathèque Agneaux
 
Fost Plus rapport annuel 2015
Fost Plus rapport annuel 2015Fost Plus rapport annuel 2015
Fost Plus rapport annuel 2015
 
Infnet Infra Day II - Server Core na prática
Infnet Infra Day II - Server Core na práticaInfnet Infra Day II - Server Core na prática
Infnet Infra Day II - Server Core na prática
 
Gehorthese
GehortheseGehorthese
Gehorthese
 
Introduction to Hardening: A Short Course
Introduction to Hardening: A Short CourseIntroduction to Hardening: A Short Course
Introduction to Hardening: A Short Course
 
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
Modelagem Climática - Apresentação dos cenários IPCC AR4 e AR5 e consideraçõe...
 

Similar to Gerenciamento de Memória(2)

Performance tuning on the blackfin Processor
Performance tuning  on the blackfin ProcessorPerformance tuning  on the blackfin Processor
Performance tuning on the blackfin Processor
Pantech ProLabs India Pvt Ltd
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 
VDI Design Guide
VDI Design GuideVDI Design Guide
VDI Design Guide
Dan Brinkmann
 
Implementing Lightweight Networking
Implementing Lightweight NetworkingImplementing Lightweight Networking
Implementing Lightweight Networking
National Cheng Kung University
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Nate Lawson
 
Ibm cell
Ibm cell Ibm cell
XS Boston 2008 OpenSolaris
XS Boston 2008 OpenSolarisXS Boston 2008 OpenSolaris
XS Boston 2008 OpenSolaris
The Linux Foundation
 
Chap4
Chap4 Chap4
Chap4
Premmraj
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
Ford AntiTrust
 
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilitiesBlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat Security Conference
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)
Sneeker Yeh
 
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
The Linux Foundation
 
USAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdfUSAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdf
RichHagarty
 
PerfUG 3 - perfs système
PerfUG 3 - perfs systèmePerfUG 3 - perfs système
PerfUG 3 - perfs système
Ludovic Piot
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
Ford AntiTrust
 
Prezentácia Mac OS X Leopard
Prezentácia Mac OS X LeopardPrezentácia Mac OS X Leopard
Prezentácia Mac OS X Leopard
onlinestore
 
VMworld 2013: Extreme Performance Series: Monster Virtual Machines
VMworld 2013: Extreme Performance Series: Monster Virtual Machines VMworld 2013: Extreme Performance Series: Monster Virtual Machines
VMworld 2013: Extreme Performance Series: Monster Virtual Machines
VMworld
 
2020-ntn-vsphere_performance_principles_bondzio.pdf
2020-ntn-vsphere_performance_principles_bondzio.pdf2020-ntn-vsphere_performance_principles_bondzio.pdf
2020-ntn-vsphere_performance_principles_bondzio.pdf
PhmNgcTr3
 
Virtual Machine Introspection with Xen
Virtual Machine Introspection with XenVirtual Machine Introspection with Xen
Virtual Machine Introspection with Xen
Tamas K Lengyel
 
Spark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg SchadSpark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg Schad
Spark Summit
 

Similar to Gerenciamento de Memória(2) (20)

Performance tuning on the blackfin Processor
Performance tuning  on the blackfin ProcessorPerformance tuning  on the blackfin Processor
Performance tuning on the blackfin Processor
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
 
VDI Design Guide
VDI Design GuideVDI Design Guide
VDI Design Guide
 
Implementing Lightweight Networking
Implementing Lightweight NetworkingImplementing Lightweight Networking
Implementing Lightweight Networking
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
 
Ibm cell
Ibm cell Ibm cell
Ibm cell
 
XS Boston 2008 OpenSolaris
XS Boston 2008 OpenSolarisXS Boston 2008 OpenSolaris
XS Boston 2008 OpenSolaris
 
Chap4
Chap4 Chap4
Chap4
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
 
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilitiesBlueHat v18 || A mitigation for kernel toctou vulnerabilities
BlueHat v18 || A mitigation for kernel toctou vulnerabilities
 
Bootloader and MMU (english)
Bootloader and MMU (english)Bootloader and MMU (english)
Bootloader and MMU (english)
 
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
XPDS16: Xen Live Patching - Updating Xen Without Rebooting - Konrad Wilk, Ora...
 
USAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdfUSAA Mono-to-Serverless.pdf
USAA Mono-to-Serverless.pdf
 
PerfUG 3 - perfs système
PerfUG 3 - perfs systèmePerfUG 3 - perfs système
PerfUG 3 - perfs système
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
 
Prezentácia Mac OS X Leopard
Prezentácia Mac OS X LeopardPrezentácia Mac OS X Leopard
Prezentácia Mac OS X Leopard
 
VMworld 2013: Extreme Performance Series: Monster Virtual Machines
VMworld 2013: Extreme Performance Series: Monster Virtual Machines VMworld 2013: Extreme Performance Series: Monster Virtual Machines
VMworld 2013: Extreme Performance Series: Monster Virtual Machines
 
2020-ntn-vsphere_performance_principles_bondzio.pdf
2020-ntn-vsphere_performance_principles_bondzio.pdf2020-ntn-vsphere_performance_principles_bondzio.pdf
2020-ntn-vsphere_performance_principles_bondzio.pdf
 
Virtual Machine Introspection with Xen
Virtual Machine Introspection with XenVirtual Machine Introspection with Xen
Virtual Machine Introspection with Xen
 
Spark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg SchadSpark Summit EU talk by Jorg Schad
Spark Summit EU talk by Jorg Schad
 

More from elliando dias

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
elliando dias
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
elliando dias
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
elliando dias
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
elliando dias
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
elliando dias
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
elliando dias
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
elliando dias
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
elliando dias
 
Ragel talk
Ragel talkRagel talk
Ragel talk
elliando dias
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
elliando dias
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
elliando dias
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
elliando dias
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
elliando dias
 
Rango
RangoRango
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
elliando dias
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
elliando dias
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
elliando dias
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
elliando dias
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
elliando dias
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
elliando dias
 

More from elliando dias (20)

Clojurescript slides
Clojurescript slidesClojurescript slides
Clojurescript slides
 
Why you should be excited about ClojureScript
Why you should be excited about ClojureScriptWhy you should be excited about ClojureScript
Why you should be excited about ClojureScript
 
Functional Programming with Immutable Data Structures
Functional Programming with Immutable Data StructuresFunctional Programming with Immutable Data Structures
Functional Programming with Immutable Data Structures
 
Nomenclatura e peças de container
Nomenclatura  e peças de containerNomenclatura  e peças de container
Nomenclatura e peças de container
 
Geometria Projetiva
Geometria ProjetivaGeometria Projetiva
Geometria Projetiva
 
Polyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better AgilityPolyglot and Poly-paradigm Programming for Better Agility
Polyglot and Poly-paradigm Programming for Better Agility
 
Javascript Libraries
Javascript LibrariesJavascript Libraries
Javascript Libraries
 
How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!How to Make an Eight Bit Computer and Save the World!
How to Make an Eight Bit Computer and Save the World!
 
Ragel talk
Ragel talkRagel talk
Ragel talk
 
A Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the WebA Practical Guide to Connecting Hardware to the Web
A Practical Guide to Connecting Hardware to the Web
 
Introdução ao Arduino
Introdução ao ArduinoIntrodução ao Arduino
Introdução ao Arduino
 
Minicurso arduino
Minicurso arduinoMinicurso arduino
Minicurso arduino
 
Incanter Data Sorcery
Incanter Data SorceryIncanter Data Sorcery
Incanter Data Sorcery
 
Rango
RangoRango
Rango
 
Fab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine DesignFab.in.a.box - Fab Academy: Machine Design
Fab.in.a.box - Fab Academy: Machine Design
 
The Digital Revolution: Machines that makes
The Digital Revolution: Machines that makesThe Digital Revolution: Machines that makes
The Digital Revolution: Machines that makes
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.Hadoop - Simple. Scalable.
Hadoop - Simple. Scalable.
 
Hadoop and Hive Development at Facebook
Hadoop and Hive Development at FacebookHadoop and Hive Development at Facebook
Hadoop and Hive Development at Facebook
 
Multi-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case StudyMulti-core Parallelization in Clojure - a Case Study
Multi-core Parallelization in Clojure - a Case Study
 

Recently uploaded

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 

Recently uploaded (20)

GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 

Gerenciamento de Memória(2)

  • 2. Sonho dos usu´rios a Idealmente, a mem´ria deveria ser o • r´pida, a • de custo baixo, • imensa e • n˜o vol´til. a a
  • 3. Realidade para os usu´rios a Hierarquia de Mem´ria o Typical access time Typical capacity 1 nsec Registers <1 KB 2 nsec Cache 1 MB 10 nsec Main memory 64-512 MB 10 msec Magnetic disk 5-50 GB 100 sec Magnetic tape 20-100 GB
  • 4. Hierarquia de Mem´ria o Registradores • Internos ` CPU a • Extremamente r´pidos a • Otimiza¸oes de c´digo podem mover temporariamente c˜ o vari´veis para registradores. a • Programas podem dar palpites sobre o que deve ficar armazenado nos registradores register int r;
  • 5. Hierarquia de Mem´ria o Cache • Internos ou muito pr´ximos ` CPU o a • Divididos em linhas de cache • Controlados por hardware • Cache hit • Cache miss
  • 6. Hierarquia de Mem´ria o Mem´ria Principal o • Random Access Memory (RAM) • Compromisso entre pre¸o e desempenho c • Armazenamento vol´til a
  • 7. Hierarquia de Mem´ria o Disco Read/write head (1 per surface) Surface 7 Surface 6 Surface 5 Surface 4 Surface 3 Direction of arm motion Surface 2 Surface 1 Surface 0
  • 8. Hierarquia de Mem´ria o Fitas magn´ticas e • Utilizadas para c´pias de seguran¸a (backups) o c • Armazenamento de grandes quantidades de dados • Acesso seq¨encial u
  • 9. Hierarquia de Mem´ria o Outros tipos de mem´ria o • ROM (Read Only Memory) – r´pida e barata a – bootstrap loader est´ gravado em ROM a • EEPROM (Electrically Erasable ROM) – podem ser apagadas (erros podem ser corrigidos) • CMOS – dependem de uma bateria – armazenam rel´gio e configura¸oes o c˜
  • 10. Monoprograma¸˜o ca 0xFFF … Operating Device system in drivers in ROM ROM User program User program User program Operating Operating system in system in RAM RAM 0 0 0 (a) (b) (c) mainframes palmtops MS-DOS
  • 11. Multiprograma¸˜o e parti¸oes fixas ca c˜ Multiple input queues 800K Partition 4 Partition 4 700K Partition 3 Single Partition 3 input queue 400K Partition 2 Partition 2 200K Partition 1 Partition 1 100K Operating Operating system system 0 (a) (b)
  • 12. Modelagem de multiprograma¸˜o ca • Quantos processos colocar na mem´ria? o • Estimativa de uso da CPU 20% I/O Wait 50% I/O Wait 80% I/O Wait
  • 13. Modelagem de multiprograma¸˜o ca • Quantos processos colocar na mem´ria? o • Aposta otimista: 5 processos 80
  • 14. Modelagem de multiprograma¸˜o ca • Vis˜o probabil´ a ıstica • Taxa de utiliza¸˜o da CPU = 1 - (0.8)n ca ... ... ... ... ...
  • 15. Modelagem de multiprograma¸˜o ca 20% I/O wait CPU utilization (in percent) 100 50% I/O wait 80 60 80% I/O wait 40 20 0 1 2 3 4 5 6 7 8 9 10 Degree of multiprogramming Utiliza¸˜o da CPU = 1 - p ca n
  • 16. An´lise de Desempenho a CPU Arrival minutes # Processes Job time needed 1 2 3 4 1 10:00 4 CPU idle .80 .64 .51 .41 2 10:10 3 CPU busy .20 .36 .49 .59 3 10:15 2 CPU/process .20 .18 .16 .15 4 10:20 2 (a) (b) 2.0 .9 .8 .3 Job 1 finishes 1 Job 2 starts .9 .8 .3 .9 .1 2 .8 .3 .9 3 .3 .9 .1 .7 4 0 0 10 15 20 22 27.6 28.2 31.7 Time (relative to job 1's arrival) (c)
  • 17. Swapping CPU CPU scheduler Arriving job Input queue Main Memory Memory Disk Admission scheduler scheduler
  • 18. Swapping Time C C C C C B B B B A A A A D D D Operating Operating Operating Operating Operating Operating Operating system system system system system system system (a) (b) (c) (d) (e) (f) (g)
  • 19. Reloca¸˜o e Prote¸˜o ca ca • Reloca¸˜o: um programa deve poder rodar em endere¸os ca c f´ ısicos distintos. • Prote¸˜o: um programa n˜o pode fazer acesso ` ´rea de ca a aa mem´ria reservada a outro programa. o
  • 20. Reloca¸˜o durante a carga ca • Todos os endere¸os precisam ser identificados e alterados c • N˜o resolve o problema da prote¸˜o a ca
  • 21. Bits de prote¸˜o ca 1010 1010 1010 0011 0011 O PSW de cada processo deve conter os bits de prote¸˜o ca
  • 22. Registradores base e limite Address Registers when 0xFFFFFFFF program 2 is running User program Registers Limit-2 and data when program 1 User-2 data is running Base-2 Limit Limit-2 User program Base-2 User-1 data and data Limit-1 Limit-1 User program Base Base-1 Base-1 Operating Operating System System 0 (a) (b)
  • 23. Espa¸o para crescimento c B-Stack Room for growth Room for growth B-Data B Actually in use B-Program A-Stack Room for growth Room for growth Address (hex) A-Data FFFF A Actually in use Stack A-Program Gap Operating Operating system system Data (a) (b) Text 0000
  • 24. Compacta¸˜o de mem´ria ca o A A — B B C — — C —
  • 25. Bitmaps e lista de livres A B C D E 8 16 24 (a) 11111000 P 0 5 H 5 3 P 8 6 P 14 4 11111111 11001111 H 18 2 P 20 6 P 26 3 H 29 3 X 11111000 Hole Starts Length Process at 18 2 (b) (c)
  • 26. Atualiza¸˜o da lista ca Before X terminates After X terminates (a) A X B becomes A B (b) A X becomes A (c) X B becomes B (d) X becomes
  • 27. Algoritmos para aloca¸˜o de mem´ria ca o • First fit • Next fit • Best fit • Worst fit
  • 28. Problema relacionado Malloc, free e realloc void *malloc(size_t size); void free(void *ptr); void *realloc(void *ptr, size_t size); A aloca¸˜o de registros dentro de um processo tem ca problemas semelhantes: • administra¸˜o de uma lista de livres ca • fragmenta¸˜o ca
  • 29. Programas muito grandes O que fazer se um programa for muito grande para caber na mem´ria? o
  • 30. Overlays dados d1, d2, d3, d4, d5; f1(); g1(); h1(); f2(); g2(); h2(); f3(); g3(); h3(); main() { fase_1(); /* fun¸oes f e dados d1, d2, d3 */ c fase_2(); /* fun¸oes g e dados d1, d2, d4 */ c fase_3(); /* fun¸oes h e dados d1, d2, d5 */ c }
  • 31. Mem´ria Virtual o The CPU sends virtual CPU addresses to the MMU package CPU Memory Disk management Memory controller unit Bus The MMU sends physical addresses to the memory Memory Management Unit (MMU)
  • 32. Pagina¸˜o ca Virtual address space 60K-64K X 56K-60K X Virtual page 52K-56K X 48K-52K X 44K-48K 7 40K-44K X Physical 36K-40K 5 memory 32K-36K X address 28K-32K X 28K-32K 24K-28K X 24K-28K 20K-24K 3 20K-24K 16K-20K 4 16K-20K 12K-16K 0 12K-16K 8K-12K 6 8K-12K 4K-8K 1 4K-8K 0K-4K 2 0K-4K Page frame
  • 33. Mapeamento dos endere¸os c Outgoing 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 physical address (24580) 15 000 0 14 000 0 13 000 0 12 000 0 11 111 1 10 000 0 9 101 1 12-bit offset Page 8 000 0 copied directly table 7 000 0 from input 6 000 0 to output 5 011 1 4 100 1 3 000 1 2 110 1 110 1 001 1 Present/ 0 010 1 absent bit Virtual page = 2 is used as an index into the page table Incoming virtual address 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 (8196)
  • 34. Espa¸o de endere¸amento c c • Apenas as p´ginas ocupadas precisam ser mapeadas a Address (hex) FFFF Stack Gap Data Text 0000
  • 35. Mem´ria compartilhada o Processo A Processo B Pilha Pilha Shmem Shmem Data Data Texto Texto
  • 36. Mem´ria compartilhada o int shmget(key_t key, size_t size, int shmflg); void *shmat(int shmid, const void *shmaddr, int shmflg); • Veja os exemplos: sh1.c sh2,c sh fork.c