07. More on memory

Previous topic chore: real physical page address in Linux:

On virtual memory

A bit of OS:

Process
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>
   3 
   4 int main(int argc, char *argv[]) {
   5   while(!sleep(10));
   6 
   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

H/W

HSE/ProgrammingOS/07_MoreOnMemory (последним исправлял пользователь FrBrGeorge 2020-03-01 11:34:07)