# Swapping and paging



## ViktorNiceFB (Mar 31, 2021)

Hey everyone, i am a student from Russia and i need to know about swapping and paging troubles. I read absolute FreeBSD 3 edition by Michael W(Warren) Lucas but its not enough for our work. Can someone explain some advantages and disadvantages of swapping and paging? 
https://twitter.com/mwlauthor


----------



## zirias@ (Mar 31, 2021)

This sounds a lot like a homework question, and I don't see any link to FreeBSD specifically. Don't you have a text book about these things? Do you know what a "page" is and how a MMU implements virtual memory? If not, this should be the first thing to understand.


----------



## ViktorNiceFB (Mar 31, 2021)

Zirias said:


> This sounds a lot like a homework question, and I don't see any link to FreeBSD specifically. Don't you have a text book about these things? Do you know what a "page" is and how a MMU implements virtual memory? If not, this should be the first thing to understand.


We dont have any text book or specific materials.I found a little piece of information in this book. https://learning.oreilly.com/library/view/absolute-freebsd-3rd/9781492069430/xhtml/ch21.xhtml. I know what is "page" and something about file systems. But i still need more information abut swapping and paging


----------



## Deleted member 30996 (Mar 31, 2021)

This is what mine looks like right now. I don't consider that unusual or a worry.





Intel Quad Core i7-2760QM @ 2.40GHz
8GB RAM PC3 10600
Hitachi Travelstar 7K750 500GB HDD @ 7200RPM


----------



## PMc (Apr 1, 2021)

Yours is off-topic. This is on-topic:


```
last pid: 59350;  load averages:  0.76,  0.44,  0.33    up 4+07:59:43  08:32:21
338 processes: 1 running, 337 sleeping
CPU:  7.9% user,  0.0% nice,  2.3% system,  0.1% interrupt, 89.7% idle
Mem: 650M Active, 751M Inact, 244M Laundry, 2101M Wired, 372M Buf, 96M Free
ARC: 941M Total, 375M MFU, 375M MRU, 14M Anon, 114M Header, 64M Other
     553M Compressed, 1091M Uncompressed, 1.97:1 Ratio
Swap: 10G Total, 4363M Used, 5876M Free, 42% Inuse, 28K In

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
 4936 root          4  20    0   103M    21M select   1  82:31  31.29% bareos-f
 7165 bareos        3  20    0    49M  9044K select   2   8:56   2.06% bareos-s
 3338 root          7  20    0   952M    61M nanslp   0  31:38   0.83% suricata
 4226 root          7 -32  r20   918M    82M nanslp   0 276:26   0.83% suricata
59323 admin         1  20    0    14M  4748K CPU1     1   0:00   0.25% top
44842   5111        3  20    0    89M  5948K select   3   0:08   0.04% ruby27
44819   5100        3  20    0    89M  5936K select   0   0:08   0.03% ruby27
 6942   5100        3  20    0    89M    10M select   2   1:09   0.02% ruby27
44773   5100        3  20    0    89M  5924K select   0   0:08   0.02% ruby27
 7023   5101        3  20    0    89M  8364K select   2   1:19   0.02% ruby27
```


----------



## richardtoohey2 (Apr 1, 2021)

For a more in-depth book: https://www.amazon.com/Design-Imple...ef=mt_other?_encoding=UTF8&me=&qid=1617260100


----------



## matt_k (Apr 1, 2021)

ViktorNiceFB said:


> Hey everyone, i am a student from Russia and i need to know about swapping and paging troubles. I read absolute FreeBSD 3 edition by Michael W(Warren) Lucas but its not enough for our work. Can someone explain some advantages and disadvantages of swapping and paging?
> https://twitter.com/mwlauthor


Well, if you want to understand it a bit more in depth, I suggest you take a look at Design and Implementation of the FreeBSD Operating System by Kirk McKusick, George Neville Neill and Robert Watson. The book is not only about memory, but there is a chapter dedicated to memory management, which explains FreeBSD memory management in detail (coincidentally, this is the chapter I am currently reading).

Lucas's books are more about "how to use the system" than about "how the system works internally".

You can also start by watching for example "Introduction to memory management by Alan Ott" on youtube (I know that it's about linux memory management, but don't throw stones at me please, the core principles are the same). There are many more videos on youtube, Alan speaks a bit faster, so it may be a little bit more difficult to follow at times, but at the same time his presentantion is very well organized and covers almost all the basics in one hour, which is nice. Out of all the memory management presentations on youtube I've seen, this one is the best imho.

Explaining advantages and disadvantages of swapping and paging -- I don't know what you mean here, if anything, this question shows that you need to study a bit more  Luckily, we live in an age where all the info is easily accessible, you just have to put your own time in.


----------



## ViktorNiceFB (Apr 1, 2021)

matt_k said:


> Well, if you want to understand it a bit more in depth, I suggest you take a look at Design and Implementation of the FreeBSD Operating System by Kirk McKusick, George Neville Neill and Robert Watson. The book is not only about memory, but there is a chapter dedicated to memory management, which explains FreeBSD memory management in detail (coincidentally, this is the chapter I am currently reading).
> 
> Lucas's books are more about "how to use the system" than about "how the system works internally".
> 
> ...


Thankyou a lot


----------



## ViktorNiceFB (Apr 1, 2021)

richardtoohey2 said:


> For a more in-depth book: https://www.amazon.com/Design-Imple...ef=mt_other?_encoding=UTF8&me=&qid=1617260100


Thank you !


----------



## Deleted member 30996 (Apr 3, 2021)

PMc said:


> Yours is off-topic. This is on-topic:


How is mine off-topic when it shows `top` and the amount of swap in use? 
According to the Handbook  "A page is typically placed in a wired or active state initially". That shows memory in use including Active and Wired as well.


----------

