07. More on memory

Previous topic chore: real physical page address in Linux:

On virtual memory

A bit of OS:

Code (and data) with isolated address space, controlled by scheduler

A process has:

Command to show your processes:

Special virtual file system /proc shows a lit of info about OS and processes (also /sys is about system architecture).

So back to virtual memory. Let's run a program that does nothing, but sleeps on timer:

   1 #include <stdio.h>
   2 #include <unistd.h>
   4 int main(int argc, char *argv[]) {
   5   while(!sleep(10));
   7   return 0;
   8 }

and compile it statically with gcc -static donothing.c -o donothing.

Run a pair of such program in background:

Find both of them running (actually sleeping) by ps -ef (or ps -el to see in which state programs are now; predictably the only running program is ps :) )

<!> metadata is 64-bit length long long int, if it safe to read it as 8 sequential bytes?

So compare ./pg /proc/<PID>/pagemap 0x0048c000 for both donothing

File I/O

TODO — or overall C syntax (https://en.cppreference.com/w/c)?

HSE/ProgrammingOS/07_MoreOnMemory (last edited 2020-02-18 10:14:13 by FrBrGeorge)