Welcome, Guest. Please login or register.

Author Topic: What does PURE mean in startup assigns?  (Read 3029 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline lurkistTopic starter

  • Hero Member
  • *****
  • Join Date: Sep 2002
  • Posts: 513
    • Show only replies by lurkist
What does PURE mean in startup assigns?
« on: March 03, 2007, 07:17:17 PM »
What does that switch do?

Cheers
A1200 Power Tower, Blizzard 1260 66 +32MB, OS3.9, 2.5\\" HD, IDEfix97 + DVD-RW + Zip, SD/FF + 15\\" CRT, Ioblix1200P + scanner, PCMCIA LAN + router
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: What does PURE mean in startup assigns?
« Reply #1 on: March 03, 2007, 07:41:18 PM »
There is no PURE in assigns.

You probably mean PURE/S in resident command. This "forces" the command to be considered pure, even if the 'P' protection bit is not set.
 

Offline mel_zoom

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: What does PURE mean in startup assigns?
« Reply #2 on: March 03, 2007, 08:00:02 PM »
So, what is the "PURE" flag actually used for? I know that some commands complain they cant be made resident in the shell unless you use this.

Does that mean they arent really supposed to be made resident?
I love my MX5!
Please pay a visit
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: What does PURE mean in startup assigns?
« Reply #3 on: March 03, 2007, 08:02:15 PM »
Do not ever use PURE unless you know for a fact that the command really is pure.

Using the PURE option on impure commands will lead to disasterous results.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline mel_zoom

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: What does PURE mean in startup assigns?
« Reply #4 on: March 03, 2007, 08:05:54 PM »
So what qualifies a pure or impure command? Is it something about the way they were written?
I love my MX5!
Please pay a visit
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: What does PURE mean in startup assigns?
« Reply #5 on: March 03, 2007, 08:12:46 PM »
@mel_zoomy

Yes they must be written and/or assembled and/or compiled a certain way.

Since you are coding C... which compiler are you using?

Technically a pure program must place ALL global variables in allocated memory or on the stack.  For example local variables go on the stack in C so they are 100% pure.  But normal variables just go into regular memory and that is impure.  But if you do an AllocMem() and store the vars in that memory then that is pure.

PURE means that the code can be executed multiple times simultaneously.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: What does PURE mean in startup assigns?
« Reply #6 on: March 03, 2007, 08:18:08 PM »
Slight correction there: You don't need to AllocMem your variables for the program to be pure. You can also use stack (local variables). Pure apps can't use globals/static data.
 

Offline lurkistTopic starter

  • Hero Member
  • *****
  • Join Date: Sep 2002
  • Posts: 513
    • Show only replies by lurkist
Re: What does PURE mean in startup assigns?
« Reply #7 on: March 03, 2007, 08:22:46 PM »
Quote

Piru wrote:
You probably mean PURE/S in resident command.


Sorry, yes that's exactly what I meant.

@thread - oops, I've tried all sorts of other apps as resident using the PURE switch, so far all the continents of Earth are still in place (last time I checked at least).

So give us some examples of programs which are PURE.  (And some which are definitely IMPURE!)
A1200 Power Tower, Blizzard 1260 66 +32MB, OS3.9, 2.5\\" HD, IDEfix97 + DVD-RW + Zip, SD/FF + 15\\" CRT, Ioblix1200P + scanner, PCMCIA LAN + router
 

Offline mel_zoom

  • Full Member
  • ***
  • Join Date: Jan 2007
  • Posts: 231
    • Show only replies by mel_zoom
Re: What does PURE mean in startup assigns?
« Reply #8 on: March 03, 2007, 08:25:18 PM »
Piru:

"Pure apps can't use globals/static data."

I thought all C string literals were basically static though? If that is true does it mean you can use global and static data provided it is constant?
I love my MX5!
Please pay a visit
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: What does PURE mean in startup assigns?
« Reply #9 on: March 03, 2007, 08:26:12 PM »
In C you don't need to AllocMem() any vars or use the stack to create a pure exe.  You just need to compile and link with the proper pure options and the compiler takes care of everything for you.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: What does PURE mean in startup assigns?
« Reply #10 on: March 03, 2007, 08:32:30 PM »
@lurkist

Just run 1 of those apps twice at the same time and the contents of the entire Amiga universe running on your machine will be displaced in a firey cataclysmic crash.  Well it was nice to have known you. Please write your will and leave all your Amigas to me before you try it.  Thanx.  :-D
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline ChaosLord

  • Hero Member
  • *****
  • Join Date: Nov 2003
  • Posts: 2608
    • Show only replies by ChaosLord
    • http://totalchaoseng.dbv.pl/news.php
Re: What does PURE mean in startup assigns?
« Reply #11 on: March 03, 2007, 08:35:01 PM »
@mel

Yes you can use constants any way you want and still be pure.
That is why I said "variables".  You are only limited regarding data which is writeable.
Wanna try a wonderfull strategy game with lots of handdrawn anims,
Magic Spells and Monsters, Incredible playability and lastability,
English speech, etc. Total Chaos AGA
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: What does PURE mean in startup assigns?
« Reply #12 on: March 03, 2007, 08:40:39 PM »
Yeah static const is ok.

Anyway, as pointed out some compilers can do the magic for you even if you use globals. But in that case the compiler will have some magic code there in startup that allocates and duplicates any static data for each instance of the application.

Today - with fast HDDs - creating pure apps isn't really required.
 

Offline falemagn

  • Sr. Member
  • ****
  • Join Date: May 2002
  • Posts: 269
    • Show only replies by falemagn
    • http://www.aros.org/
Re: What does PURE mean in startup assigns?
« Reply #13 on: March 03, 2007, 09:11:33 PM »
Quote

Piru wrote:
Yeah static const is ok.


To be more precise, any const data, be it static or not, is ok, as long as it's not put in the BSS section.

Quote

Today - with fast HDDs - creating pure apps isn't really required.


Pure executables are also about saving memory, as you don't have to load the TEXT part of the program more than once in memory, much like libraries.

Indeed, libraries are pure executables by force.
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: What does PURE mean in startup assigns?
« Reply #14 on: March 03, 2007, 10:16:07 PM »
Quote
To be more precise, any const data, be it static or not, is ok, as long as it's not put in the BSS section.

Well naturally. That "static const" was about the specific case when static is ok.

Quote
Pure executables are also about saving memory, as you don't have to load the TEXT part of the program more than once in memory, much like libraries.

True. However, residents also waste memory. If the particular program is not running, it still sits in the memory eating chunk of memory for nothing.

In fact, not many programs really run simultanously often enough to justify being resident in memory.

The most benefit from resident commands comes with slow media (floppies, cd-rom etc).