Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: forth and v...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 13 Topic 4024 of 4053
Post > Topic >>

Re: forth and virtual memory

by anton@[EMAIL PROTECTED] (Anton Ertl) Apr 30, 2008 at 12:49 PM

Thomas Pornin <pornin@[EMAIL PROTECTED]
> writes:
>Filling a file from a virtual memory view also often leads to high
>filesystem fragmentation, unless you preallocate the complete file,
>which is almost invariably a waste of space on a non-dedicated system.

Writing a file with mmap() is more complex than reading a file with
mmap(); IIRC you have to specify the file length in advance with
truncate() or ftruncate(), so in some sense you do pre-allocate the
complete file (although on many OSs (f)truncate() alone creates a
sparse file, which does not need much space).

Also, reading a file with mmap() can save a lot of overhead compared
to read() (one copying of the data) or, worse, fread() (two copyings
of the data).  But the mmap() advantage is not so pronounced when
writing, because in that case the OS typically writes to disk anyway,
and the copying is cheap compared to that.

>When the programmer uses a
>strongly-typed programming language, it becomes possible for the
>operating system (or virtual machine implementation) to actually _move_
>objects in RAM dynamically to better fit the access patterns. This is a
>feature of modern Garbage Collectors and is applicable only if the GC
>precisely knows which data element is a pointer and which is not

That's a nice dream, but in the real world I have yet to see a case
where that effect outweighs the overhead of copying garbage
collection.

>If simply using mmap() is 2006-programming, then improved cache
>coherency through an object-moving GC must be from year 2015, at least.
>Strangely enough, Sun Microsystems has sold the idea at industrial
>levels for the last decade (under the name "Java").

Yes, and it's not known as a champion of high performance.

Another Java myth I have read is that the JIT results in faster code
than possible with static compilation, because:

1) It knows exactly which CPU it is compiling for, whereas a static
compiler typically generates code that runs on all CPUs and does not
run too badly on any of them (and maybe even optimized for a different
one than you have).

2) It knows how the program is used at run-time and can optimize for
that usage, and adapt to changing usage patterns.

Yet, these advantages do not seem to outweigh the overheads of JIT
ompilation.  AFAIK Andrew Haley is still working on static Java
compilation.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2008:
http://www.complang.tuwien.ac.at/anton/euroforth/ef08.html




 13 Posts in Topic:
forth and virtual memory
gavino <gavcomedy@[EMA  2008-04-28 12:12:05 
Re: forth and virtual memory
Thomas Pornin <pornin@  2008-04-28 20:21:13 
Re: forth and virtual memory
anton@[EMAIL PROTECTED]   2008-04-30 12:49:08 
Re: forth and virtual memory
Thomas Pornin <pornin@  2008-04-30 15:39:34 
Re: forth and virtual memory
anton@[EMAIL PROTECTED]   2008-05-01 20:55:28 
Re: forth and virtual memory
Thomas Pornin <pornin@  2008-05-01 23:39:16 
Re: forth and virtual memory
anton@[EMAIL PROTECTED]   2008-05-02 16:11:42 
Re: forth and virtual memory
Thomas Pornin <pornin@  2008-05-02 20:51:07 
Re: forth and virtual memory
Andrew Haley <andrew29  2008-04-30 10:46:28 
Re: forth and virtual memory
anton@[EMAIL PROTECTED]   2008-05-01 20:45:43 
Re: forth and virtual memory
Andrew Haley <andrew29  2008-05-02 04:22:48 
Re: forth and virtual memory
gavino <gavcomedy@[EMA  2008-04-28 15:00:41 
Re: forth and virtual memory
gavino <gavcomedy@[EMA  2008-04-28 15:08:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 10:18:53 CDT 2008.