Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
147 user(s) are online (106 user(s) are browsing Forums)

Members: 2
Guests: 145

sailor, Mozzerfan, more...

Support us!

Headlines

 
  Register To Post  

Reliability of stack program (or why stack for program too big)
Quite a regular
Quite a regular


See User information
Hello,

If I use program like scout or stacksnoop (triton+68k), I can see verry big stack used by programs (on the task list) and just few stack really used when the program run on the system.

In fact most of the workbench original programs from AOS use 65ko of stack on the scout.


- Scout or another stack reporter program report really the good number of stack used by all the program on AOS4.1 ???

- Why big stack for all WB programs used on AOS4 ???


NOTE: This is strange to see a big program like dopus4 use just 8ko and contextmenu used 65 ko !!!

A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT
SAM440EP on Mapower 3000+AOS4.1

Amiga Docs Disk Preservation Project
Go to top
Re: Reliability of stack program (or why stack for program too big)
Amigans Defender
Amigans Defender


See User information
@Mrodfr
You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.

Come to think of it, I should probably document this fact in my Modern Amiga Programming article.

It is best to never nitpick about stack size in AmigaOS. Give it plenty of room and always use a stack cookie in your programs.

ExecSG Team Lead
Go to top
Re: Reliability of stack program (or why stack for program too big)
Amigans Defender
Amigans Defender


See User information
@ssolie

Quote:

always use a stack cookie in your programs.

How do you do that?

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: Reliability of stack program (or why stack for program too big)
Quite a regular
Quite a regular


See User information
Something like "static const char * __attribute__((used)) stackcookie = "$STACK: 100000"

Go to top
Re: Reliability of stack program (or why stack for program too big)
Amigans Defender
Amigans Defender


See User information
@Thematic

OK. Will the stack cookie add to the stack size set in the icon, or replace it?

The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Go to top
Re: Reliability of stack program (or why stack for program too big)
Quite a regular
Quite a regular


See User information
@trixie

No adding, the greater stands.

Go to top
Re: Reliability of stack program (or why stack for program too big)
Quite a regular
Quite a regular


See User information
@Mrodfr

here's my shell startup

$VERShell-Startup 52.1 (15.12.2006)

Prompt "%N.%S> "
Stack 1111111
Alias Clear 
"Echo NOLINE *"*E[0;0H*E[J*" "
Alias Cls Clear
Alias XCopy 
"Copy CLONE "
Alias Italic "Echo NOLINE *"*E[3m*""
Alias Bold "Echo NOLINE *"*E[1m*""
Alias Normal "Echo NOLINE *"*E[0m*""
Alias Underline "Echo NOLINE *"*E[4m*""


So it's ready for anything whether that is mencoder, flac, gcc or similair... well, generally it is

Yes, I prefer to use the shell than some gui probably because I do alot of my own batch files

~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
Go to top
Re: Reliability of stack program (or why stack for program too big)
Not too shy to talk
Not too shy to talk


See User information
@Slayer

This shell-statup does not look as if you often use the shell.

Here is one which makes some work a bit easier:

set echo off
set _mchar 
"||"
set _pchar "|"
prompt "*e[0;32m%s*e[0m*n%n> "
stack 100000
alias x     endcli
alias 
exit  endcli
alias cls   
echo "*ec" noline
alias ren   rename
alias del   delete
alias md    makedir
alias cd
..  cd /
alias ex    execute
alias st    status full
alias res   resident
alias lc    run 
>nillimpidclock restart
alias ed    run 
>niled []
alias sn    search s:serien []
alias mv    run >nilmultiview >con:80/80/300/100/MultiView/AUTO/CLOSE/WAIT []
alias cc    execute s:cc []
alias say   rx "numeric digits 14; pi = 3.14159265358979323846; e = 2.7182818284590452354; say []"
alias find  list all lformat=%p%n p=[]
alias ascii rx "do i=0 to 255 by 32; l = ''; if i >= 32 & i < 128 | i >= 160 then do j=0 to 31; l = l || d2c(i+j); end; say l; end"
alias ppaint run >nilppaint:ppaint
alias touch  setdate
alias ccmake dmake
alias address   rx 
"options results; address []"
alias hdtoolbox run >nilhdtoolbox
alias snoopdos  run 
>nilsnoopdos
alias playcdda  copy to audio
:b/16/c/2/f/44100 []
alias cleanram  delete ram:~(env|clipboards|t|disk.infoall force quiet
;alias picshow   share:sources/picshow/picshow
;alias thumb     share:sources/picshow/thumb

Go to top
Re: Reliability of stack program (or why stack for program too big)
Quite a regular
Quite a regular


See User information
@ssolie

Quote:

You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.

Come to think of it, I should probably document this fact in my Modern Amiga Programming article.

It is best to never nitpick about stack size in AmigaOS. Give it plenty of room and always use a stack cookie in your programs.



A hidden stack on AOS4 secure program with GUI if the programmer put less than 60ko of stack on his code source of his program.

You recommend 80ko on the code source of the program (example code on one of the previous thread).


- And for the stack on the Icon ? (become not usefull at all).

- This advice also true for shell program or for shell program ported fom linux ?

A1200+Mediator+VooDoo3+060/50+96mo+IIYAMA 17"+CD,CDRW,ZIP SCSI-KIT
SAM440EP on Mapower 3000+AOS4.1

Amiga Docs Disk Preservation Project
Go to top
Re: Reliability of stack program (or why stack for program too big)
Home away from home
Home away from home


See User information
@Mrodfr



Quote:


- And for the stack on the Icon ? (become not usefull at all).


The stack can still be increased by setting a higher value in the icon, never decreased, the higher value is always used. This is still useful if say a developer sets a stack cookie but underestimates the programs needs. Or for programs contain recursive code where a some situations will use greater stack. AWeb for example can use a lot of stack for deeply nested tables, but for the majority of cases doesn't need it.

Quote:

- This advice also true for shell program or for shell program ported fom linux ?


Shell programs will often need less stack, but will still be given at least the stack set in DOS prefs. I've found it best to set this to 70 / 80 k. Really with the amount of memory available on a modern 'amiga' worry about wastage is a waste of effort, compared with the extra stability gained by not taking risks with marginal stacks.

Linux ports typical use very big stacks, as the memory usage patterns for linux programs are quite different from a typical native amiga app, and they make big allocations on the stack. Changing that would typically make the port very hard to maintain, so is generally not done.

With blender I did reduce the stack required by some timeing tasks which were originally inheriting the big main stack required for the render / gui loops but these were special cases.

Go to top
Re: Reliability of stack program (or why stack for program too big)
Amigans Defender
Amigans Defender


See User information
@trixie
Quote:
How do you do that?

The code to do this is explained in the Processes section of my article so please read that first.

You can verify whether it is working or not using my Ranger tool. Look in the DOS/Processes tab and click on the running process. If a stack cookie is present the "Min:" amount of stack will display that value.

The stack cookie sets up the minimum amount of stack. Icons, the shell's stack setting, DOS prefs and the programmer can also change the size of the stack. The thing to remember is that DOS will always choose the largest of all the stack settings for maximum safety.

ExecSG Team Lead
Go to top
Re: Reliability of stack program (or why stack for program too big)
Just can't stay away
Just can't stay away


See User information
@ssolie

Quote:
You need to have at least 60k of stack or so for any program using a GUI. If you don't, one will be provided for you via a hidden stack swap which will slow your program down slightly. I recommend setting a stack cookie at about 80k for anything with a GUI to avoid the implicit stack swapping in Intuition.

That's something new to me. Thanks telling it. Do this automatic stack swapping exist in the current public Intuition or in newer (beta) versions ?

Rock lobster bit me - so I'm here forever
X1000 + AmigaOS 4.1 FE
"Anyone can build a fast CPU. The trick is to build a fast system." - Seymour Cray
Go to top
Re: Reliability of stack program (or why stack for program too big)
Amigans Defender
Amigans Defender


See User information
@TSK
The Intuition stack swapping feature has been there since 4.0. Some BOOPSI classes use similar stack swapping code.

Just set the stack on your GUI apps to something reasonable like 80k or higher for maximum responsiveness.

ExecSG Team Lead
Go to top
Re: Reliability of stack program (or why stack for program too big)
Home away from home
Home away from home


See User information
@ssolie

Is there any reasson why just not set 1mb of stack for every programm by default (in aos4 kernel code) ? Then everyone will forget about it at all.

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Reliability of stack program (or why stack for program too big)
Just popping in
Just popping in


See User information
@kas1e
Even 1M is way too much for 95% of programs, but still not enough for 1%. And I'm sure the users on classic machines with only 64M total will love booting their WB to see 3M free :)

What would actually be helpful for developers, is for the OS team and library coders to recommend a minimum stack usage per API: if you use bsd sockets then your app needs minimum stack of 38K, if you use minigl then you need at least 72K, whatever. The code which uses the stack is not always known or knowable to the person setting an application stack size, and testing can't always reveal the worst case depth.

Automatic stack enlargement is stil the holy grail, and hopefully AOS can migrate into 64-bit address space to make that happen.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project