Re: 3 Questions For You Code Masters! (LONG REPLY)
- Posted by "Carl R. White" <cyrek at BIGFOOT.COM> Jun 19, 2000
- 490 views
On Mon, 19 Jun 2000 05:14:33 GMT, Jason Leit <jasonleit at HOTMAIL.COM> wrote: >1. The minute I heard about Euphoria going to support Watcom C, I >downloaded it. It's a free legal version without the IDE but only the >command line tools. I also downloaded GNU tools when I found out, like >DJGPP. VC++ I allready owned. But what about the DOS extenders for >all these compilers? What's the idea on wich one the compiler will use, >and how will it use it? (does it ship with them?) I'm confused :( As far as I know, each of the compilers you mention has a 'preferred' DOS extender. With Watcom it's 'Causeway', hence some of the more serious errors in Euphoria (which itself is compiled with Watcom on the M$ platforms) being called 'Causeway errors'. Rob Craig is probably the foremost authority (on this list) on Causeway and its uses... DJGPP uses 'CWSDPMI', which is an acronym for something like "CWS Dos Protected Mode Interface". Many DJGPP programs (if not all) don't work without it. A good example of CWSDPMI usage is "Quake I"Later versions of VC++ don't allow compilation to the DOS mode platform (Microsoft are trying to drop the whole DOS thing), so they don't have a DOS extender any more. In the past it was probably an EMM386 interface. >2. How are sequences implemented to make them this fast? >I think dynamic link lists would be slower on the lookups, so I'm not sure >they are used. And realloc()ing new parts is slow.. and even if all these >were fast enough, how come the size of the members can change size >dynamically? Exactly how sequences are implemented is a reasonably closely guarded secret, since Rob C. likes the ability to change what's going on in the background from release to release. The bit that has been given away is how they get to be so fast... (Although Rob may have changed this...) Imagine the following code: sequence x, y, z x = {1, 2, 3} y = x At this point, there are only *3* numbers stored in memory, because y is made to point to *the*same*place* as x. No copying! y[2] = 7 Now things have changed. Euphoria can't change 'y' at the moment because 'y' points to 'x', so 'x' would change too. *Now* the sequence must be copied. The second element of the copy is changed and 'y' is made to point to it. There are now 6 numbers in memory. z = {y, y, y} There's still only six numbers in memory, because all the 'y's can point to the real 'y' in memory. z[2][2] = 5 We don't need to copy the whole of 'z' somewhere else this time because z[2] is a sequence not an atom. Instead, *z[2]* is copied somewhere else, the second element is changed to '5', and z[2] is made to point to the changed copy. z = {x, z[2], z[2], z[2]} Pop quiz: What do you think happens here?
>3. What's "Garbage Collection"? Let's go back to the code above and do this: z = y We know that makes x point at y's memory space, but what happens to the sequence from the Pop Quiz? It's still in memory, but nothing is pointing at it, so we don't need it any more. 'Garbage' like this, over time, fills up your machine's memory. 'Garbage collection' is what any good computer system does to free up this redundant memory space. A good *bad* example of GC is "Windows 9x" because you have to reboot it every now and again to clear out the garbage it misses with it's GC routines.
>I hope someone can asnwer these questions, maybe they are stupid and have >simple explenations... or maybe *I* am just stupid :) Nope. No. Niet. Nein. Non. Darn good questions if you ask me. And if you don't know something, you're not stupid. You just haven't been told something in the way you could understand it... ;o) Carl -- # Hey, Mr. Garbage Collector, slay a K for me, # # With a CWSDPMI for my... DJGPP. #