Memory Fault: Difference between revisions

From COMP15212 Wiki
gravatar Yuron [userbureaucratinterface-adminsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmludGVyZmFjZS1hZG1pbjxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+] (talk | contribs)
m (1 revision imported)
pc>Yuron
No edit summary
Line 2: Line 2:
-->{{Path|Exceptions|6}}<!--
-->{{Path|Exceptions|6}}<!--
-->{{#invoke:Dependencies|add|Exceptions,4|Paging,4|Memory Segmentation,2}}
-->{{#invoke:Dependencies|add|Exceptions,4|Paging,4|Memory Segmentation,2}}
A computer’s (main) memory can be read or written by software.
A computer’s (main) memory can be read or written by software. However, under some circumstances the memory system will indicate an [[Exceptions|exception]] instead, indicating that the requested operation cannot be completed … at least at this time.  Instead it <strong>aborts</strong>.
However, under some circumstances the memory system will indicate an
[[Exceptions|exception]] instead, indicating that the requested
operation cannot be completed … at least at this time.  Instead it
<strong>aborts</strong>.


There are a few typical causes for this.
There are a few typical causes for this.
Line 16: Line 12:


<blockquote>
<blockquote>
Note that “memory” here may include access to I/O
Note that “memory” here may include access to I/O peripheral devices and interfaces which are often [[Memory_Mapping|memory
peripheral devices and interfaces which are often [[Memory_Mapping|memory
mapped]] into the address space.
mapped]] into the address space.
</blockquote>
</blockquote>
As may be deduced there are different causes which can occur in
As may be deduced there are different causes which can occur in different stages of the memory cycle.  These may [[Exceptions|trap]] in the same, or similar, ways and need sorting out by the operating system.  This exception can be seen as a sort of system call although it might not happen consistently.
different stages of the memory cycle.  These may [[Exceptions|trap]] in
the same, or similar, ways and need sorting out by the operating
system.  This exception can be seen as a sort of system call although
it might not happen consistently.
<blockquote>
<blockquote>
Example: a LOAD instruction addresses a page which is found to be
Example: a LOAD instruction addresses a page which is found to be absent during [[Memory_Mapping|<strong>memory mapping</strong>]]; the [[Memory Management Unit (MMU)|MMU]] triggers an abort which <em>calls</em> the [[paging]] process.  The paging process returns to the faulting instruction, which now completes successfully.  The next time the same LOAD executes the page is found and no exception occurs.
absent during [[Memory_Mapping|<strong>memory mapping</strong>]]; the [[Memory Management Unit (MMU)|MMU]]
triggers an abort which <em>calls</em> the [[paging]] process.  The
paging process returns to the faulting instruction, which now
completes successfully.  The next time the same LOAD executes the
page is found and no exception occurs.
</blockquote>
</blockquote>
Memory faults are therefore ‘called’ by a combination of
Memory faults are therefore ‘called’ by a combination of hardware and software.
hardware and software.
----
----
When a memory fault has occurred the cause must be determined and the
When a memory fault has occurred the cause must be determined and the appropriate action decided.  Examples of the sort of causes and the appropriate actions might include:
appropriate action decided.  Examples of the sort of causes and the
appropriate actions might include:


*Applications code tries to write to OS memory: segmentation fault – terminate process.
*Applications code tries to write to OS memory: segmentation fault – terminate process.
Line 46: Line 29:


<blockquote>
<blockquote>
Example?: if you haven’t managed to cause a segmentation fault yet
Example?: if you haven’t managed to cause a segmentation fault yet you can’t have been trying hard enough!
you can’t have been trying hard enough!
</blockquote>
</blockquote>
----
----
 
{{BookChapter|10.2.1|393-396}}
{{PageGraph}}
{{PageGraph}}
{{Category|Virtual Memory}}
{{Category|Virtual Memory}}
{{Category|Exceptions}}
{{Category|Exceptions}}
{{Category|Memory}}
{{Category|Memory}}

Revision as of 13:16, 2 August 2019

On path: Exceptions 1: Exceptions • 2: Reset • 3: System Calls • 4: Software Exceptions • 5: Emulator traps • 6: Memory Fault • 7: Interrupts • 8: Unix Signals
Depends on ExceptionsPagingMemory Segmentation

A computer’s (main) memory can be read or written by software. However, under some circumstances the memory system will indicate an exception instead, indicating that the requested operation cannot be completed … at least at this time. Instead it aborts.

There are a few typical causes for this.

  • Privilege violation – e.g. where a user application tries to get at operating system space.
  • Page faults indicate there is no physical memory at that (virtual) address.
  • The operation has become stalled and timed out (typically associated with I/O devices).
  • The memory has been corrupted and detected this (e.g. parity check).

Note that “memory” here may include access to I/O peripheral devices and interfaces which are often memory mapped into the address space.

As may be deduced there are different causes which can occur in different stages of the memory cycle. These may trap in the same, or similar, ways and need sorting out by the operating system. This exception can be seen as a sort of system call although it might not happen consistently.

Example: a LOAD instruction addresses a page which is found to be absent during memory mapping; the MMU triggers an abort which calls the paging process. The paging process returns to the faulting instruction, which now completes successfully. The next time the same LOAD executes the page is found and no exception occurs.

Memory faults are therefore ‘called’ by a combination of hardware and software.


When a memory fault has occurred the cause must be determined and the appropriate action decided. Examples of the sort of causes and the appropriate actions might include:

  • Applications code tries to write to OS memory: segmentation fault – terminate process.
  • Applications code tries to read from an absent page: page fault - fetch page from disk and ‘return’ to retry operation.
  • I/O routine in OS times out during peripheral access: log error, maybe retry by ‘returning’ appropriate code to software.
  • Memory parity fault: depends on system; may be possible to restore/recreate the memory contents, may have to terminate the process.

Example?: if you haven’t managed to cause a segmentation fault yet you can’t have been trying hard enough!


Also refer to: Operating System Concepts, 10th Edition: Chapter 10.2.1, pages 393-396