ArLinux.110mb.com

استعادة صفحات الذاكرة التي نقلت الى الذاكرة البديلة

موليادي سنتوسا [mulyadi.santosa at gmail.com] (Mulyadi Santosa)

16 ديسمبر 2006

بعدما تشغل تطبيقا يستهلك كثيرا من الذاكرة مثل تحرير صورة بيتماب كبيرة الحجم ربما يتم نقل أجزاء من الذاكرة الى الذاكرة البديلة. هذا أمر عادي خاصة ان لم تكن الذاكرة كبيرة -- أي 256 ميغا أو أقل. والمشكلة ان بعدما تفرغ من استعمال هذا التطبيق سوف يكون ما تعمله بطيئا بشكل مرهب لان تلك الأجزاء لا بد من إرجاعها الى الذاكرة.

إحدى السبل الى ذلك أن تعمل ما يلي:

# swapoff -a

(انتظر بضع ثوان... [...] )

# swapon -a

سوف يعيد الأمر swapoff كل شيء الى الذاكرة ثم يعطل مساحات الذاكرة البديلة. لتفعيلها من جديد أصدر الأمر swapon . للتأكد من سلامة العملية تحقق أولا من ناتج الأمر free.

# free -m
                     total    used    free   shared   buffers   cached
Mem:           249     170      79        0         12            45
-/+ buffers/cache:     111     137
Swap:          376       0     376

[...]

مع التحيات،
موليادي سنتوسا، مهندس مجاز لـريدهات

ملاحظة المترجم: لم يتم بعد ترجمة المقالة بكاملها؛ الباقي آت ... وكل آت قريب.


المقالة بالانجليزية متوفرة في الاصدار رقم 134 من لينكس غازيت ، ويلي نصها:

Brings back swapped out pages

Mulyadi Santosa [mulyadi.santosa at gmail.com]
Sat, 16 Dec 2006 21:12:28 +0700

After you start a memory-hogger application such as manipulating a large bitmap graphic file, some portions of RAM are likely pushed away to swap. This is normal especially if you have not so big RAM (256MB or less). The problem is, after you finish with this application, whatever you do will be creepingly slow since those pages must be brought back to RAM.

One way you can try is to do these:

# swapoff -a
(wait for some seconds... continue after hard disk's LED stops blinking)
# swapon -a
Swapoff will push everything back to RAM and eventuall disables the swap spaces. Simply execute swapon to enable them again. If you want to play safe, check free output first:
# free -m
             total       used       free     shared    buffers     cached
Mem:           249        170         79          0         12         45
-/+ buffers/cache:        111        137
Swap:          376          0        376
There you can find out that the free RAM (free+buffers+cached) exceeds the size of used swap space (in this case, since nothing is there, it is zero). Knowing this, swapoff will sucessfully push things back to RAM

Another way you can try, is to use swap prefetch feature included in Con Kolivas patchset (-ck). You can find it in kernel.kolivas.org and it's also included in -mm (Andrew Morton) patchset.

I hope this tip is useful for all of LG readers.

regards,

Mulyadi Santosa, RHCE

الموقع

الصفحة الرئيسية
اتصل بي

مقالات

التشغيل التلقائي في كيدي
كتابة العربية في Vim
ما هو أوبنتو؟
الذاكرة المحدودة

لينكس غازيت

منع Vim من الحفظ إلى ملف مفتوح مصادفةً
التجهيز الآلي لقارئ الأقراص المرنة في أوبنتو 7.04
إقلاع اسلاكوير 12.0 عن طريق GRUB
استعادة صفحات الذاكرة التي نقلت الى الذاكرة البديلة