zoukankan      html  css  js  c++  java
  • [mem] Memory management

    Memory management:

    • allocate / deallocate

    • protection: no access to a process's mem space from outside the given process

    • shared mem management: (between 2 & more procs;) shared libs, shared mem segments (via shmget()), etc.

    Approaches:

    • contiguous mem allocation

    • mono-contiguous mem allocation

    • virtual memory

    With multi-programming, multiple options for managing mem:

    • (early) partitions: each partition is a block of contiguous mem

    Degree of multiprogramming:

    • how many processes could be run at once?
      • depend on: process size, partition size & mem available

    A logical address references some location within a given process address space: the os must map every logical address(generated by some compiler ? assembler) to a physical address

    Contiguous memory allocation:

    • fit the entire process address space into physical mem in one contiguous block
      • each block has: start point, LIMIT (size in bytes)
    • partitioned mem can be fixed / dynamic

    Memory Allocation Schemes

    Fixed Partitioning Scheme:

    • N * {Size} (different sizes)
    • Each process having exactly one partition
    • OS manage the mapping between used partition - proc, keep a list of the free partitions

    Dynamic Partition Scheme:

    • size of a proc ---> size of the partition
      • on-demand partitioning
    • cause memory fragmentation
    |*********|___(finished)__(fragment)_|*********| 
    
    • if a process arrives and requires more than the largest free partition, looking for defragmentation:
      • move some proc mem physical addresses upstream
      • new process on waiting

    algorithms for determine newly arrived proc placement

    • first-fit
      scan from the top until found

      • might cause more fragments
    • next fit
      scan from the end until found

      • will cause less fragments (provide larger contiguous partition upstream)
    • best-fit
      fit into the smallest possible partition

    • worst-fit
      fit into the largest possible partition

  • 相关阅读:
    how to singleton pattern !
    n6600 支持keepalive吗?
    6600的几个不可能的任务!
    Heyy.... i am back with 100 Apps for nokia 6600!
    http client chunked implement via sun
    Excel公司正式发售WinA&D 4.0
    快速开发rails、==常用插件==
    单独使用ActionMailer作为邮件发送器为迩的程序发送报告
    如何在win7上添加自动启动项
    gem install 报错或是太慢,gem install 本地安装
  • 原文地址:https://www.cnblogs.com/manqing/p/10674353.html
Copyright © 2011-2022 走看看