473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

What is a *Page*?

Hi,

I'm viewing this stack overflow help page (
http://support.microsoft.com/kb/315937 ) at the ms support site. I cant say
I understand the concept of a "page" the way its used in this
example/explanation. I mean I only am aware of the *simple*, *general*,
paging concept, the one that is discussed often when explaning how an
operating system can support more memory than actually is available by doing
paging on the hard drive (and that also only at a higher-level theoratical
concept). Although the "page"/"page guard"/etc thats referenced here *feels*
something like that but nothing makes sense to me.
For example take this sentence:

"The stack then grows on demand to meet the needs of the thread. This is
implemented by placing a page with PAGE_GUARD access at the end of the
current stack."

here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.

- is "stack" some linked list kind of dynamically growing LIFO data
structure? Are the contents of this stack these (unknown for me) "pages", in
which case if the stack size is 5 than there will be 5 pages?

plz clarify...
Regards,

...ab
Jan 19 '07 #1
7 1301
"Abubakar" <em**********@yahoo.comwrote in message
news:uY**************@TK2MSFTNGP06.phx.gbl...
here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.
On an operating system that uses virtual memory, a page is the smallest
amount of memory which is moved in one go from the page file to physical
memory. If you need to know how much memory is in a page, you call
GetSystemInfo().
- is "stack" some linked list kind of dynamically growing LIFO data
structure?
No. The stack is a contiguous region of memory. By default, it is 1MB large.
But like every other region of memory in Windows it is virtual memory.
Address ranges of memory in the stack region are backed ("committed") by
physical memory on an as needed basis.
Are the contents of this stack these (unknown for me) "pages", in which
case if the stack size is 5 than there will be 5 pages?
It's a rare application which measures the size of anything in pages. The
stack is no different, it is measured in bytes.

Why do you need to know?

Regards,
Will
Jan 19 '07 #2
On Fri, 19 Jan 2007 20:34:29 +0500, "Abubakar" <em**********@yahoo.com>
wrote:
>Hi,

I'm viewing this stack overflow help page (
http://support.microsoft.com/kb/315937 ) at the ms support site. I cant say
I understand the concept of a "page" the way its used in this
example/explanation. I mean I only am aware of the *simple*, *general*,
paging concept, the one that is discussed often when explaning how an
operating system can support more memory than actually is available by doing
paging on the hard drive (and that also only at a higher-level theoratical
concept). Although the "page"/"page guard"/etc thats referenced here *feels*
something like that but nothing makes sense to me.
For example take this sentence:

"The stack then grows on demand to meet the needs of the thread. This is
implemented by placing a page with PAGE_GUARD access at the end of the
current stack."

here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.
A page is the smallest unit of memory the Windows virtual memory system
deals with. Look up VirtualAlloc, and you'll find a lot of info on pages.
- is "stack" some linked list kind of dynamically growing LIFO data
structure?
No, a thread's stack is a contiguous region of memory that grows
dynamically up to its maximum configured size as the thread pushes data
into the guard page, which causes a structured exception, which further
causes the OS to commit the page and create a new guard page just below it.
>Are the contents of this stack these (unknown for me) "pages", in
which case if the stack size is 5 than there will be 5 pages?
It's a lot more common to measure in bytes; when there's doubt, you should
specify the units, as I'm sure the Mars Climate Orbiter people wish they
had done.

You should search MSDN for PAGE_GUARD. This article talks about it, but its
example doesn't illustrate using it to grow a stack:

http://msdn2.microsoft.com/en-us/library/aa366549.aspx

This one talks about reserving and committing memory and shows how to use
structured exceptions to handle page faults to grow an array:

http://msdn2.microsoft.com/en-us/library/aa366803.aspx

What the system does with the thread stack lies somewhere in between...

--
Doug Harrison
Visual C++ MVP
Jan 19 '07 #3
Hey thanks for the useful links and the explanation. I'll have to read a lot
before being able to ask more on this topic.

Regards,

...ab

"Doug Harrison [MVP]" <ds*@mvps.orgwrote in message
news:ih********************************@4ax.com...
On Fri, 19 Jan 2007 20:34:29 +0500, "Abubakar" <em**********@yahoo.com>
wrote:
>>Hi,

I'm viewing this stack overflow help page (
http://support.microsoft.com/kb/315937 ) at the ms support site. I cant
say
I understand the concept of a "page" the way its used in this
example/explanation. I mean I only am aware of the *simple*, *general*,
paging concept, the one that is discussed often when explaning how an
operating system can support more memory than actually is available by
doing
paging on the hard drive (and that also only at a higher-level theoratical
concept). Although the "page"/"page guard"/etc thats referenced here
*feels*
something like that but nothing makes sense to me.
For example take this sentence:

"The stack then grows on demand to meet the needs of the thread. This is
implemented by placing a page with PAGE_GUARD access at the end of the
current stack."

here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.

A page is the smallest unit of memory the Windows virtual memory system
deals with. Look up VirtualAlloc, and you'll find a lot of info on pages.
>- is "stack" some linked list kind of dynamically growing LIFO data
structure?

No, a thread's stack is a contiguous region of memory that grows
dynamically up to its maximum configured size as the thread pushes data
into the guard page, which causes a structured exception, which further
causes the OS to commit the page and create a new guard page just below
it.
>>Are the contents of this stack these (unknown for me) "pages", in
which case if the stack size is 5 than there will be 5 pages?

It's a lot more common to measure in bytes; when there's doubt, you should
specify the units, as I'm sure the Mars Climate Orbiter people wish they
had done.

You should search MSDN for PAGE_GUARD. This article talks about it, but
its
example doesn't illustrate using it to grow a stack:

http://msdn2.microsoft.com/en-us/library/aa366549.aspx

This one talks about reserving and committing memory and shows how to use
structured exceptions to handle page faults to grow an array:

http://msdn2.microsoft.com/en-us/library/aa366803.aspx

What the system does with the thread stack lies somewhere in between...

--
Doug Harrison
Visual C++ MVP

Jan 20 '07 #4
Hi,
thanks for the nice explanation.
Why do you need to know?
Well, I was going through the kb site on microsoft support and it showed how
I could catch the stack overflow exception and handle it and the talk was
all about "pages". I have heard about pages before but I thought that
finally I need to remove my confusion and build up some knowledge about this
concept so I wont have any confusions in the future when somebody mentions
"stack" or "pages" or "heap" etc.

If u find/know any links related to these concepts, do share here.

Regards,

...ab

"William DePalo [MVP VC++]" <wi***********@mvps.orgwrote in message
news:Oq****************@TK2MSFTNGP02.phx.gbl...
"Abubakar" <em**********@yahoo.comwrote in message
news:uY**************@TK2MSFTNGP06.phx.gbl...
>here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.

On an operating system that uses virtual memory, a page is the smallest
amount of memory which is moved in one go from the page file to physical
memory. If you need to know how much memory is in a page, you call
GetSystemInfo().
>- is "stack" some linked list kind of dynamically growing LIFO data
structure?

No. The stack is a contiguous region of memory. By default, it is 1MB
large. But like every other region of memory in Windows it is virtual
memory. Address ranges of memory in the stack region are backed
("committed") by physical memory on an as needed basis.
>Are the contents of this stack these (unknown for me) "pages", in which
case if the stack size is 5 than there will be 5 pages?

It's a rare application which measures the size of anything in pages. The
stack is no different, it is measured in bytes.

Why do you need to know?

Regards,
Will


Jan 20 '07 #5
"Abubakar" <em**********@yahoo.comwrote in message
news:O7****************@TK2MSFTNGP06.phx.gbl...
thanks for the nice explanation.
You are welcome.
Well, I was going through the kb site on microsoft support and it showed
how I could catch the stack overflow exception and handle it and the talk
was all about "pages". I have heard about pages before but I thought that
finally I need to remove my confusion and build up some knowledge about
this concept so I wont have any confusions in the future when somebody
mentions "stack" or "pages" or "heap" etc.
Well, first you have to remember that the stack by deafult is 1MB large.
Your application shouldn't have to worry in general about overflowing the
stack. If it does overflow it, that's generally due to one of two main
causes:

1) a recursive algorithm recursing too much <g>
2) the allocation of a very large "automatic" array on the stack

One deals with the first problem by recasting an algorithm, and with the
second by moving the allocation to the heap.

Regards,
Will
Jan 20 '07 #6

"Abubakar" <em**********@yahoo.comwrote in message
news:uY**************@TK2MSFTNGP06.phx.gbl...
Hi,

I'm viewing this stack overflow help page (
http://support.microsoft.com/kb/315937 ) at the ms support site. I cant
say I understand the concept of a "page" the way its used in this
example/explanation. I mean I only am aware of the *simple*, *general*,
paging concept, the one that is discussed often when explaning how an
operating system can support more memory than actually is available by
doing paging on the hard drive (and that also only at a higher-level
theoratical concept). Although the "page"/"page guard"/etc thats
referenced here *feels* something like that but nothing makes sense to me.
For example take this sentence:
While a emulating additional memory using a swap file uses paging as its
implementation (in most OSes, including Windows), it is not the definition
of paging/virtual memory. It's extremely useful for isolating user-mode
processes from each other for security and reliability, and dynamic memory
commitment. A good place to start is by reading up on virtual memory and
the Translation Look-aside Buffer (TLB).

http://en.wikipedia.org/wiki/Virtual_memory
http://en.wikipedia.org/wiki/Page_fault
http://en.wikipedia.org/wiki/Page_table
http://en.wikipedia.org/wiki/Transla...okaside_Buffer
>
"The stack then grows on demand to meet the needs of the thread. This is
implemented by placing a page with PAGE_GUARD access at the end of the
current stack."

here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.

- is "stack" some linked list kind of dynamically growing LIFO data
structure? Are the contents of this stack these (unknown for me) "pages",
in which case if the stack size is 5 than there will be 5 pages?

plz clarify...
Regards,

..ab


Jan 22 '07 #7
Thanks.

...ab

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:u7**************@TK2MSFTNGP05.phx.gbl...
>
"Abubakar" <em**********@yahoo.comwrote in message
news:uY**************@TK2MSFTNGP06.phx.gbl...
>Hi,

I'm viewing this stack overflow help page (
http://support.microsoft.com/kb/315937 ) at the ms support site. I cant
say I understand the concept of a "page" the way its used in this
example/explanation. I mean I only am aware of the *simple*, *general*,
paging concept, the one that is discussed often when explaning how an
operating system can support more memory than actually is available by
doing paging on the hard drive (and that also only at a higher-level
theoratical concept). Although the "page"/"page guard"/etc thats
referenced here *feels* something like that but nothing makes sense to
me.
For example take this sentence:

While a emulating additional memory using a swap file uses paging as its
implementation (in most OSes, including Windows), it is not the definition
of paging/virtual memory. It's extremely useful for isolating user-mode
processes from each other for security and reliability, and dynamic memory
commitment. A good place to start is by reading up on virtual memory and
the Translation Look-aside Buffer (TLB).

http://en.wikipedia.org/wiki/Virtual_memory
http://en.wikipedia.org/wiki/Page_fault
http://en.wikipedia.org/wiki/Page_table
http://en.wikipedia.org/wiki/Transla...okaside_Buffer
>>
"The stack then grows on demand to meet the needs of the thread. This is
implemented by placing a page with PAGE_GUARD access at the end of the
current stack."

here I'm confused.
- What is a "page" here? Is it some data structure? What do they contain?
Can we see it? Is it documented? I need the links to its docs.

- is "stack" some linked list kind of dynamically growing LIFO data
structure? Are the contents of this stack these (unknown for me) "pages",
in which case if the stack size is 5 than there will be 5 pages?

plz clarify...
Regards,

..ab



Jan 31 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in...
6
by: Doc | last post by:
I'm trying to get to the bottom of a problem I've been having with publishing a freebie website. I'm using a program called WebEasy. Using a very simple site upload as an example, in this case a...
9
by: Just D. | last post by:
All, Did anybody see this strange effect? The web application is written in C#, ASP.NET, SQL, T-SQL, etc. A pretty usual stuff, complicated enough, but works fine until... Here is a question....
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
9
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
11
by: antonyliu2002 | last post by:
I know that this has been asked and answered thousands of times. As a matter of fact, I know that I need to say If Not Page.IsPostBack Then 'Do something End If for things that needs to be...
11
by: emailus | last post by:
I am webmaster for the domain <www.alpha1.org.au>. Not being an expert in html, I take advantage of my domain Registrant's web building tool, 'Instant Website'. This tool is provided as part of...
6
by: Sunfire | last post by:
Is there a way you can test what page is loaded from inside a master page? What I need to do is test to see what page is loaded inside the master page and then gray out the root item linked to that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.