O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

Memory management

Ar B Computer Science Masters Inglês 23 flashcards

Flashcards do conjunto (23)

  1. 1Logical AddressGenerated by the CPU
    User program only sees logical addresses
    Bound to a physical address
  2. 2Physical AddressActual address in main memory
  3. 3Address mappingDone by the MMU
    Can be performed at compile time, load time and execution time
  4. 4SwappingIf memory demand too high, memory of some processes swapped to disk
    Can be combined with scheduling - lower priority processes swapped out first
    Problem of big transfer time - memory access time is in n/s, disk access is in m/s
    Transfer time reason swapping not principle memory management technique
  5. 5FragmentationWastage and inefficient usage of free space
    Causes performance issues
    Swapping raises two problems:
    - External fragmentation
    - Internal fragmentation
  6. 6External fragmentationOver time, small holes appear in memory that are interspersed by allocated memory
    Holes only usable to processes with small memory usage
    Free memory no longer contiguous
  7. 7Internal fragmentationOccurs in fixed sized memory allocation techniques
    After a small sized program / file is assigned to a slot / hole / segment, the remaining free space is unusable (too small to be assigned)
  8. 8Strategies for choosing holes left over from External fragmentationFirst fit:
    - Start from beginning and use first available slot that fits
    - Leads to more E.F
    - Doesn't give holes possibility to recombine
    Rotating first fit:
    - Start after last assigned part of memory
    - Less E.F
    Best fit:
    - Find first usable space
    - Minimises E.F at the expense of I.F
    - Danger of finding spaces that only just fit (I.F)
    Buddy system:
    - Allocate physical contiguous areas of memory
    - Look for space with size with smallest power of 2 (that fits)
    - Free holes administered using tree structure (smallest possible chunk used)
    - Good for recombining
  9. 9PagingType of virtual memory
    Memory divided into blocks of a fixed size (page) - become interchangeable
    - Physical address blocks = frames
    - Logical address blocks = pages
    Translation of logical address to physical address achieved with page table
    Pages can be mapped non contiguously onto main memory; allocated physical memory whenever it is available (avoids E.F - can still get I.F)
  10. 10Page TableEach entry of table consists of memory address and control bits
    Each process has separate page table:
    - Allows each process to use same set of addresses
    Used to see if a particular page is in main memory (and can be executed) or needs to be fetched from disk (page fault) first
    Logical address consists of page number and offset:
    - Page number corresponds to index in the table
    - Offset added to address in table (for that page number) to get physical address in main memory
  11. 11SegmentationMemory divide according to its usage by programs:
    - Stacks, functions, data stored in a 'segment'
    Like paging, segments can be mapped non contiguously onto physical memory
    Each memory segment has length and set of permissions:
    - lengths can be different; avoids I.F at the expense of E.F
    Translation of logical address to physical address achieved with segment table
  12. 12Segment TableEach entry of table consists of a base (starting physical address of segment) and a limit (length of the segment)
    Logical address consists go segment number and a offset:
    - Segment number corresponds to index in the table
    - Offset is checked against limit; if smaller then added to base to get actual physical address, if not then segmentation fault
  13. 13Segmentation: Protection and sharingProtection associated within segments:
    - When process tries to access memory, checked to see if it has valid permissions for that segment
    Sharing can be achieved by segments referencing multiple processes:
    - Processes would have same segment name / address in their segment table
  14. 14Paging segmentationCan combine paging and segmentation
    Logical address in now a segment number, page number within that segment and an offset
    Segment table consist of a base and a limit (number of pages):
    - Page number in LA checked against limit; if smaller than added to base else addressing error
  15. 15Virtual memoryComplete separation of logical and physical memory
    Allows execution of processes that are not completely in main memory (by combining main memory and disk)
    Programs can be larger than physical memory
  16. 16Demand pagingImplementing virtual memory
    Pages have valid and invalid bits:
    - Valid: page in main memory
    - Invalid: page in fault list
    Decisions:
    1 - Which process to swap out (move whole memory of process to disk and block); measure of last resort
    2 - Which pages to move to disk when additional pages (memory) required
    Minimising page faults (fetching from disk) is crucial
  17. 17Page replacement algorithmsFIFO:
    - Easy to implement
    - Doesn't take locality into account; intensively used memory could be swapped instead of pages (called later) that have lower usage
    Least-recently used:
    - Replace page that has been unused for the longest time
    - Required a lot of HW support
    - Two methods; Stack in microcode (track every page) or approximation using reference bits (below).
    - Second change algorithm; HW sets bit to 1 when page is referenced; use FIFO algorithm and skip pages with reference bit of 1 (resetting to 0 when check made)
  18. 18ThrashingConstant state of paging (data rapidly being transferred to/from disk)
    If process lacks physical memory it uses constantly, then page fault rate increases:
    - CPU throughput decreases dramatically
    - Disastrous effect on performance
  19. 19Thrashing solutions Working-set modelBased on locality
    Working-set is set of pages used on most recent x page references
    Working-set kept in main memory
    Increases CPU utilisation and prevents thrashing
    Need to determine working set:
    - Use reference bits; define working set as pages with reference bit set
    - Trying to approximate how much each process needs
  20. 20Thrashing solutions Page-fault frequencyMeasure how often a process generates a page fault
    Gives process additional frames (physical memory) if page frequency high
    Remove frames from process if page fault rate low
  21. 21Memory management in linux kernelOnly four segments in total (not per process):
    - Kernel code
    - Kernel data
    - User code
    - User data
    Paging used
  22. 22Kernel memory and user memorySeparate logical addresses for kernel and user memory
    Kernel space occupies upper half of address space
    Kernel memory always mapped (never swapped out)
    Kernel memory protected against access from user processes
  23. 23Page cache (kernel)Have repeated cycles of allocation (and freeing) for same kinds of objects e.g.
    inodes/dentries
    Instead of going through memory management cycle; have pool of pages used as a cache for these objects

Informações

Descrição
Masters Computer Science (OS) FlashCards sobre Memory management, criado por Ar B em 16-04-2016.
Criado por
Ar B
Visualizações
12
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?