Question

How to understand the sentence

we can generalize and allow each data object to have multiple independent addresses, each chosen from a different address sapce. This is the basic idea of virtual memory (《CSAPP》)

why not a data object has unique address?

Était-ce utile?

La solution

Virtual memory is typically used to simplify programming on computers where there are several programs running.

If you have several programs running on your computer, they each see a virtual address space of memory which suits their needs. As far as that program is concerned, life is simple. They can use whatever memory they want, at any particular address, and they don't have to make any effort to avoid memory used by other programs.

Moreover, for security, they can't see the memory used by other programs even if they want to. Their memory address space is entirely their own to play with as they wish.

So, in the simple case, where each data object belongs to exactly one program, then each data object does have exactly one address.

However, programs may refer to common resources. For example two spell-checkers might need to use a big file full of spellings on disk. Rather than load that into memory twice, an operating system will typically load it once - but it may be seen at different virtual addresses by the two programs that use it. So, in this case, one data object may indeed have several virtual addresses.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top