Handout TIF204 Chapter 7 Main Memory 2016
An Overview
Operating System:
The main purpose of a computer system is to execute programs.
These programs, together with the data they access, must be at
least partially in main memory during execution. Selection of a
memory-management scheme for a system depends on many
factors, especially on the hardware design of the system.
CPU scheduling, improve both the utilization of the CPU and the
speed of the computer’s response to its users. To increase in
performance, several processes must be kept in memory — so,
the memory must be shared.
Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating System
Concepts Essentials, 2012, 2th Edition, John Wiley & Sons. Inc.
1-1
Chapter 7 Part Three: Memory Management |
1
Chapter 7 Part Three: Memory Management |
Ch. 7: Main Memory
Chapter Objectives.
2
Ch. 7: Main Memory
Agenda.
• Background
• Memory Management
– Swapping or Unswapping
– Memory Allocation
• To provide a detailed description of various ways of organizing
memory hardware.
• To explore various techniques of allocating memory to processes.
• To discuss in detail how paging works in contemporary computer
systems.
Chapter 7 Part Three: Memory Management |
• Contiguous Memory Allocation
• Random Memory Allocation
– Memory Allocation: Problem – Strategy – Solution
• Segmentation
• Paging
3
Chapter 7 Part Three: Memory Management |
4
Background
Background
Basic Hardware.
STALL
STALL
process-1
process-4
process-2
...
process-3
RAM
process-1
CPU
process-2
process-n
process-3
Chapter 7 Part Three: Memory Management |
process-4
RAM
...
CACHE
5
Chapter 7 Part Three: Memory Management |
Background
• Pertimbangan yang dilakukan:
6
Background
• Proteksi dilakukan menggunakan dua
buah register: (1) base register, dan
(2) limit register.
• Base register: menandakan alamat
memori yang sah.
• Limit register: menandakan
besarnya jangakauan ukuran ruang
memori yang sah tersebut.
– bukan hanya mempertimbangkan kecepatan ketika mengakses memori,
tetapi juga memastikan CPU melakukan operasi yang benar;
• Caranya?
– memastikan bahwa setiap proses memiliki ruang memori yang terpisah,
hal ini akan menjaga ruang memori diakses oleh proses lain (adanya
proteksi ruang memori);
– Mengapa demikian?
• Bagaimanakah proteksi dilakukan?
Chapter 7 Part Three: Memory Management |
CPU
process-n
7
Chapter 7 Part Three: Memory Management |
8
Background
Memory Management
Swapping Existention.
• Swapping Memory Management
• Unswapping Memory Management
Memory Allocation.
• Contiguous Memory Allocation
• Random Memory Allocation
Hardware address protection with base and limit registers.
Chapter 7 Part Three: Memory Management |
9
Chapter 7 Part Three: Memory Management |
Memory Management
Memory Management
Contiguous Memory Allocation.
Random Memory Allocation.
Alokasi memori berurutan dapat diklasifikasikan menjadi:
1. Multiprogramming dengan pemartisian statis
Alokasi memori tak berurutan dapat diklasifikasikan menjadi:
1. Multiprogramming dengan pemartisian statis
– Berukuran sama
– Berbeda ukuran: (1) banyak antrian; dan (2) satu untuk semua antrian
10
– Berukuran sama
– Berbeda ukuran
2. Multiprogramming dengan pemartisian dinamis
2. Multiprogramming dengan pemartisian dinamis
– Berukuran sama
– Berbeda ukuran
Chapter 7 Part Three: Memory Management |
11
Chapter 7 Part Three: Memory Management |
12
Memory Management
• Solusi yang dapat dilakukan jika keempat strategi tersebut tidak
dapat menyelesaikan permasalhaan pengalokasian memori adalah
dengan melakukan memory compaction .
Memory Allocation: Problem & Strategy.
• Permasalahan yang muncul dalam pengalokasian ruang memori
adalah adanya beberapa lubang dengan kapasitas total yang cukup
besar untuk suatu proses, tetapi lubang tersebut tidak saling
berdekatan (external fragmentation ).
• Strategi yang dapat dilakukan untuk menangani permasalah
tersebut adalah denga menerapkan salah satu dari 4 strategi
pengalokasian ruang memori berikut: (1) first-fit; (2) next-fit; (3)
best-fit; dan (3) worst-fit.
Chapter 7 Part Three: Memory Management |
13
Operating System:
Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating System
Concepts Essentials, 2012, 2th Edition, John Wiley & Sons. Inc.
1-15
Chapter 7 Part Three: Memory Management |
Memory Management
15
Chapter 7 Part Three: Memory Management |
14
Operating System:
The main purpose of a computer system is to execute programs.
These programs, together with the data they access, must be at
least partially in main memory during execution. Selection of a
memory-management scheme for a system depends on many
factors, especially on the hardware design of the system.
CPU scheduling, improve both the utilization of the CPU and the
speed of the computer’s response to its users. To increase in
performance, several processes must be kept in memory — so,
the memory must be shared.
Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating System
Concepts Essentials, 2012, 2th Edition, John Wiley & Sons. Inc.
1-1
Chapter 7 Part Three: Memory Management |
1
Chapter 7 Part Three: Memory Management |
Ch. 7: Main Memory
Chapter Objectives.
2
Ch. 7: Main Memory
Agenda.
• Background
• Memory Management
– Swapping or Unswapping
– Memory Allocation
• To provide a detailed description of various ways of organizing
memory hardware.
• To explore various techniques of allocating memory to processes.
• To discuss in detail how paging works in contemporary computer
systems.
Chapter 7 Part Three: Memory Management |
• Contiguous Memory Allocation
• Random Memory Allocation
– Memory Allocation: Problem – Strategy – Solution
• Segmentation
• Paging
3
Chapter 7 Part Three: Memory Management |
4
Background
Background
Basic Hardware.
STALL
STALL
process-1
process-4
process-2
...
process-3
RAM
process-1
CPU
process-2
process-n
process-3
Chapter 7 Part Three: Memory Management |
process-4
RAM
...
CACHE
5
Chapter 7 Part Three: Memory Management |
Background
• Pertimbangan yang dilakukan:
6
Background
• Proteksi dilakukan menggunakan dua
buah register: (1) base register, dan
(2) limit register.
• Base register: menandakan alamat
memori yang sah.
• Limit register: menandakan
besarnya jangakauan ukuran ruang
memori yang sah tersebut.
– bukan hanya mempertimbangkan kecepatan ketika mengakses memori,
tetapi juga memastikan CPU melakukan operasi yang benar;
• Caranya?
– memastikan bahwa setiap proses memiliki ruang memori yang terpisah,
hal ini akan menjaga ruang memori diakses oleh proses lain (adanya
proteksi ruang memori);
– Mengapa demikian?
• Bagaimanakah proteksi dilakukan?
Chapter 7 Part Three: Memory Management |
CPU
process-n
7
Chapter 7 Part Three: Memory Management |
8
Background
Memory Management
Swapping Existention.
• Swapping Memory Management
• Unswapping Memory Management
Memory Allocation.
• Contiguous Memory Allocation
• Random Memory Allocation
Hardware address protection with base and limit registers.
Chapter 7 Part Three: Memory Management |
9
Chapter 7 Part Three: Memory Management |
Memory Management
Memory Management
Contiguous Memory Allocation.
Random Memory Allocation.
Alokasi memori berurutan dapat diklasifikasikan menjadi:
1. Multiprogramming dengan pemartisian statis
Alokasi memori tak berurutan dapat diklasifikasikan menjadi:
1. Multiprogramming dengan pemartisian statis
– Berukuran sama
– Berbeda ukuran: (1) banyak antrian; dan (2) satu untuk semua antrian
10
– Berukuran sama
– Berbeda ukuran
2. Multiprogramming dengan pemartisian dinamis
2. Multiprogramming dengan pemartisian dinamis
– Berukuran sama
– Berbeda ukuran
Chapter 7 Part Three: Memory Management |
11
Chapter 7 Part Three: Memory Management |
12
Memory Management
• Solusi yang dapat dilakukan jika keempat strategi tersebut tidak
dapat menyelesaikan permasalhaan pengalokasian memori adalah
dengan melakukan memory compaction .
Memory Allocation: Problem & Strategy.
• Permasalahan yang muncul dalam pengalokasian ruang memori
adalah adanya beberapa lubang dengan kapasitas total yang cukup
besar untuk suatu proses, tetapi lubang tersebut tidak saling
berdekatan (external fragmentation ).
• Strategi yang dapat dilakukan untuk menangani permasalah
tersebut adalah denga menerapkan salah satu dari 4 strategi
pengalokasian ruang memori berikut: (1) first-fit; (2) next-fit; (3)
best-fit; dan (3) worst-fit.
Chapter 7 Part Three: Memory Management |
13
Operating System:
Abraham Silberschatz, Peter Baer Galvin, Greg Gagne, Operating System
Concepts Essentials, 2012, 2th Edition, John Wiley & Sons. Inc.
1-15
Chapter 7 Part Three: Memory Management |
Memory Management
15
Chapter 7 Part Three: Memory Management |
14