Professional Documents
Culture Documents
Memory Management-1
Memory Management-1
Non-Contiguous Allocation
• In non-contiguous memory allocation, different parts of a process is allocated different places in
Main Memory.
• Paging and Segmentation are the two ways which allow a process’s physical address space to be
non-contiguous. It has advantage of reducing memory wastage but it increases the overheads due to
address translation. It slows the execution of the memory because time is consumed in address
translation.
تخصيص غير متجاور
. يتم تخصيص أماكن مختلفة ألجزاء مختلفة من العملية في الذاكرة الرئيسية، • في تخصيص الذاكرة غير المتجاورة
تتميز بميزة تقليل الفاقد في الذاكرة ولكنها.• الترحيل والتجزئة هما طريقتان تسمحان لمساحة العنوان الفعلية للعملية بأن تكون غير متجاورة
. يؤدي إلى إبطاء تنفيذ الذاكرة ألنه يتم استهالك الوقت في ترجمة العنوان.تزيد من النفقات العامة بسبب ترجمة العنوان
Paging
Paging is a memory management scheme that eliminates the need for contiguous allocation of
physical memory. Every process is divided into various parts of equal size called Pages. We also
divide our main memory into different parts of equal size called Frames. It is important to understand
that: Size of page in process = Size of frame in memory
الترحيل
تنقسم كل عملية إلى أجزاء مختلفة متساوية الحجم تسمى.عبارة عن مخطط إلدارة الذاكرة يلغي الحاجة إلى التخصيص المتجاور للذاكرة الفعلية
. نقسم أيضًا ذاكرتنا الرئيسية إلى أجزاء مختلفة متساوية الحجم تسمى اإلطارات.الصفحات
حجم الصفحة قيد المعالجة = حجم اإلطار في الذاكرة:من المهم أن نفهم أن
Paging needs to maintain a Page Table for each process which contains the base address of the
each block which is acquired by the process in memory space. Paging is done to remove External
Fragmentation. Page table has page table entries where each page table entry stores a frame
number and optional status (like protection) bits. Many of status bits used in the virtual memory
system. The most important thing in PTE is frame Number.
Frame Number – gives the frame number in which the current page is present. The number of bits
required depends on the number of frames. Number of bits for frame = Size of physical
memory/frame size
Present/Absent bit – a bit is also known as valid/invalid bit. It says whether a particular page is
present or absent.
يحتاج الترحيل إلى االحتفاظ بجدول صفحات لكل عملية تحتوي على العنوان األساسي لكل كتلة يتم الحصول عليها من خالل العملية في مساحة
يحتوي جدول الصفحة على إدخاالت لجدول الصفحات حيث يخزن كل إدخال في جدول. يتم إجراء الترحيل إلزالة التجزئة الخارجية.الذاكرة
PTE أهم شيء في. تستخدم العديد من وحدات بت الحالة في نظام الذاكرة الظاهرية.الصفحات رقم إطار وحالة اختيارية (مثل الحماية) بتات
.هو رقم اإلطار
عدد وحدات. يعتمد عدد البتات المطلوبة على عدد اإلطارات. يعطي رقم اإلطار الذي توجد به الصفحة الحالية- رقم اإلطارFrame Number
حجم اإلطار/ البت لإلطار = حجم الذاكرة الفعلية
تقول ما إذا كانت صفحة معينة موجودة أو. غير صالح/ يُعرف البت أيضًا باسم بت صالح- الغائبة/ البتة الحاليةPresent/Absent bit
.غائبة
• Address Translation Scheme
• Address generated by CPU is divided into:
• Page number (p) – used as an index into a page table which contains base address of each page in
physical memory.
• Page offset (d) – combined with base address to define the physical memory address that is sent to
the memory unit.
As we look for this frame number in the page table, we find that it corresponds to page number 1
. frame_offset = physical_address Mod frame_size
= 27 Mod 4 = 3 (page_offset)
Logical_address= (page_number * page_size) + page_offset
= (1 * 4) + 3 = 7
4. Logical address space = 64 byte = 2 6 byte Number of bits in logical address= Log2 2 6 =6 bits
5. Physical address space= 1024 byte= 2 10 Number of bits in physical address= Log2 2 10 = 10 bits
H.W.
For the system above:
1. What is the page number and the page offset for the logical address 11?
2. What is the physical address for he logical address 14?
3. What is the logical address corresponding to physical address 22?
H.W.
:للنظام أعاله
؟11 ما هو رقم الصفحة وإزاحة الصفحة للعنوان المنطقي.1
؟14 ما هو العنوان الفعلي للعنوان المنطقي.2
؟22 ما هو العنوان المنطقي المقابل للعنوان الفعلي.3