SlideShare ist ein Scribd-Unternehmen logo
1 von 2
A potential source of memory latency is called a minor page fault. They are created when a
process attempts to access a portion of memory before it has been initialized. In this case, the
system will need to perform some operations to fill the memory maps or other management
structures. The severity of a minor page fault can depend on system load and other factors, but
they are usually short and have a negligable impact.

A more severe memory latency is a major page fault. These can occur when the system has to
synchronize memory buffers with the disk, swap memory pages belonging to other processes, or
undertake any other Input/Output activity to free memory. This occurs when the processor
references a virtual memory address that has not had a physical page allocated to it. The
reference to an empty page causes the processor to execute a fault, and instructs the kernel
code to allocate a page and return, all of which increases latency dramatically


缺页有 3 种:major page fault,minor page fault,protection fault

major page faults 发生在试图访问一个虚拟内存单元,该单元虽已被 map
到 Solaris 的某个段映像,不过并不存在于物理内存中,这时,MMU 会触发一个
缺页中断(x86)或 trap(sparc),导致内核处理程式比较该内存错误地址发生在
哪个段。如果不属于所有一个段则给进程发送一个段错误 SIGSEGV。否则,将
调用该段驱动程式的 page-fault 例程。调用该例程的结果可能是两种:
1. 该内存存在于 swap 区,段驱动通过 vnode 的 getpage 函数,从 swap 读入
到物理内存
2. 该内存从未被使用,需要新生成该页

minor page faults 发生在试图访问一个虚拟内存单元,该单元已被 map 到
Solaris 的某个段映像,并且已存在于物理内存,但还未建立物理内存和虚拟地址
空间 转换关系。例如系统种的共享库,就属于这种情形,实际上多个进程只是共享
同一共享 库的物理内存页,第一个引用共享库的进程导致一个 major page faults,
而之后的其 他进程引用则只是 minor page faults,attach 在该库的物理内存上。

protection faults 发生在试图访问一个虚拟内存单元,该单元访问方式和所在段的
访问 方式相悖。例如写程式的代码段将会导致该错误。

It's   normal       and            unremarkable           for    your      application         to    generate         page
faults.   In     linux         (and       most      other       modern      OSes),       the    operating        system
doesn't load all of your code and data into memory immediately when your
program        starts,        it    simply        sets    up    internal    data        structures      so     that    the
code and data can be found if/when they're later needed. So the pages
corresponding            to        your    program          code     and         data     are       "faulted    in"     --
essentially         one              at       a          time      --        as         you          access       them.


Once they've been allocated and/or read into memory, they are likely to
remain there as long as they're being used regularly (also assuming you
have           an                  adequate              amount             of           physical              memory).
Likewise,      if   you      allocate    some        large   buffers,    for     example,       you'll    find
that   in     actuality      the   operating       system    merely     did     some    bookkeeping         at
the    time     you    did     the     allocation.     The   memory          won't   actually    be      made
available      to     your     process     until      your   program         attempts    to     access     it.
This will cause a page fault; physical memory is then made available to
your    process,       "swapping"         some       other   page       to     the   paging      device     if
necessary       (hopefully         a   page    that     hasn't   been        used    recently     by     your
pjrogram or any another).

Weitere ähnliche Inhalte

Ähnlich wie Page faults

Operating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdfOperating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdfJUSTSTYLISH3B2MOHALI
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptRahulRaj395610
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memoryvampugani
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.pptPratikBose10
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual MemoryArchith777
 
Vmreport
VmreportVmreport
Vmreportmeru2ks
 
Vmfs
VmfsVmfs
Vmfsdgzz
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.pptsuryansh85
 
Case leakage
Case leakageCase leakage
Case leakagetcbarrett
 
Windows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementWindows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementKent Huang
 
Htg explains what is the windows page file and should you disable it
Htg explains  what is the windows page file and should you disable it Htg explains  what is the windows page file and should you disable it
Htg explains what is the windows page file and should you disable it Trường Tiền
 
Htg explains what is the windows page file and should you disable it
Htg explains  what is the windows page file and should you disable it Htg explains  what is the windows page file and should you disable it
Htg explains what is the windows page file and should you disable it Trường Tiền
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managmentSantu Kumar
 

Ähnlich wie Page faults (20)

Operating system
Operating systemOperating system
Operating system
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Operating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdfOperating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdf
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
Os
OsOs
Os
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
NOV11 virtual memory.ppt
NOV11 virtual memory.pptNOV11 virtual memory.ppt
NOV11 virtual memory.ppt
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Vmreport
VmreportVmreport
Vmreport
 
VirutualMemory.docx
VirutualMemory.docxVirutualMemory.docx
VirutualMemory.docx
 
Vmfs
VmfsVmfs
Vmfs
 
virtual memory.ppt
virtual memory.pptvirtual memory.ppt
virtual memory.ppt
 
Fsck Sx
Fsck SxFsck Sx
Fsck Sx
 
Fsck Sx
Fsck SxFsck Sx
Fsck Sx
 
Case leakage
Case leakageCase leakage
Case leakage
 
Windows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementWindows Internal - Ch9 memory management
Windows Internal - Ch9 memory management
 
Htg explains what is the windows page file and should you disable it
Htg explains  what is the windows page file and should you disable it Htg explains  what is the windows page file and should you disable it
Htg explains what is the windows page file and should you disable it
 
Htg explains what is the windows page file and should you disable it
Htg explains  what is the windows page file and should you disable it Htg explains  what is the windows page file and should you disable it
Htg explains what is the windows page file and should you disable it
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 

Page faults

  • 1. A potential source of memory latency is called a minor page fault. They are created when a process attempts to access a portion of memory before it has been initialized. In this case, the system will need to perform some operations to fill the memory maps or other management structures. The severity of a minor page fault can depend on system load and other factors, but they are usually short and have a negligable impact. A more severe memory latency is a major page fault. These can occur when the system has to synchronize memory buffers with the disk, swap memory pages belonging to other processes, or undertake any other Input/Output activity to free memory. This occurs when the processor references a virtual memory address that has not had a physical page allocated to it. The reference to an empty page causes the processor to execute a fault, and instructs the kernel code to allocate a page and return, all of which increases latency dramatically 缺页有 3 种:major page fault,minor page fault,protection fault major page faults 发生在试图访问一个虚拟内存单元,该单元虽已被 map 到 Solaris 的某个段映像,不过并不存在于物理内存中,这时,MMU 会触发一个 缺页中断(x86)或 trap(sparc),导致内核处理程式比较该内存错误地址发生在 哪个段。如果不属于所有一个段则给进程发送一个段错误 SIGSEGV。否则,将 调用该段驱动程式的 page-fault 例程。调用该例程的结果可能是两种: 1. 该内存存在于 swap 区,段驱动通过 vnode 的 getpage 函数,从 swap 读入 到物理内存 2. 该内存从未被使用,需要新生成该页 minor page faults 发生在试图访问一个虚拟内存单元,该单元已被 map 到 Solaris 的某个段映像,并且已存在于物理内存,但还未建立物理内存和虚拟地址 空间 转换关系。例如系统种的共享库,就属于这种情形,实际上多个进程只是共享 同一共享 库的物理内存页,第一个引用共享库的进程导致一个 major page faults, 而之后的其 他进程引用则只是 minor page faults,attach 在该库的物理内存上。 protection faults 发生在试图访问一个虚拟内存单元,该单元访问方式和所在段的 访问 方式相悖。例如写程式的代码段将会导致该错误。 It's normal and unremarkable for your application to generate page faults. In linux (and most other modern OSes), the operating system doesn't load all of your code and data into memory immediately when your program starts, it simply sets up internal data structures so that the code and data can be found if/when they're later needed. So the pages corresponding to your program code and data are "faulted in" -- essentially one at a time -- as you access them. Once they've been allocated and/or read into memory, they are likely to remain there as long as they're being used regularly (also assuming you have an adequate amount of physical memory).
  • 2. Likewise, if you allocate some large buffers, for example, you'll find that in actuality the operating system merely did some bookkeeping at the time you did the allocation. The memory won't actually be made available to your process until your program attempts to access it. This will cause a page fault; physical memory is then made available to your process, "swapping" some other page to the paging device if necessary (hopefully a page that hasn't been used recently by your pjrogram or any another).