[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variables in yyparse

From: Hans Aberg
Subject: Re: variables in yyparse
Date: Mon, 20 Dec 2004 00:54:38 +0100
User-agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6

On 2004/12/19 23:32, Laurence Finston at address@hidden wrote:

>>> From: Hans Aberg <address@hidden>
>> All new computers, personal and up, use virtual memory. Then the OS will do
>> exactly the same thing for you, but automatically.
> According to my understanding, virtual memory and paging allow a process to
> have an address space much larger than the actual main memory available to
> that process.  However, dynamic memory allocation takes place on the heap,
> which is of fixed size.  So these are "two different pairs of shoes", as we
> say in German.

UNIX divides the process memory into three sections, code, data and stack,
and all of them are paged. And none of them need not be in contiguus RAM.
(See Graham Grass, "UNIX for programmers and users", the section on memory
management.) (This explains the C/C++ complicated array rules, because the
upper limit of a semiopen array may not be a valid memory address.)

> I think this code:
> for (;;)
> new int;
> will eventually cause a `bad_alloc' to be thrown, but will not cause pages to
> be written to files.  No C++ on this machine, so I can't test it.

So all memory behaves paged, and the system can put it where it wants, in
RAM or on disk. Then the system, depending on which OS it is, can set
certain limits, such as by the setrlimit and ulimit system calls. (See Evi
Nemeth et. al., "UNIX system administration handbook".)

Then evidently both MS Windows and Mac later OS have a Mach kernel,
extending UNIX, at the bottom. So all later PC's that have these later OS's
should be able to do this paging.

  Hans Aberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]