Post

Memory allocation/ Paging/ Segmentation/ Compaction/ Fit

  • these methods are for dividing the main memory to run multi programming
  • two techniques for organizing, allocating memory

✅ Memory

  1. Continuous memory
  2. Incontinuous memory

✅ Paging

used for incontinuous memory allocation
divide into small processes of same size

  • 운영 체제에서 외부 단편화 문제 해결 위해 사용(external fragmentation)
  • 👍🏻 can use needed data as fast as possible

Screenshot 2024-09-10 at 16 44 22

  • In physical memory, Process A and Process B are not all together
  • processes are not places continuously
  • 👍🏻 no wasted space
  • 👍🏻 Prevent external fragmentation
  • 👍🏻 used more frequently than segmentation(no holes, no external fragmentation)

  • 👎🏻 less secure, difficult sharing than segmentation
  • divide code+data+stack into same size
  • areas can be mixed while dividing
  • areas can be mixed while sharing

✅ Segmentation

also used for incontinuous memory allocation
divide into small processes of various size

  • devide memory into logical unit called segment
  • segments are various size
  • allocate memory, change physical address into logical address
  • 👍🏻 no internal segmentation,
  • 👎🏻 but external segmentation can occur

  • 👍🏻 better than paging for security, sharing
  • segmentation adds read/write/execute authorization to table logically
  • to configure bit is simple, sage
  • divided flexibly, areas do not mix while sharing

  • 👎🏻 various segment size
  • more holes occur, more external segmentation

☑️ Internal Segmentation

When process < memory

  • process is saved, but there is left memory
  • 20MB is too small to save any other process,
  • left

Screenshot 2024-09-13 at 22 36 42

Screenshot 2024-09-13 at 22 36 57

☑️ External Segmentation

Also process < memory, but not continuous

  • memory to save process is more than enough
  • but not continuous
  • process cannot be allocated on memory
  • 💊 compaction

Screenshot 2024-09-13 at 22 37 30

💊 Compaction

to solve external segmentation issue
make two seperated memory continuous

Screenshot 2024-09-13 at 22 39 30

✅ Fit 🟰 Memory allocation Algorithm

allocate left memory to process

✔️ First Fit

  • allocate first memory found to be available

✔️ Best Fit

  • allocate the most fitting memory
  • smallest left space
  • internal segmentation ⬇️

✔️ Worst Fit

  • allocate the wost fitting memory

✔️ Next Fit

  • begin search from the last allocated place

Screenshot 2024-09-13 at 22 47 16

  • A: first fit
  • B: best fit
  • C: worst fit
This post is licensed under CC BY 4.0 by the author.