LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

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


Hi,
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-05-2009, 11:03 PM   #2
tuxdev
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, 01:08 AM   #3
kingraja84
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 linux..so 2K means a lot for me...
 
  


Reply


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 12:10 AM
dynamic mem allocation, how to change heap size? parv Programming 8 01-19-2008 11:51 PM
allocation problem [static stack storage] kranti Programming 1 10-18-2005 09:10 AM
C++ programs initial stack size. uncle_kevin Programming 1 07-05-2004 01:35 PM
Partition size allocation problem Supraj Linux - Newbie 3 08-08-2001 02:36 AM


All times are GMT -5. The time now is 07:30 PM.

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