1. CS225
    1. Introduction
    2. Lesson 1
    3. Lesson 2
    4. Lesson 3
    5. Lesson 4
  2. CS251
    1. The Beginning
  3. CS180
    1. Introduction
    2. Midterm Revision
    3. Finals Revision
    4. CS251
    5. Memory
    6. ELF Format
    7. History of Computers
    8. Stuff to Research
    9. Quiz To-Do
    10. OS Architectures
    11. Week 3
    12. Week 4
    13. Week 5
    14. Week 6 (Threads)
    15. Week 7 (Scheduling)
    16. Week 8 (Thread Scheduling)
    17. Week 9 (Memory Management)


    1. OOP
      1. Inheritance
      2. R-Value References
    2. Misc Notes
    3. Size/Offsets of Structs/Classes
    4. Week 4
    1. Introduction
    2. Scan Conversion
    3. Quiz 01
    1. Notes

Week 9 (Memory Management)

if WE is turned off its read only, if WE is turned on its read/write

Addresses are generated by the CPU during the fetch state when its getting the instruction address from the program counter (although from the memory's point of view, it does not matter)

The “address” in the interface with CPU slide is referring to the address bus.


Memory mapping means reversing some memory space for I/O.

CPU-generated memory addresses are not REAL memory addresses - they are logical addresses.

Logical address space is mapped by the loader during runtime - executable layout is NOT logical address space

Shared Dynamic Libraries are dlls in windows - they are used to load in the shared processes between existing process. The loader intelligently figures out the similarities between the current and newly run process and see what is shared. However it does not necessarily have to be shared, especially since there has to be a FIRST process that uses the dll.

Statically linked libraries, will, obviously, be much larger than dynamically linked libraries.

Dynamic Linking is if you do not have certain information until run-time

If the function is not used, the dynamic library is not necessarily linked.

Dynamic Linking has more overhead than static Linking.

dlls are loaded into memory on first attempt - subsequent attempts will just load from the memory.

Compile/link-time binding - not flexible, but the logical addresses do not need to contiguous.

in load-time binding, addresses are relative to some base address in physical memory. this base is determined by the loader.

limit and base are always changed between states

worst fit is worst

external fragmentation is combining the contiguous fragments

Best fit: The allocator places a process in the smallest block of unallocated memory in which it will fit. For example, suppose a process requests 12KB of memory and the memory manager currently has a list of unallocated blocks of 6KB, 14KB, 19KB, 11KB, and 13KB blocks. The best-fit strategy will allocate 12KB of the 13KB block to the process.

First fit: There may be many holes in the memory, so the operating system, to reduce the amount of time it spends analyzing the available spaces, begins at the start of primary memory and allocates memory from the first hole it encounters large enough to satisfy the request. Using the same example as above, first fit will allocate 12KB of the 14KB block to the process.

Worst fit: The memory manager places a process in the largest block of unallocated memory available. The idea is that this placement will create the largest hold after the allocations, thus increasing the possibility that, compared to best fit, another process can use the remaining space. Using the same example as above, worst fit will allocate 12KB of the 19KB block to the process, leaving a 7KB block for future use.

the reason that each process is sectioned off into multiple “segments” is because each one has its own properties.

In computer storage, fragmentation is a phenomenon in which storage space is used inefficiently, reducing capacity or performance and often both. The exact consequences of fragmentation depend on the specific system of storage allocation in use and the particular form of fragmentation. In many cases, fragmentation leads to storage space being "wasted", and in that case the term also refers to the wasted space itself. For other systems (e.g. the FAT file system) the space used to store given data (e.g. files) is the same regardless of the degree of fragmentation (from none to extreme).

Compaction is basically to counter the external fragmentation problem - As a memory pool is allocated from, over time the pool will become fragmented. Some objects from the pool will be allocated surrounded by objects that are not, in seemingly random order. Memory compaction is the process of moving allocated objects together, and leaving empty space together.


during second level paging the first 20 bits is the frame number - it still needs to be shifted (20 bits to 32 bits)