Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linux Memory Management

Similar presentations


Presentation on theme: "Linux Memory Management"— Presentation transcript:

1 Linux Memory Management
Initialization

2 Some concept Address translation -logical address
User space vs Kernel space - linear address 0~4GB (x86) ie.Alpha 2^64 byte - physical address ie: logical linear physical User view Physical situation

3 - local descriptor table LDT for user space every task has one LDT
Logical Address - local descriptor table LDT for user space every task has one LDT ie: struct desc_struct* ldt ; global descriptor table GDT for kernel space - sgment descriptor entry in LDT/GDT - selector decide a segment descriptor in LDT/GDT

4 GDTR LDTR selector offset
Seg descriptor ,, GDT[0]=null GDT[1]=kernel code seg descriptor GDT[1]=kernel data ,, base limit logical Seg descriptor LDTR LDT[0]=null LDT[1]=user code seg descriptor LDT{2]=user data selector CS /DS offset memory EIP

5 Logicasl address to Linear adderss - user space
segment descriptor=(0 ,0xc ) Task_size 變數 = 0xc linear address=0x 0xc - kernel space : segment descriptor=(0xc ,4GB) linear address=3GB4GB

6 Task Logical address Linear address 0GB User space 3GB Kernel Space
Segment hardware 3GB Kernel Space 4GB

7 - paging hardware mechanisinm - x86 is two layer
Linear to Physical - paging hardware mechanisinm - x86 is two layer DIR TABLE OFFSET 10bit 10bit 12bit

8 Physcial memory page index Linear address page index table directory
Page hardware page index Linear address TABLE page DIR index table directory index Dir base

9 - in th memory initial stats
Some important points - swapper_pg_dir - in th memory initial stats - the first 768 entry in swapper_pg_dir =0 above 768 , mapping 3GB~4GB to physcial - all Task’page directory has the “same” value as swapper_pg_dir from entry 768 to why?? 768*4MB= ~=3GB let all task’s kernel space(3GB~4GB) can map to the same physical memory

10 - Task from user sapce to kernel space 1. Prcoess ‘s seg_base= 0x00
Example - Task from user sapce to kernel space 1. Prcoess ‘s seg_base= 0x00 page_dir private to process 2. make system call 3.seg_bsae=0xc page_dir has the same above 768 value as swapper_pg_dir 4. Noe we run kernel space using the common page tables ie: run the same physical space

11 1.when task/process runs in user
Concluds 1.when task/process runs in user sapce ,it can run in arbitrary Physical space according to it’s page_dir(0~768entry) 2. but runs in kernel space, process just can run the common physical space (the place we put kernel)

12 Memory initialization
arch/i386/kernel/HEAD.S int/main.c start_kernel() { . paging_init(); call free_area_init() mem_init(); }

13 Major work paging_init() - Initial the page tables of swapper_pg_dir (from 768 entry) free_area_init() - loacate swap_cache space initial free_list

14 - mem_init() contruct the mem_map in the memory to reflect the physcal memory usage start_memory , end_memory paremeter

15 Map of physcial memory before any user process are executed
Kernel can’t look page[0] address terms Relevant routine or variable or explains Map of physcial memory before any user process are executed


Download ppt "Linux Memory Management"

Similar presentations


Ads by Google