issue49:labolinux
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue49:labolinux [2011/06/05 20:37] – créée fredphil91 | issue49:labolinux [2011/06/21 23:52] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | Last time, we established a kind of sliding scale to determine whether or not a Swap partition is a) essential, b) useful, c) wasteful, or d) obsolete. Don't worry, this isn't an exam. However, it may be worth looking into the topic of Virtual Memory Management, to call it by its proper name, a little further. Ancient Linux hackers among you will have to excuse the Dr. Seuss-level distillation which follows (or else go write your own 300-page book on the subject). | + | **Last time, we established a kind of sliding scale to determine whether or not a Swap partition is a) essential, b) useful, c) wasteful, or d) obsolete. Don't worry, this isn't an exam. However, it may be worth looking into the topic of Virtual Memory Management, to call it by its proper name, a little further. Ancient Linux hackers among you will have to excuse the Dr. Seuss-level distillation which follows (or else go write your own 300-page book on the subject). |
Page by Page | Page by Page | ||
Ligne 11: | Ligne 11: | ||
• File-backed pages are those containing volatile values which haven' | • File-backed pages are those containing volatile values which haven' | ||
- | • Anonymous mappings are volatile pages which don't correspond to any file name; these contain the stack and heap variables of running tasks, created by a program requesting a memory allocation from the kernel. | + | • Anonymous mappings are volatile pages which don't correspond to any file name; these contain the stack and heap variables of running tasks, created by a program requesting a memory allocation from the kernel.** |
- | The cached pages can be divided into ' | + | La dernière fois, nous avons créé une sorte d' |
+ | //) qui suit (ou, alors, écrire votre propre livre de 300 pages sur le sujet). | ||
+ | |||
+ | Page par page | ||
+ | |||
+ | La mémoire, telle qu' | ||
+ | |||
+ | * Les pages du noyau sont fixées dans la mémoire et ne sont jamais déplacées. Certains systèmes d' | ||
+ | |||
+ | * Les pages mémoire de programmes ou d' | ||
+ | |||
+ | * Les pages de fichiers sauvegardés contiennent des valeurs volatiles qui n'ont pas encore été écrites sur le disque. Celles-ci peuvent contenir des modifications dans la mémoire qui n'ont pas encore été écrites. | ||
+ | |||
+ | * Les pages de topographie mémoire anonymes sont des pages instables qui ne correspondent à aucun nom de fichier ; celles-ci contiennent les variables de pile et de tas (stack et heap) des tâches en cours d' | ||
+ | |||
+ | **The cached pages can be divided into ' | ||
• Clean means the data in memory is the same as on disk, or, the values are unchanged since they were instantiated. Clean pages can be discarded whenever the memory is required for something else as they match the original data available on disk. | • Clean means the data in memory is the same as on disk, or, the values are unchanged since they were instantiated. Clean pages can be discarded whenever the memory is required for something else as they match the original data available on disk. | ||
- | • Dirty pages contain changed data since the last read or instantiation. These have to be ' | + | • Dirty pages contain changed data since the last read or instantiation. These have to be ' |
- | It's important to remember that Linux has no separate disk cache, unlike Unix- or DOS-based systems. It's designed to read-in and keep the most useful data from disk as cached pages. Also, the kernel doesn't usually modify the disk directly: changes are made to the files in memory, then ' | + | Les pages de cache peuvent être classées en « propres » et en « sales » ; le gestionnaire de mémoire du noyau doit s'en occuper en tâche de fond. |
- | At times of peak workload, this is the operation which slows everything down, as the kernel runs out of empty and clean pages in the pool; it has to write dirty pages to disk before it can continue on with its prioritized tasks. File-backed | + | • Propre signifie que les données en mémoire sont les mêmes que sur le disque ou que les valeurs n'ont pas été modifiées depuis qu' |
- | If you don't have swap space, then anonymous mappings can't be flushed, they have to stay in memory until they' | + | • Les pages sales contiennent des données modifiées depuis la dernière lecture ou instanciation. Il faut qu'elles soient « évincées » - les valeurs modifiées doivent être écrites sur le disque |
- | Partition | + | **It's important to remember that Linux has no separate disk cache, unlike Unix- or DOS-based systems. It's designed to read-in and keep the most useful data from disk as cached pages. Also, the kernel doesn' |
- | The original criticism | + | At times of peak workload, this is the operation which slows everything down, as the kernel runs out of empty and clean pages in the pool; it has to write dirty pages to disk before it can continue on with its prioritized tasks. File-backed pages are flushed by writing-back to their parent file on disk. Anonymous mappings, however, have no backing-file, these are stacks and arrays of works-in-progress. Where do they go? Into Swap! ** |
- | Kernel Panic | + | Il est important de se souvenir que, contrairement aux systèmes basés sur Unix ou sur DOS, Linux n'a pas de cache disque distinct. Sa conception veut qu'il lise les données les plus utiles du disque, puis qu'il les garde comme des pages en cache. En général, le noyau ne modifie pas directement le disque : les fichiers en mémoire sont modifiés, puis la mémoire est remise à zéro après qu'ils soit écrits sur le disque par le gestionnaire de mémoire. C'est une question de sécurité des données. |
+ | |||
+ | Aux heures de pointe, c'est l' | ||
+ | |||
+ | **If you don't have swap space, then anonymous mappings can't be flushed, they have to stay in memory until they' | ||
+ | |||
+ | Si vous n'avez pas de place de swap, les topographies anonymes ne peuvent pas être remises à zéro et elles devront rester dans la mémoire jusqu' | ||
+ | |||
+ | **Partition or File? | ||
+ | |||
+ | The original criticism is that a whole swap partition is a waste, especially if you have only a small hard disk or solid state drive. You can use swap files, as do some other operating systems we won't mention, but remember swap files have to obey the rules alongside everything else on your journaling file system. A swap partition is ring-fenced for paging; no other files can reside there.** | ||
+ | |||
+ | Partition ou fichier ? | ||
+ | |||
+ | La critique de départ est qu'une partition swap entière est du gâchis, surtout si vous n'avez qu'un petit disque dur ou un solid-state drive (SSD). Vous pouvez vous servir de fichiers swap, comme quelques autres systèmes d' | ||
+ | |||
+ | **Kernel Panic | ||
This is a recognized medical condition of mental anxiety, brought on in Linux users when they run the free or vmstat commands and discover how little free memory is reported. You can relax, this is quite normal. | This is a recognized medical condition of mental anxiety, brought on in Linux users when they run the free or vmstat commands and discover how little free memory is reported. You can relax, this is quite normal. | ||
- | The kernel memory manager tries to keep the available RAM filled with cached pages in expectation that the files will be used again and it won't have to go to disk to fetch them. This is intentional. Whole books have been written on the predictive algorithms used to predict what to cache, what to flush, when, and how much memory is sensible to leave in the empty pool. You can watch your free memory go up and down, if you have nothing better to do. Right after boot-time, there' | + | The kernel memory manager tries to keep the available RAM filled with cached pages in expectation that the files will be used again and it won't have to go to disk to fetch them. This is intentional. Whole books have been written on the predictive algorithms used to predict what to cache, what to flush, when, and how much memory is sensible to leave in the empty pool. You can watch your free memory go up and down, if you have nothing better to do. Right after boot-time, there' |
- | Swap On | + | La panique du noyau |
+ | |||
+ | C'est une condition médicale reconnue d' | ||
+ | |||
+ | Le gestionnaire de mémoire du noyau essaie de remplir la RAM disponible avec des pages en cache car il s' | ||
+ | |||
+ | **Swap On | ||
To check the state of your swap partition, use: | To check the state of your swap partition, use: | ||
Ligne 45: | Ligne 82: | ||
The Linux 2.6 kernel has a parameter called swappiness which you can use to tune the way Linux uses Swap. It is a number from 0 to 100: 0 means minimal swapping, keeping more pages resident in memory, even if they are idle. Going up the scale to 100 increases the rate of swapping in an attempt to maximize the amount of free memory available in the pool. | The Linux 2.6 kernel has a parameter called swappiness which you can use to tune the way Linux uses Swap. It is a number from 0 to 100: 0 means minimal swapping, keeping more pages resident in memory, even if they are idle. Going up the scale to 100 increases the rate of swapping in an attempt to maximize the amount of free memory available in the pool. | ||
The default value for swappiness is 60. You can alter it using root permissions and a parameter command such as : | The default value for swappiness is 60. You can alter it using root permissions and a parameter command such as : | ||
+ | |||
+ | echo 50 > / | ||
+ | |||
+ | Swap on | ||
+ | |||
+ | Pour vérifier l' | ||
+ | |||
+ | swapon -s | ||
+ | |||
+ | qui m'a retourné le résultat ci-dessous. | ||
+ | |||
+ | Le noyau 2.6 de Linux a un paramètre qui s' | ||
echo 50 > / | echo 50 > / | ||
- | Any value set this way lasts until the next re-boot. To change it permanently, | + | **Any value set this way lasts until the next re-boot. To change it permanently, |
In adjusting swappiness, you are making a judgment call; it prejudices the kernel memory manager for-or-against swapping out to disk. Set swappiness too high, you risk your disk-writes going through the roof; meanwhile every concurrent process has to wait even longer in line for its data to be read back in from disk before it gets a slice of processing time. | In adjusting swappiness, you are making a judgment call; it prejudices the kernel memory manager for-or-against swapping out to disk. Set swappiness too high, you risk your disk-writes going through the roof; meanwhile every concurrent process has to wait even longer in line for its data to be read back in from disk before it gets a slice of processing time. | ||
- | Which brings us neatly back to the need for Swap. It's only there to support our marvelous multi-tasking, | + | Which brings us neatly back to the need for Swap. It's only there to support our marvelous multi-tasking, |
+ | |||
+ | Toute valeur réglée de cette manière dure jusqu' | ||
+ | |||
+ | En ajustant la swapitude, vous portez un jugement ; vous allez ainsi influencer le gestionnaire de mémoire du noyau pour ou contre l' | ||
+ | |||
+ | Ce qui nous ramène habilement à la question de la nécessité d'une partition swap. Elle n'est là que pour soutenir le système d' |
issue49/labolinux.1307299028.txt.gz · Dernière modification : 2011/06/05 20:37 de fredphil91