1748156 Members
4255 Online
108758 Solutions
New Discussion юеВ

Re: Swapper, init

 
SOLVED
Go to solution
Ismail Azad
Esteemed Contributor

Swapper, init

Why does swapper start before init?
Read, read and read... Then read again until you read "between the lines".....
9 REPLIES 9
James R. Ferguson
Acclaimed Contributor

Re: Swapper, init

Hi:

You want to be able to do virtual memory management before you start spawning processes.

Regards!

...JRF...
SoorajCleris
Honored Contributor

Re: Swapper, init

Hi,

I dont know if this correct ,

but the logic , to allocate/reserv swap for new process ==> init and onwards.
May be a foolish answer :)


Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Patrick Wallek
Honored Contributor

Re: Swapper, init

Ismail Azad
Esteemed Contributor

Re: Swapper, init

Hi,

But why swapper before vhand?? The virtual memory subsystem relies primarily on both these daemons and when you talk about paging activity, isn't vhand always the dameon that is involved in paging activity before swapper because swapper is used for the state of excessive pis and pos?? And on the link Patrick has given me it says swapper is not a real processs??????

Regards
Read, read and read... Then read again until you read "between the lines".....
Ismail Azad
Esteemed Contributor

Re: Swapper, init


Why is swapper not a real process?? And coming back to my previous question, why swapper before vhand??
Read, read and read... Then read again until you read "between the lines".....
Kapil Jha
Honored Contributor
Solution

Re: Swapper, init

OK
what swapper do?
--swapper deactivates processes when memory falls to threshold called "minfree", and then reactivate when memory is available.

what vhand do?
in case of memory usage vhand would copy least recently used pages to swap (page out).
so vhand would be needed only when there is already a high memory usage.

Now in this case system is booting up,
swapper is needed to manage virtual memory at boot time, and in process of booting if memory usage goes above threshold vhand would come in picture.

BR,
Kapil+

I am in this small bowl, I wane see the real world......
Ismail Azad
Esteemed Contributor

Re: Swapper, init

Hi King,

So in the sense that when the system thrashes or the CPU does enormous excessive page ins and page outs, swapper deactivates certain processes allowing vhand to come into the picture because it follows the least referenced algorithm. So minfree is the threshold of free pages and not used space !!! Thanks a lot but... vhand uses the least referenced process and on what basis does swapper deactivate a process??.. should start another thread for that.

Regards
Read, read and read... Then read again until you read "between the lines".....
SoorajCleris
Honored Contributor

Re: Swapper, init

Hi Ismail,

If vhand manages to free up enough pages in order to get freemem above gpgslim, it can relax a little, stop stealing pages, and just age them. If, however, it can't free up enough pages, gpgslim will rise and vhand will become more aggressive in trying to steal pages (the two hands move round the clock quicker and scan more pages faster). Eventually, if vhand is unsuccessful at keeping freemem above gpgslim, we could get to a point where freemem is less that desfree. At this time, the kernel will start to deactivate processes that haven't run in the last 20 seconds. This is the job of the swapper process. Process deactivation is where the process is taken off the run queue and all its pages are put in front of the steal-hand (the age-hand is on its way, so the pages will soon be destined for the swap device). If this fails and freemem falls below minfree, swapper realizes that things are getting desperate and chooses any active process to be deactivated in an attempt to steal enough pages as quickly as possible. At this stage, the system is thrashing, i.e., paging-in/out more than it is doing useful work.

Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Ismail Azad
Esteemed Contributor

Re: Swapper, init

Hi wizard,


So an interactive application or a whole process could be kicked out and it doesn't matter what load goes on to the system. So the swapper for a time being is not as "intelligent" as vhand because knows when to stop and doesn't overload the IO queing subsystem. On classic operating systems swapper used to find a "sleeping" process. It still happens in v3 i guess cez that was the "classic swapper". So swapper does still kick out a whole process if required. Any thoughts??

freemem < desfree
freemem < minfree
Useful answer, thanks sooraj but any other thoughts?? And what was the 20 seconds you were talking about?? Is it a convention??

Regards
Read, read and read... Then read again until you read "between the lines".....