l4-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another question about self-paging


From: ness
Subject: Another question about self-paging
Date: Sun, 30 Oct 2005 19:08:44 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050813)

[1] is about application controlled file caching. It is pretty clear that one program alone mustn't decide whether a cache may be freed, as this would eventually reduce other program's cache hit rate. They mostly solved this problem, but this is not interesting here. They pointed out that there are a lot of similarities between application controlled file caching and application controlled virtual memory management. Self-paging is, in fact, a form of application controlled virtual memory management. After this came to my mind I began to ask myself why applications can't completely control file caching, but self-paging gives a process complete control over the page eviction policy. I concluded that sth. with (my understanding of) self-paging is wrong. To make this more clear I thought about an example:

Imagine dynamic linking of libraries. To save space the text segment of the library exists only once in memory and is mapped read-only into the application's AS (while checking this now I remember that the complete exists only once in memory). So if on memory pressure an application has to select a page to evict and selects a page of the ro-mapped text-segment, two things happen:

1. To really make the eviction useful the page has to be unmapped from
   every application that has mapped it (and paged out). This breaks the
   self-paging idea, IMHO, as the applications didn't even have a chance
   to influence this.

2. The next application accessing the lib will significantly slow down
   (fetch page from swap, map it into the app's AS) and all other apps
   will slow down a bit (remap page into AS).

So a malicious program could link against every library it find's in the system, cause memory pressure and then map out all those libs, _significantly_ slowing the system down. And sth. curios happens if the system doesn't run into memory pressure but the (evtually malicious) program only exceeds some given limit: the system slows down, too, but this isn't even necessary!

This could be solved in a way like described in [1], but maybye there's only sth. wrong with my understanding of self-paging.

[1] Implementation and Performance of Application-Controlled File Cachin
--
-ness-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]