Contents
Chapter 3 · SoftwarePractice

LEARN WITH HARU

Video Lesson တွေက Haru အတန်းသားတွေအတွက်ပါ

Haru ရဲ့ ITPEC FE Full Course မှာ ယခု သင်ခန်းစာတွေကို တစ်ခုချင်း တစ်ကြောင်းချင်း အသေးစိတ်ရှင််ရှင်းပြထားပါတယ်

အခြေခံ မရှိတဲ့ ကျောင်းသားများစွာဟာလည်း ဒီ Course နဲ့ ပဲ အောင်မြင်ကုန်ကြပါပြီ

အတန်းမအပ်သေးပဲ Haru ဆီမှာ အစမ်းသင်ကြည့်ချင်ပါသလား?

သင်တန်းသားတွေရဲ့ စကားသံများ

သင်တန်းသားတွေရဲ့ စကားသံများ

Highlighted text? Practice this concept. Highlighted passages and figures open related questions.

Practice related questions (5)Progress & bookmarks

Current section

2-2-3 Memory Management

p. 203

Practice this section 5 linked exam questions with default filters

Progress

Not marked complete

Related questions in this lesson 8

Fragmented free memory1Fixed-size paging and segments2FIFO and LRU page replacement3Page faults and page-in2
Progress and bookmarks

p. 203

2-2-3 Memory Management

Memory management is a management function for the effective use of a computer’s memory areas. Memory management is classified as either real memory management or virtual memory management.

(1) Real memory management

Real memory management is a management function for the effective use of main memory areas. A program to be executed must be recorded in main memory but there is a limit to the storage capacity of memory. Therefore, this method uses an auxiliary storage device.

(1) Partitioning method This is a method that divides main memory into partitions for management. It is classified as either fixed partitioning method or variable partitioning method.

A: Fixed partitioning method This is a method that divides the usable area of main memory into several partitions of a fixed size. This method reads (roll-in) a program or data from an auxiliary storage device when it is necessary, and writes (roll-out) the program or data back to the auxiliary storage device when it is no longer necessary.

Original textbook callout or table. Source text: • Single fixed partitioning method This is a method that uses the usable memory area of main memory as a single fixed partition. Although the control is simple, main memory is used by only one program, and therefore, the unused area is large. • Multiple fixed partitioning method This is a method that uses the usable memory area of main memory as multiple fixed partitions. A program can be stored in each partition, but if a program is larger than the capacity of a partition, it cannot be stored.
p. 203 · Enlarge

p. 204

Fixed partitions accept programs A and B; program C is too large. Unused areas remain within the fixed partitions. Source text: Figure 3-3 Fixed partitioning method (multiple partitioning method)
p. 204 · Enlarge

B: Variable partitioning method This is a method that partitions the usable memory area of main memory according to the capacity required by a program.

Variable partitioning allocates memory areas according to the sizes of programs A, B and C; the remaining area is unused. Source text: Figure 3-4 Variable partitioning method
p. 204 · Enlarge

When the variable partitioning method is applied, many small areas of garbage (i.e., unused areas) are generated because a partition remains unchanged after the execution of a program is completed. This is called fragmentation. In this case, garbage collection (or memory compaction) is executed to combine these unused areas into one large area. · 1 question

Three memory layouts: initially programs A, B, C and D; then fragmented memory containing E, F, G and D with gaps; garbage collection compacts E, F, G and D and gathers the free space below them. Source text: Figure 3-5 Fragmentation and garbage collection
p. 204 · Enlarge

Garbage collection can also be expected to have an effect whereby the potential for memory leak to occur is reduced. A memory leak is caused by a bug or such other problem in a program (e.g., an OS or an application) that uses memory (i.e., main memory), and areas that

p. 205

were secured are not released during operation. If a memory leak occurs, usable memory areas in main memory decrease, and serious problems may be caused.

Original textbook callout or table. Source text: [Memory pool] In this method, a program (e.g., an OS or an application) collectively secures memory areas in advance, and then allocates the secured memory areas as needed. Memory pool management also uses a fixed length method that allocates memory blocks of the same size and a variable length method that allocates memory blocks of the required size.
p. 205 · Enlarge

(2) Overlay method (Segment method) This is a method that is used in order to execute a program that is larger than the usable area of main memory. It divides the program into multiple segments that are not executed concurrently and transfers segments to and from an auxiliary storage device upon execution.

Program structure A above alternative segments B, C and D. Successive main-memory views retain A while loading B, C or D. Source text: Figure 3-6 Overlay method
p. 205 · Enlarge

(3) Swapping In multiprogramming and such other environment, swapping refers to interrupting execution of the current program and transferring it to an auxiliary storage device in order to execute programs or such other processes of a higher priority. As soon as main memory has available space (or when execution is restarted), the program that was transferred to the auxiliary storage device is retrieved and processing is restarted from where it was interrupted. The activity to transfer from main memory to auxiliary storage is called swap-out, and the retrieval activity is called swap-in. If swapping occurs frequently, much time (i.e., overhead) that is not related to a program is required, and processing efficiency is drastically decreased.

(2) Virtual memory management

Virtual memory management is a virtual memory system that implements a concept called “virtual memory” by establishing a logical memory space (a virtual memory space or a logical

p. 206

address space) that is larger than main memory and executing programs that are stored in it. (In reality, only programs in main memory can be executed, so the section to be executed is loaded (i.e., transferred) from auxiliary storage to main memory).

Executing program A uses logical address 3000 in virtual memory on auxiliary storage. A load arrow points to program A at physical address 1000 in main memory. Source text: Figure 3-7 Image of virtual memory system
p. 206 · Enlarge

Virtual memory management is classified as shown below according to the difference in the management method of memory areas.

Original textbook callout or table. Source text: • Paging This is a method that manages the memory areas of main memory and auxiliary storage by dividing them into units (i.e., pages) of a set size. Since transactions between main memory and auxiliary storage are performed in units of a fixed length, waste is less likely to occur in their memory areas. The loading of a page from auxiliary storage to main memory is called page-in, and the reverse of this is called page-out. • Segment This is a method that divides a program into meaningful units (i.e., segments), and performs transactions between main memory and auxiliary storage in units of segments. • Paged segment This is a method that handles pages (i.e., memory that has been divided into units of a set size) by compiling them into segments that have a logical relation. There are also another approach that handles multiple pages as a segment even if there is no logical relation.
p. 206 · Enlarge
Fixed-size paging and segments · 2 practice questions

In a virtual memory system, it is necessary to convert between the virtual memory address (logical address) and the main memory address (physical address). This conversion is called address conversion and is performed by hardware called a DAT (Dynamic Address Translator).

p. 207

In the segment method, address conversion is performed using the base address method, which references a segment address table in which the starting points (i.e., physical addresses) of segments are recorded. On the other hand, in the paging method, addresses conversion is performed by a DAT referencing a page address table in which the physical address of each page is stored.

Page number 0005 and displacement 0080 enter address conversion. The page table maps 0002 to 1120, 0005 to 6000 and 0010 to 2380. The selected start address 6000 plus displacement 0080 gives reference address 6080 in page 0005 of main memory. Source text: Figure 3-8 Address conversion in paging
p. 207 · Enlarge

In this case, when a page that is not recorded in the page address table (or not recorded in main memory) is referenced, an interrupt called a page fault occurs from the DAT. When a page fault occurs, the page for reference is loaded into main memory, and the page address table is updated. If main memory has no free space at this time, a page (i.e., page for replacement) from main memory is selected, a page-out is performed, and then a page-in is performed in order to put the referenced page into the free space. If page faults frequently occur, page-in and page-out increase, and a state called thrashing occurs in which processing efficiency decreases. Therefore, in order to minimize the occurrence of page faults, it is necessary to perform a page-out for pages that have a low probability of referral after this point. The method that is used to select such pages is called a page replacement algorithm, and there are three typical ones. · 2 questions

Original textbook callout or table. Source text: • FIFO (First-In First-Out) This performs a page-out for the page that has been in main memory the longest. • LRU (Least Recently Used) This performs a page-out for the page for which the longest time has passed since the last reference. • LFU (Least Frequently Used) This performs a page-out for the page that has been referenced the least.
p. 207 · Enlarge
FIFO and LRU page replacement · 3 practice questions

p. 208

Original FIFO and LRU worked page-replacement example with capacity three and reference sequence 1,2,3,2,1,4,1,2. Parentheses mark the referenced page; grey marks page-in. After reference 4 FIFO contains 4,2,3 while LRU contains 1,2,4. Final FIFO is 4,1,2 and LRU is 1,2,4. Source text: Example: If the page capacity of main memory is three pages and the pages are referenced in order of {1, 2, 3, 2, 1, 4, 1, 2}, how is “page-in” performed with FIFO or LRU? Referenced page FIFO LRU 1 (1) (1) 2 1 (2) 1 (2) 3 1 2 (3) 1 2 (3) 2 1 (2) 3 1 (2) 3 1 (1) 2 3 (1) 2 3 4 (4) 2 3 1 2 (4) 1 4 (1) 3 (1) 2 4 2 1 (2) 1 (2) 4 4 ( ) : Referenced page, : Page-in
p. 208 · Enlarge

The apparent memory capacity of main memory can be increased with the virtual memory system. However, if the capacity of main memory is too small, thrashing occurs and processing efficiency decreases. This means that for running applications that will not run because of insufficient memory, increasing the size of virtual memory is only a temporary solution. In such cases, it is necessary to consider increasing the usable memory areas by adding memory or stopping the use of unnecessary applications.

Original chapter exercises

Original chapter exercises →

New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015