Memory abstraction là gì

Home About

No Memory Abstraction

History

The simplest memory abstraction is no abstraction at all.

  • Early computers did not have any memory abstraction at all, which means all programs had direct access to physical memory.
  • This means we could not have 2 programs running in main memory at once, as this would cause inconsistency in data.
  • Processes could erase each others' written output/input and cause severe inconsistencies.
Multiprogramming without memory abstraction
  • It is possible to run multiple programs without having memory abstraction.
  • The idea is to have just one running process in main memory at any point of time.
  • Whenever a process leaves main memory, all of its current state and values are copied out of main memory and another process is brought onto main memory.
  • Whenever the process returns to main memory, all of the saved contents are brought back to main memory.
Multiprogramming without memory abstraction or swapping
  • With addition of special hardware, it is possible to run multiprogramming without swapping.
  • Early models of IBM 360 followed this approach:
    • Memory was divided into 2 KB blocks and each block was assigned a 4-bit protetion key held in special registers inside the CPU.
    • A machine with 1 MB memory needed only 512 of these 4 bit registers for a total of 256 bytes of key storage.
    • The PSW [Program Status Word] also contained a 4-bit key.
    • The 360 hardware trapped any attempt by a running process to access memory with a protection code from the PSW key.
    • Only the OS is permitted to change the protection keys, hence, user processes could not interfere with one another and also with the OS process.
Quiz
  1. The main problem with having two programs in memory without memory abstraction is
    1. it is difficult to determine the name of each program
    2. each program will have different ideas about what the CPU should be doing
    3. each program can overwrite the memory of the other
    4. none of the above
  2. Without memory abstraction we can still have multiprogramming
    1. by only running one program at a time and completely swapping each successive program in and out of memory
    2. by using VT
    3. by taking advantage of an MMU
    4. with paging
  3. Even without swapping or memory abstraction we can multiprogram
    1. if we write our code very carefully
    2. if we have an MMU
    3. if we have special hardware to divide memory between different programs
    4. all of the above
Answers

1. c; 2. a; 3. c;

Video liên quan

Chủ Đề