Based on Chapter 6 of [Hai19]
(Usage hints for this presentation)
Computer Structures and Operating Systems 2022
Dr. Jens Lechtenbörger (License Information)
address
selects a byte (not a word as in Hack)
address
“Figure 6.4 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
BoundedBuffer
located at RAM address 42
The page table
Figure © 2016 Julia Evans, all rights reserved; from julia's drawings. Displayed here with personal permission.
smem
demo later on
Copy on write
Figure © 2016 Julia Evans, all rights reserved; from julia's drawings. Displayed here with personal permission.
“Figure 6.9 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
When process opens file, file can be mapped into virtual address space
page 3
in big pictureaddress
can be interpreted in two ways
address
as binary number, as in Hack)address
address
= byte number within its page
Sample allocation of frames to some process
“Figure 6.10 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
Consider previously shown RAM allocation (Fig. 6.10)
“Figure 6.10 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
Page table for that situation (Fig. 6.11)
Valid | Frame# |
---|---|
1 | 1 |
1 | 0 |
0 | X |
0 | X |
0 | X |
0 | X |
1 | 3 |
0 | X |
Answer the following questions in Learnweb.
Suppose that 32-bit virtual addresses with 4 KiB pages are used.
“IA-32 two-level page table” by Jens Lechtenbörger under CC BY-SA 4.0; Frame numbers and valid bits added to and third layer removed from Figure 6.13 of [Hai17] by Max Hailperin under CC BY-SA 3.0. Source at GitLab.
Note: Page table contains entries of an ordinary page table. Previously, valid bit and page frame numbers were shown in columns; here, they are shown in rows.
“Figure 6.14 of [Hai17]” by Max Hailperin under CC BY-SA 3.0; converted from GitHub
/proc/<pid>/
/proc
is a pseudo-filesystem
<pid>
is meant as placeholder for such a number/proc
/proc
/proc
Figure © 2018 Julia Evans, all rights reserved; from julia's drawings. Displayed here with personal permission.
man
pages
Man pages are amazing
Figure © 2016 Julia Evans, all rights reserved; from julia's drawings. Displayed here with personal permission.
/proc/<pid>
/proc/<pid>/pagemap
: One 64-bit value per virtual page
/proc/<pid>/maps
: Mapped memory regions/proc/<pid>/smaps
: Memory usage for mapped regionssmem
smaps
files: smem
smem
Output$ smem -c "pid command uss pss rss vss" -P "bash|xinit|emacs" PID Command USS PSS RSS VSS 765 /usr/bin/xinit /etc/X11/Xse 220 285 2084 15952 1390 /bin/bash -c libreoffice5.3 240 510 2936 13188 826 /bin/bash /usr/bin/qubes-se 256 524 3008 13204 750 -su -c /usr/bin/xinit /etc/ 316 587 3368 21636 1251 bash 4864 5136 7900 26024 2288 /usr/bin/python /usr/bin/sm 5272 6035 9432 24688 1145 emacs 90876 93224 106568 662768
smem
Graph
This document is part of an Open Educational Resource (OER) course on Operating Systems. Source code and source files are available on GitLab under free licenses.
Except where otherwise noted, the work “OS08: Virtual Memory I”, © 2017-2022 Jens Lechtenbörger, is published under the Creative Commons license CC BY-SA 4.0.
In particular, trademark rights are not licensed under this license. Thus, rights concerning third party logos (e.g., on the title slide) and other (trade-) marks (e.g., “Creative Commons” itself) remain with their respective holders.