1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Marat540 [252]
3 years ago
7

Memory Question!

Engineering
1 answer:
mafiozo [28]3 years ago
7 0

Answer:

Demand Paging

The basic idea behind demand paging is that when a process is swapped in, its pages are not swapped in all at once. Rather they are swapped in only when the process needs them. ( on demand. ) This is termed a lazy swapper, although a pager is a more accurate term.

Figure 9.4 - Transfer of a paged memory to contiguous disk space

9.2.1 Basic Concepts

The basic idea behind paging is that when a process is swapped in, the pager only loads into memory those pages that it expects the process to need ( right away. )

Pages that are not loaded into memory are marked as invalid in the page table, using the invalid bit. ( The rest of the page table entry may either be blank or contain information about where to find the swapped-out page on the hard drive. )

If the process only ever accesses pages that are loaded in memory ( memory resident pages ), then the process runs exactly as if all the pages were loaded in to memory.

Figure 9.5 - Page table when some pages are not in main memory.

On the other hand, if a page is needed that was not originally loaded up, then a page fault trap is generated, which must be handled in a series of steps:

The memory address requested is first checked, to make sure it was a valid memory request.

If the reference was invalid, the process is terminated. Otherwise, the page must be paged in.

A free frame is located, possibly from a free-frame list.

A disk operation is scheduled to bring in the necessary page from disk. ( This will usually block the process on an I/O wait, allowing some other process to use the CPU in the meantime. )

When the I/O operation is complete, the process's page table is updated with the new frame number, and the invalid bit is changed to indicate that this is now a valid page reference.

The instruction that caused the page fault must now be restarted from the beginning, ( as soon as this process gets another turn on the CPU. )

Figure 9.6 - Steps in handling a page fault

In an extreme case, NO pages are swapped in for a process until they are requested by page faults. This is known as pure demand paging.

In theory each instruction could generate multiple page faults. In practice this is very rare, due to locality of reference, covered in section 9.6.1.

The hardware necessary to support virtual memory is the same as for paging and swapping: A page table and secondary memory. ( Swap space, whose allocation is discussed in chapter 12. )

A crucial part of the process is that the instruction must be restarted from scratch once the desired page has been made available in memory. For most simple instructions this is not a major difficulty. However there are some architectures that allow a single instruction to modify a fairly large block of data, ( which may span a page boundary ), and if some of the data gets modified before the page fault occurs, this could cause problems. One solution is to access both ends of the block before executing the instruction, guaranteeing that the necessary pages get paged in before the instruction begins.

9.2.2 Performance of Demand Paging

Obviously there is some slowdown and performance hit whenever a page fault occurs and the system has to go get it from memory, but just how big a hit is it exactly?

There are many steps that occur when servicing a page fault ( see book for full details ), and some of the steps are optional or variable. But just for the sake of discussion, suppose that a normal memory access requires 200 nanoseconds, and that servicing a page fault takes 8 milliseconds. ( 8,000,000 nanoseconds, or 40,000 times a normal memory access. ) With a page fault rate of p, ( on a scale from 0 to 1 ), the effective access time is now:

( 1 - p ) * ( 200 ) + p * 8000000

= 200 + 7,999,800 * p

which clearly depends heavily on p! Even if only one access in 1000 causes a page fault, the effective access time drops from 200 nanoseconds to 8.2 microseconds, a slowdown of a factor of 40 times. In order to keep the slowdown less than 10%, the page fault rate must be less than 0.0000025, or one in 399,990 accesses.

A subtlety is that swap space is faster to access than the regular file system, because it does not have to go through the whole directory structure. For this reason some systems will transfer an entire process from the file system to swap space before starting up the process, so that future paging all occurs from the ( relatively ) faster swap space.

Some systems use demand paging directly from the file system for binary code ( which never changes and hence does not have to be stored on a page operation ), and to reserve the swap space for data segments that must be stored. This approach is used by both Solaris and BSD Unix

You might be interested in
This problem demonstrates aliasing. Generate a 512-point waveform consisting of 2 sinusoids at 200 and 400-Hz. Assume a sampling
aalyn [17]

Answer and Explanation:

clear all; close all;  

N=512;  

t=(1:N)/N;

fs=1000;  

f=(1:N)*fs/N;

x= sin(2*pi*200*t) + sin(2*pi*400*t);  

y= sin(2*pi*200*t) + sin(2*pi*900*t);

for n = 1:20  

a(n) = (2/N)*sum(x.*(cos(2*pi*n*t)))

b(n) = (2/N)*sum(x.*(sin(2*pi*n*t)))  

c(n) = sqrt(a(n).^2+b(n).^2)  

theta(n) =-(360/(2*pi))*atan(b(n)./a(n));  

end  

plot(f(1:20),c(1:20),'rd');

disp([a(1:4),b(1:4),c(1:4),theta(1:4)])

8 0
3 years ago
Which Finance jobs can someone pursue with only a high school diploma? Check all that apply.
Zolol [24]

Answer:

Teller, Loan Officer, and Tax Preparer

Explanation:

3 0
3 years ago
Read 2 more answers
A certain heat pump produces 200 kW of heating for a 293 K heated zone while only using 75 kW of power and a heat source at 273
vodka [1.7K]

Answer:

COP(heat pump) = 2.66

COP(Theoretical maximum) = 14.65

Explanation:

Given:

Q(h) = 200 KW

W = 75 KW

Temperature (T1) = 293 K

Temperature (T2) = 273 K

Find:

COP(heat pump)

COP(Theoretical maximum)

Computation:

COP(heat pump) = Q(h) / W

COP(heat pump) = 200 / 75

COP(heat pump) = 2.66

COP(Theoretical maximum) = T1 / (T1 - T2)

COP(Theoretical maximum) = 293 / (293 - 273)

COP(Theoretical maximum) = 293 / 20

COP(Theoretical maximum) = 14.65

8 0
3 years ago
Calculate the wire pressure for a round copper bar with an original cross-sectional area of 12.56 mm2 to a 30% reduction of area
dybincka [34]

Answer:153.76 MPa

Explanation:

Initial Area\left ( A_0\right )=12.56 mm^2

Final Area\left ( A_f\right )=0.7\times 12.56 mm^2=8.792 mm^2

Die angle=30^{\circ}

\alpha =\frac{30}{2}=15^{\circ}

\mu =0.08

Yield stress\left ( \sigma _y \right )=350 MPa

B=\mu cot\left ( \aplha\right )=0.2985

\sigma _{pressure}=\sigma _y\left [\frac{1+B}{B}\right ]\left [ 1-\frac{A_f}{A_0}\right ]^B

\sigma _{pressure}=350\left [\frac{1+0.2985}{0.2985}\right ]\left [ 1-\frac{8.792}{12.56}\right ]^{0.2985}

\sigma _{pressure}=153.76 MPa

8 0
2 years ago
Adding new equipment or processes may require changes to the PPE requirements for
Yuki888 [10]
I think it’s is false I’m not that sure
5 0
2 years ago
Read 2 more answers
Other questions:
  • Does the army good 4 you
    15·1 answer
  • Problem 3: Soil Classification using the AASHTO and USCS Systems
    10·1 answer
  • The viscosity of all liquids decreases as the temperature is a) Increased b) decreased c) maintained constant d) fluctuating e)
    12·1 answer
  • What is an isentropic process?
    7·1 answer
  • You are given that kc = 10-1 kg eq-1 min-1, ku = 10-3 kg2 eq-2 min-1 and [A]0 = 10 eq kg-1, where kc is the rate constant for a
    15·1 answer
  • In fully developed laminar flow in a circular pipe the velocity at R/2 (mid-way between the wall surface and the centerline) is
    10·2 answers
  • You apply a force of 19 lbs on to the end of a lever to lift a crate. The resistance of the load is 106 lbs. Calculate the
    13·1 answer
  • Applications of fleming hand rule
    6·1 answer
  • A master stud pattern is laid out somewhat<br> like a?
    8·1 answer
  • A book sitting on a shelf is an example of ____________.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!