Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:29:19+00:00 2026-06-07T00:29:19+00:00

I am trying to understand the stack allocation of pthreads library in Linux. Here

  • 0

I am trying to understand the stack allocation of pthreads library in Linux. Here are few questions:

A) What is main thread ? – Is that the thread running C main() program?

B) How much is stack allocation of main threads? Is that the ulimit -s size ?

C) How much is stack allocation of sub-threads? Is that the ulimit -s size ?

D) The stack size of main thread and other threads are dependent ?

E) The process stack and thread stack are shared? How do I decide process stack (say a.out) size.

F) Does these information vary between NPTL and LinuxThreads implementation?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:29:20+00:00Added an answer on June 7, 2026 at 12:29 am

    A: Yes
    B: Yes
    C: Maybe.

    If pthread_attr_t used at thread creation did not specify stack size, and if ulimit -s is not unlimited, then ulimit -s will determine the stack size of a newly created thread.

    D: Question is unclear. They are not dependent on each other, but they do both depend on ulimit -s under certain conditions.

    E. Yes and no. They are shared in the sense of memory visibility — the main thread can read and write other thread’s stack variables, and vice versa. But each thread executes on its own stack, and if ever two threads started to execute on the same stack, that would be a disaster.

    F. No.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how stack allocation and alignment works with pthreads on
I'm trying to better understand what the stack trace means. I have a two
I'm trying to understand the space requirements for a Mergesort, O(n). I see that
Dear SQL Gurus from Stack Overflow: Environment: Oracle I'm trying to understand why I
I am trying to understand how memory space is allocated for a C program.
I'm trying to understand the algorithm described here , but the explanation really isn't
I am new to Windbg and trying to understand a few things about value
I am trying to better understand how the stack and heap work. I have
I'm trying to understand the memory usage of a program I maintain. I've realised
I'm currently trying to understand how the stack works, so I've decided teach myself

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.