Review: Memory & File System

dokumen-dokumen yang mirip
Review: Memory & File System

SISTIM OPERASI (Operating System) IKI Memory Management. Memory: Part 2 Ch. 8. Johny Moningka

Memory Management. Memory Ch. 8. Latar Belakang. Main-Memory Management

memuat banyak proses dalam suatu waktu Sebelum masuk ke memori, suatu proses harus menunggu dalam antrian

MANAJEMEN MEMORI. Manajemen Memori 1

Sistem Operasi 8. Memory Management. Antonius Rachmat C, S.Kom, M.Cs

Sistem Operasi. Memory Management. Part 1 of 2

MANAJEMEN MEMORI SISTEM OPERASI

Sistem Operasi Komputer. Pertemuan VIII Manajemen Memori

Virtual Memory Ch. 9. Virtual Memory. SISTIM OPERASI (Operating System) IKI Johny Moningka

Virtual Memory. Latar Belakang Demand Paging Pembuatan Proses Page Replacement Alokasi Frame Thrashing Contoh Sistem Operasi

Memory Management Memori Latar Belakang Alamat Binding

Memory Management. Latar Belakang Swapping Contiguous Allocation Paging Segmentation Segmentation dengan Paging

Organisasi Sistem Komputer. Virtual Memory. Sekolah Teknik Elektro dan Informatika ITB

Sistem Operasi 9. Virtual Memory. Antonius Rachmat C, S.Kom, M.Cs

MANAJEMEN MEMORI. Kelompok : Agung Widiyarto( ) Fahrurrozi( ) Reynaldo( Y)

Memori Virtual (Virtual Memory) Heri Kurniawan OS-Genap 2007/2008

Sistem Operasi Komputer

Segmentasi dan Paging Pada Intel Pentium. Heri Kurniawan OS-Genap 2007/2008

SEGMENTATION. Dania Tigarani Soraya Desiana Nurul Maftuhah. Kelompok Manajemen Memory: Copyright

Virtual Memory. Latar Belakang. Latar Belakang (cont.) Virtual Memori

Memori Virtual. Program membutuhkan kapasitas yang lebih besar dari kapasitas memori fisik gunakan Virtual Memory! Virtual memory

File-System Implementation

RESUME SISTEM OPERASI MAIN MEMORI

Tujuan Pembelajaran. Memahami pengalamatan dengan menggunakan paging

Bab 8: Manajemen Memori. Latar Belakang

DASKOM & PEMROGRAMAN. Dani Usman

KONSEP MULTIPROGRAMMING

Kelompok 55.1: Nilam Fitriah ( ) Nova Eka Diana ( ) Kritik :

1. Address Binding. Sebuah program ditempatkan dalam disk dalam bentuk berkas biner Sebelum dieksekusi, sebuah program harus ditempatkan di memori.

Keuntungan Virtual Memory

Sekolah Tinggi Teknologi Adisutjipto Yogyakarta

Computer System Structures

Manajemen Memori. Latar Belakang Ruang Alamat Logika dan Ruang Alamat Fisik Swapping Alokasi berurutan Paging Segmentasi Segmentasi dengan Paging

Hubungan CPU dengan Memory

Latar Belakang Ruang Alamat Logika dan Ruang Alamat Fisik Swapping Alokasi berurutan Paging Segmentasi Segmentasi dengan Paging

MEMORI VIRTUAL. Kelompok Franky Sadar Baskoro S. Yemima Aprilia

Managemen Memori 2016

Tujuan Pembelajaran. Memahami proses swapping Memahami proses alokasi memori berurutan (Contiguous Memori Allocation)

Pertemuan #5: Memori dan Memori Virtual

SISTEM OPERASI ISG2B3 MANAJEMEN MEMORI. Agus Setiawan Program Studi Sistem Informasi Fakultas Rekayasa Industri Telkom University

Virtual Memory. Sistem Operasi

3/30/2016. Manajemen Memori. Manajemen Memori. Manajemen memori pada sistem Monoprogramming Manajemen memori pada sistem Multiprogramming

Understanding Operating Systems Fifth Edition

Studi Kasus Kernel Linux

ARSITEKTUR DAN ORGANISASI KOMPUTER

Manajemen Memori (P ( ertemuan ke ert -12) Oktober 2014

Praktikum 13. Manajemen Memori 1 ALOKASI MEMORI POKOK BAHASAN: TUJUAN BELAJAR: DASAR TEORI:

Sekolah Tinggi Teknologi Adisutjipto Yogyakarta

MEMORI VIRTUAL. Sistem Operasi TIKB1023 Munengsih Sari Bunga. Politeknik Indramayu. TIKB1023/Sistem Operasi/MSB 1

Dukungan Sistem Operasi :

BAB V VIRTUAL MEMORY. Tujuan: 1. Menggetahui penggunaan virtual memori dalam komputer 2. Mengetahui peran virtual memori dalam sistem operasi

Kelompok Pemberian Halaman

Tidak bisa dynamic loading Memori virtual perl r u lebih besar disharing

VIRTUAL MEMORY. Gambar 1. Struktur Umum Overlay

Memori pada Sistem Linux. Heri Kurniawan OS-Gasal 2009/2010

Pertemuan 2. Struktur Sistem Operasi

Operating-System Structures (Ch. 3)

IKI20210 Pengantar Organisasi Komputer Kuliah no. 6c:Cache Memory. Bobby Nazief Johny Moningka

1. Helga Hiwy 2. Erni Gombo 3. Imelda Florensia 4. Claudio Wayong 5. Vedra Simbala. Published By Stefanikha69

Struktur Sistem Komputer. Abdullah Sistem Informasi Universitas Binadarma

Alamat Logika dan Fisik

Bab 9: Virtual Memory. Latar Belakang

Sistem Operasi Pertemuan 7 Pengelolaan Memory. H u s n i Lab. Sistem Komputer & Jaringan Teknik Informatika Univ. Trunojoyo

Ch t ap 7 er Operating System (OS)

Memori Linux. Anggota Kelompok : Jani RR Siregar Martin Leonard T Y Muhamad Mulki A

membagi-bagi memori untuk mengakomodasi banyak proses menjamin agar setiap proses yang ready dapat segera memanfaatkan processor

17/04/2015 SISTEM OPERASI

1/3/2013. Konsep Dasar memori

SMK MUHAMMADIYAH 4 JAKARTA TEKNIK KOMPUTER DAN JARINGAN SISTEM OPERASI MENEJEMEN MEMORI

Tahun Akademik 2014/2015 Semester II. DIG1I3 - Instalasi dan Penggunaan Sistem Operasi

Sistem Operasi AGUS PAMUJI. Teknik Informatika

Sistem Operasi. Divais Input/Output 2016

Processes. Processes. SISTIM OPERASI (Operating System) IKI-20230

Manajemen Memori Virtual

Struktur Sistem Komputer

Process Synchronization (Background)

File System (Interface) Ch. 10

Struktur Sistem Komputer

Bab 8. Memori Virtual POKOK BAHASAN: TUJUAN BELAJAR: 8.1 LATAR BELAKANG

Review: Demand Paging. Virtual Memory Ch. 9. Virtual Memory. Review: VM = OS big lie

Bab 2. Instructions: Bahasa dari Komputer

Sistem Operasi. Proses (Process) 2016

Tipe Sistem Operasi. Stand alone Network Embedded

Mahasiswa dapat memahami konsep dasar deskripsi dan kontrol pada proses

Arsitektur Sistem Komputer. Operasi Sistem Komputer. Struktur Sistem Komputer. Review:

Instructions Set. Element dari instruction. Representasi dari Op code

Struktur Sistem Operasi

Struktur Sistem Operasi

Operating System. Manajemen Memori. Fak. Teknik Jurusan Teknik Informatika Universitas Pasundan. Dosen : Caca E. Supriana, S.Si

Process Control Block (PCB) Masing-masing proses Direpresentasikan oleh Sistem Operasi dengan menggunakan Process Control Block (PCB),

Alokasi Memori Kernel. Heri Kurniawan OS-Gasal 2009/2010

DEFINISI SISTEM OPERASI

ARSITEKTUR DAN ORGANISASI KOMPUTER Aditya Wikan Mahastama

3. Apa kekurangan paging sederhana dibandingkan dengan paging pada virtual memory?

segmentasi dan kombinasi paging-segmentasi Kelompok Rujianto : Arif Setiawan : Muslikan :

Struktur Sistem Komputer

IKI20210 Pengantar Organisasi Komputer Kuliah no. 1b: Basic Operations

DASAR KOMPUTER. Assembly Language

Bab 2: Struktur Sistem Operasi. Komponen Sistem Secara Umum

Transkripsi:

Review: Memory & File System SISTIM OPERASI (Operating System) IKI-20230 Johny Moningka (moningka@cs.ui.ac.id) Fakultas Ilmu Komputer Universitas Indonesia Semester 2000/2001 Review: MM Apakah fungsi main-memory (user s view)? Memori sebagai tempat penyimpanan instruksi/data dari program Storage yang cepat sehingga dapat mengimbangi kecepatan eksekusi instruksi CPU Terdiri dari array of words/bytes yang besar Address digunakan untuk mengakses data (shared oleh CPU dan I/O devices) Management Memory Melacak dan proteksi pemakaian memori (siapa dan berapa besar?). Memilih program mana yang akan diload ke memori dari disk. 1

Problem: Multiprogramming Misalkan terdapat 3 program (proses) di memori: OS netscape vi 0x0000 0x4000 0x7000 0x9000 0xA000 Kapan diberikan informasi akan diekesekusi pada lokasi 0x4000? Apa yang harus dilakukan jika memerlukan memory tambahan? Bagaimana jika yang diperlukan lebih dari memory yang tersisa? Jika netscape terjadi error dan menulis pada alamat 0x4100? Apa yang terjadi jika program berhenti eksekusi terminated? Review MM JM-2000/v1.1/3 R: Address Translation Apakah perbedaan antara logical address dan physical address? Address lojik: address yang di-generate oleh CPU (disebut juga virtual address) berdasarkan kode/urutan address dari eksekusi proses saat itu. Independent dari lokasi program tersebut berada di memori. Lokasi eksekusi code program, hanya berarti untuk proses tersebut yang sedang dieksekusi. Address fisik: address yang sebenarnya berada pada memori fisik (storage). Lokasi tertentu yang telah diberikan kepada proses (setiap proses mempunyai alokasi memori tertentu). Lokasi ini harus diproteksi oleh memory management. Review MM JM-2000/v1.1/4 2

Review: Relocation Bagaimana program dapat dieksekusi pada address fisik di memori? Saat program di load ke memori (load time binding). Menggunakan base register (contiguous allocation). Note: Hal yang sama berlaku untuk dynamic relocation (segementation), hanya bedanya informasi base lokasi memori (address space) telah disimpan pada process table (PCB) dan setiap context switch informasi tersebut di update. Review MM JM-2000/v1.1/5 Review: load-time binding Saat linking (build) => generate daftar referensi untuk alamat absolut (symbol table). Saat load => lokasi program di memori (telah diketahui), dan ubah alamat tersebut sesuai dengan lokasi. static 0x3000 OS 0x4000 jump 0x2000 0x1000 jump 0x5000 0x7000 Review MM JM-2000/v1.1/6 3

Base Register Gunakan bantuan register (relocation register): setiap akses ke memori. Base register: berisi informasi relokasi program di memori fisik. relocation: physical addr = virtual addr + base register OS a.out jump 0x2000 0x3000 0x1000 a.out jump 0x2000 MMU: base register proses : 0x400 When process runs, base register = 0x4000, Jump addr = 0x2000 + 0x4000 = 0x6000 0x4000 0x7000 Review MM JM-2000/v1.1/7 jump 0x6000 Review: Protection Jika netscape terjadi error dan menulis pada alamat 0x4100? Bagaimana melakukan proteksi? Saat program di load ke memori (load time binding): Dapat diketahui maximum memori yang telah dialokasi => limit address yang dapat diakses. Simpan limit address => limit register. Proses hanya dapat mengakses range : base address s/d limit address. Jika error tidak mengganggu proses lain. Note: Mekanisme ini menciptakan konsep dasar: segment (range address yang bervariasi) dan paging (range address yang tetap besarnya). Review MM JM-2000/v1.1/8 4

Contoh Kerja MMU CPU Base register 14000 Address lojik Address fisik 346 14346 + Limit register range? 24000 MMU memori Review MM JM-2000/v1.1/9 Review: Base & Limit Register Keuntungan base & limit register (contiguous allocation): Sederhana (hardware dan programming): diperlukan 2 register, di update saat context switch dari proses. Relokasi dan proteksi: cepat, hanya perlu addition dan comparison. Kerugian: hanya ada satu segment lokasi memori untuk satu proses!!. Problem 1: growing processes (data bertambah) How to expand? Problem 2: how to share code and data?? Bagaimana dapat menggunakan code library yang sama?? How to separate code and data? Salah satu solusi: multiple segments segmentation Review MM JM-2000/v1.1/10 Free space netscape1 netscape p2 2 5

What does a process look like? (Unix) Process address space logically divided into segments : text (code), data, heap (dynamic data), and stack function call, return parameter etc stack address 2^n-1 malloc(), free() heap initialized data code address >= 0 Review MM JM-2000/v1.1/11 Review: Linker Apakah perbedaan static shared lib dan dynamic shared lib? Static shared lib: Define a shared library segment at same address in every program s address space Every shared lib is allocated a unique range in this seg, and computes where its external defs reside Review MM JM-2000/v1.1/12 6

Static Linking 0xffe0000 0xfff0000 0xffe0000 0xfff0000 ls 0xffe0000 0xfff0000 hello 0xffe0000 0xfff0000 libc.a math.a Review MM JM-2000/v1.1/13 Linking variation 2: dynamic shared libs Problem: static shared libraries require systemwide pre-allocation address space: kaku tidak flexible! We want to link code anywhere in address space Problem 1: linker won t know how to resolve refs do resolution at runtime link in stubs that know where to get code from program calls stub, goes and gets code Review MM JM-2000/v1.1/14 7

Dynamic Linking ls 4500 printf: 9000 libc.a printf_stub: scanf_stub: /usr/shrd-lib/libc.a sscanf: printf_stub: scanf_stub: Review MM JM-2000/v1.1/15 Problem 2: Dynamic shared libraries Code must simultaneously run at different locations! Sol n: make lib code position independent refer to routines, data using relative addressing (base + constant offset) rather than absolute addresses 0xf00 0xf44 Example: printf: call 0xf44 write: libc.a 0x0 0x44 internal call call 0xf44 become call lib_base + 0x44 printf: call libc_base+0x44 write: lib_base contains the base address of library (private to each process) & 0x44 is called routine s internal offset Review MM JM-2000/v1.1/16 8

Segmentation Ide: Proses mempunyai base + limit lebih dari satu. Proses address space dibangun dari sekumpulan segments yang tersebar (tidak perlu contiguos allocation untuk proses). Setiap segment menempati alokasi memori yang contiguous, dan ukurannya dapat bervariasi (tidak tetap). Setiap segment mempunyai proteksi sendiri. Setiap segment dapat di share (programmer s view) dengan proses lain. Review MM JM-2000/v1.1/17 Segmentation 0x1000 0x3000 Text seg r/o Real memory 0x2000 0x3000 0x5000 0x6000 Stack seg r/w Seg. text: Base: Limit:.. Protection: read only Shared: yes 0x6000 0x8000 Seg. stack: base:.. limit:.. Protection: read write Shared: No Review MM JM-2000/v1.1/18 9

Segmentation Bagaimana proses melakukan mapping untuk semua segment yang ada (address translation)? Segment table: Setiap proses mempunyai deretan segment yang disimpan pada table. Misalkan: row pada table, berisi informasi untuk satu segment (base, limit, protection, dll). Setiap memori reference menunjukkan pointer ke segment pada table dan offset. Logical address terbagi dua field: nomor segment pada table dan offset pada segment tersebut. Note: nomor segment => implementasi nomor index pada entry segment table (menghemat bit dan comparison, searching). Review MM JM-2000/v1.1/19 Example: Virtual addr 4 128? no yes fault + mem Seg# offset Seg table Prot base len Seg 4 0x1000 128 4 0x1000 512 Range? Review MM JM-2000/v1.1/20 10

Segmentation example 2-bit segment number (1st digit), 12 bit offset (last 3) Seg base limit rw 0 0x4000 0x6ff 10 1 0x0000 0x4ff 11 2 0x3000 0xfff 11 3 00 where is 0x0240? 0x1108? 0x265c? 0x3002? Fault 0x1600? Fault logical 0x4000 0x3000 0x2000 0x1500 0x1000 0x0700 0x0000 Review MM JM-2000/v1.1/21 physical 0x4700 0x4000 0x3000 0x500 0x0 Segmentation Tradeoffs Pro: Tidak perlu contiguous allocation: Multiple segments per process Allows sharing! (how?) Don t need entire process in memory!!! Con: code where? Extra layer of translation speed = hardware support More subtle: an n byte segment requires n *contigious* bytes of physical memory. (why?) Makes fragmentation a real problem. vi Review MM JM-2000/v1.1/22 11

Review: Fragmentation Apakah yang dimaksud fragmentasi memori? Ketidak-mampuan OS menggunakan memori yang tidak digunakan (free memory). Terangkan 2 jenis fragmentasi yang ada: External fragmentation: Variable sized allocation (segment): Tersebar variable sized yang kecil dari memory yang free, tapi tidak mencukupi untuk alokasi satu segment. Internal fragmentation. Fixed sized allocation (paging): bagian memori yang tidak digunakan oleh proses tapi telah di-alokasikan. Review MM JM-2000/v1.1/23 Fragmentation vi?? emacs External fragmentation allocated doom stack Unused ( internal fragmentation ) Review MM JM-2000/v1.1/24 12

Paging Pembagian memori dalam ukuran tertentu ( pages ) Pages typical: 4k-8k vi internal frag Tradeoff: pro: eliminates external fragmentation pro: simplifies allocation, free and swapping con: internal fragmentation Review MM JM-2000/v1.1/25 Paging:mechanism Memory dibagi dalam ukuran tertentu dan tetap (pages) Setiap proses mempunyai table ( page table ) yang menyimpan informasi pages yang dialokasikan ke proses tersebut. Entry pada page table: mapping virtual page number (VPN) ke physical page number (PPN) PT entry also includes protection bits (r, w, valid) Addressing: virtual address => terbagi atas 2 field: VPN dan offset (max. ukuran pages). Q: Misalkan MIPS, addressing 32 bit dan besarnya pages: 4 KB, berapa bit untuk VPN dan berapa untuk offset? Review MM JM-2000/v1.1/26 13

Example: Besarnya ukuran pages: 4 KB => 12 bits Jadi offset: 12 bits, VPN: 32 12 bits = 20 bits. Virtual addr 3 128 (12bits) offset: 128 0x1000 mem VPN page offset page table Prot VPN PPN? PPN page 128 invalid pages r 3 1 belum ada di memori fisik! Review MM JM-2000/v1.1/27 Page tables (vs segmentation) Good: Mudah untuk alokasi: karena ukuran tetap, operasi dapat dilakukan dengan bantuan hardware untuk mapping VA ke PA. Manajemen pages: daftar pages yang free dapat dikumpulkan dalam free list. Bad: Ukuran page table: PTs memerlukan satu entry untuk setiap page => perlu storage lebih besar untuk menyimpan informasi PT. e.g., given a range [0x0000, 0xffff => 64 KB] need one segment descriptor but, assuming 4K pages, 16 page table entries B=0x0,len=0xffff Page table 0x0000 0xFFFF Review MM JM-2000/v1.1/28 14

Page size tradeoffs More Overhead & locality Internal frag & writeback cost page size Small page = large PT overhead: 32-bit address space with 1k pages. How big PT? Lokalitas program tidak terakomodasi tersebar ke banyak pages => page faults dapat meningkat. Large page = internal frag (doesn t match info. size) Transfer time 1 pages at page faults? Write back untuk satu pages yang telah diupadte => lama Review MM JM-2000/v1.1/29 15