[Poll] Stack size

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply

What's your stack size?

max or less than 8 kB
13
59%
max. 16 kB
4
18%
max. 32 kB
1
5%
max. 64 kB
3
14%
max. 128 kB
0
No votes
max or more than 256 kB
1
5%
 
Total votes: 22

User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

[Poll] Stack size

Post by inflater »

Hey,
how big is stack in your OS? I ran into severe problems as mine kernel switches to real mode (APM, some useful bios functions etc) and I had to keep the stack under 640kB. Maybe it's enough you say, but loading SS at e.g. 0x5F and ESP to 0 (very close to CPU vectors BTW) as the stack grows downwards, works, but there are nasty errors like your OS wouldn't work on MS VPC 2007 but it would on Bochs. I've met personally with this. :evil: Or e.g. self-rewriting code: on VMware and VPC my OS wouldn't work with some commands, but Bochs worked flawlessly... so I've created at least 20 combinations of SS:ESP, which then had unexpected results. You e.g. can't set SS to 0 and ESP to 0xFFFF (resulting in 32 kB stack size, from 0xffff to 0x7C00) if your kernel is switching to real mode, here's why: 0xF000 and neighbours are ROM BIOS functions :roll:.

So I've got really mad and put TIMES 16*1024 DB 0 right in the beginning of the exe kernel, which works.

My question is: what's your stack size? Is 16 kB enough?
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Re: [Poll] Stack size

Post by mathematician »

Unless you are writing something like a recursive descent parser, or storing an awful lot of data on the stack, I would think 16kb is plenty.
The continuous image of a connected set is connected.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: [Poll] Stack size

Post by bewing »

My stacks are all 1K, and I never use more than 300 bytes of them. But I'm not planning on implementing a recursive descent parser in my kernel, either. :wink:
User avatar
Adek336
Member
Member
Posts: 129
Joined: Thu May 12, 2005 11:00 pm
Location: Kabaty, Warszawa
Contact:

Re: [Poll] Stack size

Post by Adek336 »

I've got 64 kbs... so that I am always totally sure that (unless an inifite recursion occurred) a problem isn't stack related ;)
ChristianF
Member
Member
Posts: 79
Joined: Sun Jun 10, 2007 11:36 am

Re: [Poll] Stack size

Post by ChristianF »

My Stack has a size of 16 KB and I got no problems :D
42
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: [Poll] Stack size

Post by Combuster »

kernel stacks are currently 3K. Basically, one page with the thread's info subtracted from it.

I even used 256b stacks without problems :)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply