banner



How Many Frames Of The Primary Page Table Are Required To Cover A Code/data/ Heap Of 512 Mb

Paging

A Retentiveness Management Technique



Page : one of numerous every bit sized chunks of memory

Page Table: stores where in memory each folio is

Chief Retention : divided into page frames, a space big enough to concur 1 page of data
( e.g. 4k )

Swap Space :

  • divided into pages
  • presume the consummate procedure is first loaded into the bandy infinite
  • more pages go dorsum and forth between bandy space and main memory
  • when a program is loaded, put it into the swap space
  • memory and page size is ever a power of 2

Address Translation with Paging

  • for each procedure at that place is an address A
  • when doing computations, always truncate

i. folio number = A / page_size

  • this is the page number inside the process address infinite
  • eastward.thou. address in the process, A = 10,000
  • folio size = 4k
  • page number = 10000 / 4k = ten,000 / 4096 = 2.xxx = truncate to two
  • this calculation is done apace on the computer since the page size is ability of 2, e.g., 4k = 2^12
  • to decide the folio number, shift the address right by 12 $.25
  • if the virtual accost size = 32 $.25, then since the page size is 4k = two^12, then the the terminal 12 bits give the page start, and the first 32- 12 = twenty bits give the page number
Example Address (in binary):
---------------------------------------
| 10101010101010101010 | 101010101010 |
---------------------------------------

two. offset = A mod page_size

  • this is the distance from the starting time of the page
  • e.g. address in the process, A = ten,000
  • page size = 4k
  • page offset = 10000 mod 4k = 10,000 mod 4096 = 1908
  • this adding is done quickly on the estimator since the folio size is power of 2, eastward.g., 4k = 2^12
  • to determine the page outset, mask out all but the rightmost 12 $.25

Now calculate the concrete address:

To compute the concrete accost:

  1. look upward the page number in the folio table and obtain the frame number
  2. to create the concrete address, frame = 17 bits; showtime = 12 bits; then
      512 = 29
      1m = 220 => 0 - ( 229-i )
      if main memory is 512 k, then the physical accost is 29 bits
Effective Memory Access Time
The percent of times that a page number is establish in the associative registers is called the hit ratio. An 80-pct hit ratio means that we discover the desired page number in the associative registers 80 percents of the time. If it takes 20 nanoseconds to search the associative registers, and 100 nanoseconds to access retention, then a mapped retentiveness admission takes 120 nanoseconds when the page number is in the associative registers. If we fail to find the page number in the associative registers (20 nanoseconds), then we must get-go admission memory for the page table and frame number (100 nanoseconds), so access the desired byte in memory (100 nanoseconds), for a total of 220 nanoseconds. To find the effective admission time, we must counterbalance each case by information technology probability:
effective access fourth dimension = 0.eighty * 120 + 0.20 * 220        
= 140 nanoseconds.

In this case, we suffer a forty-pct slowdown in memory admission fourth dimension (from 100 to 140 nanoseconds).
For a 98-percent hit ratio, we accept

constructive admission time = 0.98 * 120 + 0.02 * 220                       = 122 nanoseconds      

The increased hit charge per unit produces only a 22-percent slowdown in retention access fourth dimension.
The hit ratio is clearly related to the number of associative registers. With the number of associative registers ranging between 16 and 512, a hit ratio of 80 to 98 percent can be obtained.

To practise page table look-ups quickly:

  • a translation lookaside buffer (TLB) is used
  • associative enshroud, where enshroud is the fastest memory bachelor and associative looks at all the entries at the same time
  • expensive
  • relatively pocket-size
  • but a few page number/frame number pairs can be stored at in one case
  • stores the entries from the most recently used pages
  • updated each time a page fault occurs

Page Fault

  • when a process tries to access an address whose folio is not currently in memory
  • procedure must be suspended, process leaves the processor and the ready list, status is now ``waiting for main retentivity''

Address: tin can be an address of an education, or of data (heap, stack, static, variables)


Paging Operations
  • fetch " page in " => bring a folio into chief retention

ane. Fetch policy

a) demand fetching = demand paging

  • fetch a page when it is referenced only not stored in main memory
  • causes a folio fault whenever a new page is required
  • disadvantage - cold showtime fault: many folio faults when a process is just starting
  • reward - no unnecessary pages are ever fetched

b) anticipatory fetching = prepaging

  • guess which pages will be required before long and fetch them before they are referenced

There are three variations:

i) working set prepaging

  • brand sure to fetch all pages in a process' working gear up earlier restarting
  • working set up: a set of pages accessed in the final 'west' working time units
    where w = the window size based on temporal locality
  • intent is that all pages required soon are in principal memory when the process starts

ii) clustering prepaging

  • when a page is fetched, also fetch the adjacent page(southward) in the procedure address infinite
  • cost of fetching due north consecutive pages from deejay is less than fetching n non-sequent pages
  • common variant is to fetch pairs of pages whenever one is referenced
  • the extra page may be before or subsequently - used in Windows NT, WIndows 2000

iii) brash prepaging

  • programmer/compiler adds hints to the OS about what pages will be needed soon
  • due east.k. hint: & myfunction
  • problem: cannot trust programmers; they volition hint that all their pages are important

2. Placement Policy

  • decide where to put the page that has been fetched
  • like shooting fish in a barrel for paging, just use whatever free page frame

3. Replacement Policy

  • determines which page should be removed from main retentivity (when a page must be fetched)
  • want to find the least useful page in main memory
  • candidates, in order of preference:
      one. page of a terminated procedure

      2. folio of a long blocked procedure

      • danger: practice not desire to bandy out pages from a process that is trying to bring pages into main retentivity
      • thrashing:
        • where the arrangement is preoccupied with moving pages in and out of retentiveness
        • feature: the disk can be very busy while the CPU is most idle
        • one cure is to reduce the number of processes in main memory
          i.e., reduce the level of multiprogramming

      3. take a folio from a ready process that has not been referenced for a long time

      4. take a page that has not been modified since it was swapped in

      • saves copying to the swap infinite

      5. take a page that has been referenced recently by a set process

      • => operation volition downgrade

Local versus Glogal Page Replacement:

  • Local page replacement: when a process pages "against itself" and removes some of its ain pages
  • Global page replacement: when pages from all processes are considered
  • Example: Windows NT/XP/Vista use both a local folio replacement method (based on FIFO) and a global page replacement method (based on PFF)

Table of Contents

How Many Frames Of The Primary Page Table Are Required To Cover A Code/data/ Heap Of 512 Mb,

Source: http://www2.cs.uregina.ca/~hamilton/courses/330/notes/memory/paging.html

Posted by: rosadotrah1940.blogspot.com

0 Response to "How Many Frames Of The Primary Page Table Are Required To Cover A Code/data/ Heap Of 512 Mb"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel