This preview shows page 1. Sign up to view the full content.
Unformatted text preview: from perplexing and insidious memoryrelated bugs. For example, a program with a bad pointer can crash immediately with a “Segmentation fault” or a “Protection fault”, run silently for hours before crashing, or scariest of all, run to completion with incorrect results. Understanding virtual memory, and the allocation packages such as malloc that manage it, can help you avoid these errors. This chapter looks at virtual memory from two angles. The ﬁrst half of the chapter describes how virtual memory works. The second half describes how virtual memory is used and managed by applications. There is no avoiding the fact that VM is complicated, and the discussion reﬂects this in places. The good news is that if you work through the details, you will be able to simulate the virtual memory mechanism of small system by hand, and the virtual memory idea will be forever demystiﬁed. The second half builds on this understanding, showing you how to use and manage virtual memory in your programs...
View Full Document
- Spring '10
- The American