<< Chapter < Page Chapter >> Page >

So far we have disentangled the programmer's view of memory from the system's view using a mapping mechanism. Each sees a differentorganization. This makes it easier for the OS to shuffle users around and simplifies memory sharing between users.

However, until now a user process had to be completely loaded into memory before it could run. This is wasteful since aprocess only needs a small amount of its total memory at any one time (locality). Virtual memory permits a process to run with only some of itsvirtual address space loaded into physical memory.

The memory hierarchy

The idea is to produce the illusion of a memory with the size of the disk and the speed of main memory.

Data can be in registers (very fast), caches (fast), main memory (not so fast, or disk (slow). Keep the things that you usefrequently as close to you (and as fast to access) as possible.

The reason that this works is that most programs spend most of their time in only a small piece of the code. Give Knuth'sestimate of 90% of the time in 10% of the code. Introduce again the principle oflocality.

Page faults

If not all of process is loaded when it is running, what happens when it references a byte that is only in the backing store?Hardware and software cooperate to make things work anyway.

  • First, extend the page tables with an extra bit "present". If present is not set then a reference to the page results in a trap. This trap isgiven a special name, page fault.
  • Any page not in main memory right now has the "present" bit cleared in its page table entry.
  • When page fault occurs:
    • Operating system brings page into memory.
    • Page table is updated, "present" bit is set.
    • The process is continued.

Continuing process is very tricky, since it may have been aborted in the middle of an instruction. Do not want user process tobe aware that the page fault even happened.

  • Can the instruction just be skipped?
  • Suppose the instruction is restarted from the beginning. How is the "beginning" located?
  • Even if the beginning is found, what about instructions with side effects, like:

ld [%r2], %r2

  • Without additional information from the hardware, it may be impossible to restart a process after a page fault. Machines that permitrestarting must have hardware support to keep track of all the side effects so that they can be undone before restarting.
  • Forest Baskett's approach for the old Zilog Z8000 (two processors, one just for handling page faults)
  • IBM 370 solution (execute long instructions twice).
  • If you think about this when designing the instruction set, it is not too hard to make a machine virtualizable. It is much harder to do afterthe fact. VAX is example of doing it right.

Effective access time calculation

We can calculate the estimated cost of page faults by performing an effective access time calculation. The basic idea is thatsometimes you access a location quickly (there is no page fault) and sometimes more slowly (you have to wait for a page to come into memory). We use the costof each type of access and the percentage of time that it occurs to compute the average time to access a word.

Questions & Answers

what is mutation
Janga Reply
what is a cell
Sifune Reply
how is urine form
Sifune
what is antagonism?
mahase Reply
classification of plants, gymnosperm features.
Linsy Reply
what is the features of gymnosperm
Linsy
how many types of solid did we have
Samuel Reply
what is an ionic bond
Samuel
What is Atoms
Daprince Reply
what is fallopian tube
Merolyn
what is bladder
Merolyn
what's bulbourethral gland
Eduek Reply
urine is formed in the nephron of the renal medulla in the kidney. It starts from filtration, then selective reabsorption and finally secretion
onuoha Reply
State the evolution relation and relevance between endoplasmic reticulum and cytoskeleton as it relates to cell.
Jeremiah
what is heart
Konadu Reply
how is urine formed in human
Konadu
how is urine formed in human
Rahma
what is the diference between a cavity and a canal
Pelagie Reply
what is the causative agent of malaria
Diamond
malaria is caused by an insect called mosquito.
Naomi
Malaria is cause by female anopheles mosquito
Isaac
Malaria is caused by plasmodium Female anopheles mosquitoe is d carrier
Olalekan
a canal is more needed in a root but a cavity is a bad effect
Commander
what are pathogens
Don Reply
In biology, a pathogen (Greek: πάθος pathos "suffering", "passion" and -γενής -genēs "producer of") in the oldest and broadest sense, is anything that can produce disease. A pathogen may also be referred to as an infectious agent, or simply a germ. The term pathogen came into use in the 1880s.[1][2
Zainab
A virus
Commander
Definition of respiration
Muhsin Reply
respiration is the process in which we breath in oxygen and breath out carbon dioxide
Achor
how are lungs work
Commander
where does digestion begins
Achiri Reply
in the mouth
EZEKIEL
what are the functions of follicle stimulating harmones?
Rashima Reply
stimulates the follicle to release the mature ovum into the oviduct
Davonte
what are the functions of Endocrine and pituitary gland
Chinaza
endocrine secrete hormone and regulate body process
Achor
while pituitary gland is an example of endocrine system and it's found in the Brain
Achor
what's biology?
Egbodo Reply
Biology is the study of living organisms, divided into many specialized field that cover their morphology, physiology,anatomy, behaviour,origin and distribution.
Lisah
biology is the study of life.
Alfreda
Biology is the study of how living organisms live and survive in a specific environment
Sifune
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Operating systems. OpenStax CNX. Aug 13, 2009 Download for free at http://cnx.org/content/col10785/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Operating systems' conversation and receive update notifications?

Ask