memory management questions

I have some questions about RTP’s memory management.

  1. What is the page size being used?

  2. What is the logical address size ( I think how much memory can be
    addressed)?


    This is for a class project and I can’t figure out how to determine this
    from the os itself. Thanks.

Ross Brantner

In qdn.public.qnxrtp.applications Ross Brantner <brantner@innernet.net> wrote:

I have some questions about RTP’s memory management.

  1. What is the page size being used?

4k.


  1. What is the logical address size ( I think how much memory can be
    addressed)?

32 bytes – means 4G can be addressed.

-David

x86 in protected mode (without memory extensions enabled) uses a 4k page size,
so this is what RtP uses. The RtP uses a “flat” memory model, which means that
maximum logical address space (again without address extensions enabled) is 4G.
Nobody at QNX can tell me when they’ll get around to >4G memory support. Dos
this answer your questions?

-Warren


“Ross Brantner” <brantner@innernet.net> wrote in message
news:8u6p45$r8n$1@inn.qnx.com
| I have some questions about RTP’s memory management.
|
| 1. What is the page size being used?
|
| 2. What is the logical address size ( I think how much memory can be
| addressed)?
|
|
| This is for a class project and I can’t figure out how to determine this
| from the os itself. Thanks.
|
| Ross Brantner

In article <8u6vhu$6d7$1@inn.qnx.com>, “Warren Peece”
<warren@nospam.com> wrote:

x86 in protected mode (without memory extensions enabled) uses a 4k page
size,
so this is what RtP uses.

A different question…

Is there a Neutrino system call or other programmatic way (e.g. constant
in an include file) for my software to know that RTP uses 4K pages, or
is this a magic number I need to encode myself?

In qdn.public.qnxrtp.newuser Eric Berdahl <berdahl@intelligentparadigm.com> wrote:

In article <8u6vhu$6d7$> 1@inn.qnx.com> >, “Warren Peece”
warren@nospam.com> > wrote:

x86 in protected mode (without memory extensions enabled) uses a 4k page
size,
so this is what RtP uses.

A different question…

Is there a Neutrino system call or other programmatic way (e.g. constant
in an include file) for my software to know that RTP uses 4K pages, or
is this a magic number I need to encode myself?

Why do you need to know this figure at all? Memory is allocated to
processes in multiples of pages, but if you’re looking at malloc()/
calloc()/free()/etc then it has granularity of a byte. What are you
doing that page size is important?

-David

“Eric Berdahl” <berdahl@intelligentparadigm.com> wrote in message
news:berdahl-DC2B3F.11365406112000@inn.qnx.com
| In article <8u6vhu$6d7$1@inn.qnx.com>, “Warren Peece”
| <warren@nospam.com> wrote:
|
| > x86 in protected mode (without memory extensions enabled) uses a 4k page
| > size,
| > so this is what RtP uses.
|
| A different question…
|
| Is there a Neutrino system call or other programmatic way (e.g. constant
| in an include file) for my software to know that RTP uses 4K pages, or
| is this a magic number I need to encode myself?

You can reference __PAGESIZE in sys/mman.h (that’s two underbars there)

In article <8u73mj$500$1@nntp.qnx.com>, David Gibbs <dagibbs@qnx.com>
wrote:

In qdn.public.qnxrtp.newuser Eric Berdahl
berdahl@intelligentparadigm.com> > wrote:
In article <8u6vhu$6d7$> 1@inn.qnx.com> >, “Warren Peece”
warren@nospam.com> > wrote:

x86 in protected mode (without memory extensions enabled) uses a 4k
page
size,
so this is what RtP uses.

A different question…

Is there a Neutrino system call or other programmatic way (e.g.
constant
in an include file) for my software to know that RTP uses 4K pages, or
is this a magic number I need to encode myself?

Why do you need to know this figure at all? Memory is allocated to
processes in multiples of pages, but if you’re looking at malloc()/
calloc()/free()/etc then it has granularity of a byte. What are you
doing that page size is important?

It’s a pure optimization. I am allocating a block of memory that needs
to be physically contiguous (it’s going to be a buffer for DMA to/from a
PCI card). The allocation routine takes a requested size and returns the
actual size allocated, allowing the allocation routine to optimize for
various memory management architectures. Generally, I round the
requested size up to the nearest page size – no sense in wasting the
remainder of the page.

But it’s an optimization. If I can’t get this information from any given
OS, I don’t round up and just waste the remainder of the allocated page.

Uhm, if you mmap() in some physical memory perhaps while writing a PCI device
driver, doesn’t mmap() give you back the address of the page containing the
first byte of what you’re looking for? In such an instance if your PCI memory
isn’t 4k aligned, then you need to twiddle your pointer to get to the proper
location (I actually ran into this). That would be tough to do if you didn’t
know what the page size was. Eric’s reason is he needs it for a school
project, as he stated in his original message.

Eric, the sysconf() thingie that someone else mentioned about finding the page
size would be the correct way to go about it (more portable) than relying on
the magic number in sys/mman.h (if you’re shooting for portability at all).

I’m disappointed that you’d come up with the “why do you need to know”
attitude, David. I’ve only gotten that one other time from a QNX staffer
(Christian DeChamplain), and it really bothered me that I had to pound on him 5
or 6 times to convince him that I was worthy of the knowledge, when he could
have saved us about an hour each of typing by just throwing out the one
sentence answer I was looking for. I understand that it’s important to get to
the bottom of what someone’s really asking for, it’s just a personal peeve of
mine to have to plead for knowledge because someone thinks you don’t really
want to know (maybe I need a vacation :slight_smile:

-Warren


“David Gibbs” <dagibbs@qnx.com> wrote in message
news:8u73mj$500$1@nntp.qnx.com
| In qdn.public.qnxrtp.newuser Eric Berdahl <berdahl@intelligentparadigm.com>
wrote:
| > In article <8u6vhu$6d7$1@inn.qnx.com>, “Warren Peece”
| > <warren@nospam.com> wrote:
|
| >> x86 in protected mode (without memory extensions enabled) uses a 4k page
| >> size,
| >> so this is what RtP uses.
|
| > A different question…
|
| > Is there a Neutrino system call or other programmatic way (e.g. constant
| > in an include file) for my software to know that RTP uses 4K pages, or
| > is this a magic number I need to encode myself?
|
| Why do you need to know this figure at all? Memory is allocated to
| processes in multiples of pages, but if you’re looking at malloc()/
| calloc()/free()/etc then it has granularity of a byte. What are you
| doing that page size is important?
|
| -David

In article <8u73mm$b8t$1@inn.qnx.com>, Warren Peece <warren@nospam.com> wrote:

“Eric Berdahl” <> berdahl@intelligentparadigm.com> > wrote in message
news:> berdahl-DC2B3F.11365406112000@inn.qnx.com> …
| In article <8u6vhu$6d7$> 1@inn.qnx.com> >, “Warren Peece”
| <> warren@nospam.com> > wrote:
|
| > x86 in protected mode (without memory extensions enabled) uses a 4k page
| > size,
| > so this is what RtP uses.
|
| A different question…
|
| Is there a Neutrino system call or other programmatic way (e.g. constant
| in an include file) for my software to know that RTP uses 4K pages, or
| is this a magic number I need to encode myself?

You can reference __PAGESIZE in sys/mman.h (that’s two underbars there)

#include <unistd.h>
long pagesize = sysconf(_SC_PAGESIZE);

works on all POSIX systems. This is usually better when the
parameter could vary according to architecture. PAGESIZE or __PAGESIZE
isn’t portable.

Steve Furr email: furr@qnx.com
QNX Software Systems, Ltd.

In article <8u74kn$cjs$1@inn.qnx.com>, “Warren Peece”
<warren@nospam.com> wrote:

Eric’s reason is he needs it for a school
project, as he stated in his original message.

I think you’re confusing me with the original poster who, I believe, was
working on a school project. I’m looking at designing a system that will
include some proprietary PCI hardware. Many of my questions here an in
other qdn.* forums are geared at those issues.

Eric, the sysconf() thingie that someone else mentioned about finding the
page
size would be the correct way to go about it (more portable) than relying
on
the magic number in sys/mman.h (if you’re shooting for portability at
all).

sysconf? Good stuff. That looks like the goods. Thanks.

I’m disappointed that you’d come up with the “why do you need to know”
attitude, David.

Don’t be too hard on David. I’ve been in OSes for a while and I find
that 80% of the time someone asks questions like this, they are 10
minutes away from doing something they think is very clever, but is
actually very stupid. From all I had written to date, I might have been
in that 80% case. If so, the gentle souls out there could have directed
me to a better solution to my problem. If not, the explanation could act
as an example to others of good uses for this information.

That said, I symphathize with your further comments about trying to
convince tech support folks that you really do need to know the
information for which you’re asking. The most frustrating thing tech
support folks have told me is “that’s a silly problem”. Luckilly, I
haven’t read that in these forums!

Thanks again.

In qdn.public.qnxrtp.newuser Warren Peece <warren@nospam.com> wrote:

I’m disappointed that you’d come up with the “why do you need to know”
attitude, David.

I answered the original question about page size almost immediately –
I said 4k, and addressable 1G. I wasn’t trying to hid the information.

But, I’ve also learnt that if people are asking questions that look odd
to me, that sometimes they are doing something smart – but sometimes they
had a mistaken assumption/expectation somewhere along the way, and that by
trying to get an understanding of what the purpose of the question, or what
they expect to do with the answer, I can often direct them away from an
unsuccessful course.

(e.g. recently someone was asking how QNX4 stty got the ioport information
for the serial port that it reports if you do an “stty -a < /dev/ser1”. I
replied that it sent a message to the serial port driver, then asked why
they needed this information. Turned out, they want to write something
that would deal with the serial hardware directly, and thought this would
be a general hardware query, not a query of a device driver that is already
running and controlling the hardware. I was able to direct them away from
using this message, as it wouldn’t have helped them. If I hadn’t asked
why they wanted the information, they could easily have progressed down
a dead-end design. This sort of thing is NOT an isolated occurence.)

-David

In qdn.public.qnxrtp.newuser Eric Berdahl <berdahl@intelligentparadigm.com> wrote:

In article <8u74kn$cjs$> 1@inn.qnx.com> >, “Warren Peece”
warren@nospam.com> > wrote:

Eric’s reason is he needs it for a school
project, as he stated in his original message.

I think you’re confusing me with the original poster who, I believe, was
working on a school project. I’m looking at designing a system that will
include some proprietary PCI hardware. Many of my questions here an in
other qdn.* forums are geared at those issues.

Eric, the sysconf() thingie that someone else mentioned about finding the
page
size would be the correct way to go about it (more portable) than relying
on
the magic number in sys/mman.h (if you’re shooting for portability at
all).

sysconf? Good stuff. That looks like the goods. Thanks.

I’m disappointed that you’d come up with the “why do you need to know”
attitude, David.

Don’t be too hard on David. I’ve been in OSes for a while and I find
that 80% of the time someone asks questions like this, they are 10
minutes away from doing something they think is very clever, but is
actually very stupid. From all I had written to date, I might have been
in that 80% case. If so, the gentle souls out there could have directed
me to a better solution to my problem. If not, the explanation could act
as an example to others of good uses for this information.

Or, sometimes they’ve only posted a fraction of the problem (though that
wasn’t the case here), and by asking for the whole problem, I can solve
the problem in one go, rather than by playing 20 questions.

That said, I symphathize with your further comments about trying to
convince tech support folks that you really do need to know the
information for which you’re asking. The most frustrating thing tech
support folks have told me is “that’s a silly problem”. Luckilly, I
haven’t read that in these forums!

I try to avoid “that’s a silly problem”, but sometimes I have to tell
people, “that’s a sillly solution”, here’s a far better one. But, if
I’ve only trying to answer a small piece, it can be hard to tell.

-David

Hmmm. I must have missed the original answer, and it’s more likely than not
that I’m confusing people. My random lame excuse generator produces: I gave up
caffeine… :frowning:

My intent is not to be hard on David, whom I believe to be extraordinarily
helpful (which was why his response struck me as odd). I also realize that
tossing out a quick answer and allowing someone to plunge to their death
(figuratively speaking, of course) because they were totally off-target is
taking the “easy way out” and the correct thing to do is ferret out exactly
what they’re trying to accomplish. More likely than not I’m hyper-sensitive to
things that sound like “You don’t need to know that” because of my previous bad
experience with the aforementioned QNX staffer (no longer employed there, I
understand). So if I came across as being too hard on David, I apologize to
him and everyone else reading this- it’s certainly not my intent to tick-off
the staffers then come ask them for help (and I WILL need it, believe me!). I
just feel strongly as I said about those types of phrases, and wanted to
express my feelings in the hope that I may cause someone to think twice and
maybe rephrase before issuing the same sort of verbiage.

For the record, I have always found the QNX folks to be courteous, professional
and extremely helpful in all aspects (with the one notable exception) and I do
not mean to imply otherwise by whining about the way somebody phrased
something.

Thus endeth the apology.

-Warren


“David Gibbs” <dagibbs@qnx.com> wrote in message
news:8u781d$6s0$1@nntp.qnx.com
| In qdn.public.qnxrtp.newuser Warren Peece <warren@nospam.com> wrote:
|
| > I’m disappointed that you’d come up with the “why do you need to know”
| > attitude, David.
|
| I answered the original question about page size almost immediately –
| I said 4k, and addressable 1G. I wasn’t trying to hid the information.
|
| But, I’ve also learnt that if people are asking questions that look odd
| to me, that sometimes they are doing something smart – but sometimes they
| had a mistaken assumption/expectation somewhere along the way, and that by
| trying to get an understanding of what the purpose of the question, or what
| they expect to do with the answer, I can often direct them away from an
| unsuccessful course.
|
| (e.g. recently someone was asking how QNX4 stty got the ioport information
| for the serial port that it reports if you do an “stty -a < /dev/ser1”. I
| replied that it sent a message to the serial port driver, then asked why
| they needed this information. Turned out, they want to write something
| that would deal with the serial hardware directly, and thought this would
| be a general hardware query, not a query of a device driver that is already
| running and controlling the hardware. I was able to direct them away from
| using this message, as it wouldn’t have helped them. If I hadn’t asked
| why they wanted the information, they could easily have progressed down
| a dead-end design. This sort of thing is NOT an isolated occurence.)
|
| -David

In qdn.public.qnxrtp.newuser Warren Peece <warren@nospam.com> wrote:

Thus endeth the apology.

Apology accepted. Thank you.

-David

David Gibs:
(e.g. recently someone was asking how QNX4 stty got the ioport information
for the serial port that it reports if you do an “stty -a < /dev/ser1”. I
replied that it sent a message to the serial port driver, then asked why
they needed this information. Turned out, they want to write something
that would deal with the serial hardware directly, and thought this would
be a general hardware query, not a query of a device driver that is already
running and controlling the hardware. I was able to direct them away from
using this message, as it wouldn’t have helped them. If I hadn’t asked
why they wanted the information, they could easily have progressed down
a dead-end design. This sort of thing is NOT an isolated occurence.)

Hi David.

in other words your an interactive styleguide 8}

actully thats something thats not to clear as yet,
is there an RTP StyleGuide allong the lines of the
amiga StyleGuide.

a simple ( i assume) this is how you write an RTP cli command
that interacts with the Photon GUI, I.E amiga RequestChoice
type simple cli based GUI builder, Some Phx people are doing this
command (they already did me a Requestfile) but i know that your
working on something rather special, and wondered if a StyleGuide
or article in qdn.public.articles might make a good base for the new
coders and interested partys to take onboard for future consistant
look&feel apps, if you see what i mean 8}

as a little project just for the fun and take in more tec, i`v
looked at PHAB and tryed to work out if i could interact with
any RTP cli command i might want to make a front end for, the wget
cli command for instance ?, how would i use PHAB to creat a free
standing GUI to binary cli command, can i ? (as a novice).


\

Paul May, Manchester, UK
Team Phoenix

In qdn.public.qnxrtp.devtools Ross Brantner <brantner@innernet.net> wrote:

Hello,

The answer to your question has been posted on qnx.public.qnxrtp.os.

Regards,

Marcin



I have some questions about RTP’s memory management.

  1. What is the page size being used?

  2. What is the logical address size ( I think how much memory can be
    addressed)?



    This is for a class project and I can’t figure out how to determine this
    from the os itself. Thanks.

Ross Brantner

Marcin Dzieciol
Technical Support
QNX Software Systems Ltd.
Email: <marcind@qnx.com>