Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-05-2009, 11:45 PM   #1
LQ Newbie
Registered: Aug 2006
Location: India
Distribution: suse,mandriva
Posts: 24

Rep: Reputation: 15
Initial stack allocation size of 4K bytes

I created a posix thread, the default stack allocated by the thread is 4K size but my thread is quite light in weight and 2K bytes of stack is more than enough for me, how can i acheive this?

Can i modify the stack allocated by system to a thread?
Old 04-06-2009, 12:03 AM   #2
Senior Member
Registered: Jul 2005
Distribution: Slackware
Posts: 2,014

Rep: Reputation: 115Reputation: 115
look at pthread_attr_setstacksize(). Although, it's really best to leave it at 4K, that's exactly one linux page.
Old 04-06-2009, 02:08 AM   #3
LQ Newbie
Registered: Aug 2006
Location: India
Distribution: suse,mandriva
Posts: 24

Original Poster
Rep: Reputation: 15
So if linux minimum page size is 4K even if i force the thread attributes to 2K of stack it will still result in 4k... Am i correct?

I have to minimize the stack as i am using embedded 2K means a lot for me...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
does logrotate set size to 1048576 bytes by default if no size is specified? finebanana Red Hat 0 01-22-2009 01:10 AM
dynamic mem allocation, how to change heap size? parv Programming 8 01-20-2008 12:51 AM
allocation problem [static stack storage] kranti Programming 1 10-18-2005 10:10 AM
C++ programs initial stack size. uncle_kevin Programming 1 07-05-2004 02:35 PM
Partition size allocation problem Supraj Linux - Newbie 3 08-08-2001 03:36 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration