• [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

  • 相关阅读:
    android:ViewPager实现Tabs滑动切换效果
    android:实现退出确认对话框
    jsp初探
    struts2获取前台数据的三种方式
    struts表单验证
    SingleTon
    读取文件中内容并统计排序
    android:TabHost总结
    java i/o
    tomcat7.0连接池配置
  • 原文地址:https://www.cnblogs.com/manqing/p/10674353.html
Copyright © 2020-2023  润新知