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 6049287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:33:32+00:00 2026-05-23T07:33:32+00:00

I have some questions about pthreads in linux: Is it the case that pthread_t

  • 0

I have some questions about pthreads in linux:

  1. Is it the case that pthread_t is it a datatype similar to int and char indicating we are defining a thread?
  2. If so, how much size does it take? 2 bytes or 4 bytes?
  3. Does the compiler allocate memory to pthread_t thread1 immediately after that statement or does it wait until it a pthread_create() call?
  4. How does one set the thread attributes, and what is their typical use?
  5. Can one only pass more than one argument in the pthread_create() call? If so, how?

I have lots of things on my mind like this. Please also feel free to suggest any good sites or documents to read.

  • 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-05-23T07:33:33+00:00Added an answer on May 23, 2026 at 7:33 am

    Answering the questions one by one, though not necessarily in the same order:

    Is pthread_t a data type similar to int or char, indicating we are defining a thread ? Does the compiler allocate memory to pthread_t thread1 immediately after that sentence or does it wait until it finds the pthread_create() call

    pthread_t is a type similar to int and it’s created when you define it, not when you call pthread_create. In the snippet:

    pthread_t tid;
    int x = pthread_create (&tid, blah, blah, blah);
    

    it’s the first line that creates the variable, although it doesn’t hold anything useful until the return from pthread_create.

    How much size does a pthread_t take, 2 bytes or 4 bytes?

    You shouldn’t care how much space it takes, any more than you should care how much space is taken by a FILE structure. You should just use the structure as intended. If you really want to know, then sizeof is your friend.

    Any good information about how to set the thread attributes?

    If you want to use anything other than default attributes, you have to create an attributes variable first and then pass that to the pthread_create call.

    Can we only pass one argument in the pthread_create function to the function? Can’t we send 2 or 3 arguments in the pthread_create() function to the called thread?

    While you’re only allowed to pass one extra parameter to the thread , there’s nothing stopping you from making this one parameter a pointer to a structure holding a hundred different things.


    If you’re looking for information on how to use pthreads, there’s plenty of stuff at the end of a Google search but I still prefer the dead-tree version myself:

    PThreads programming book, ISBN 13: 978-1-56592-115-3, ISBN 10: 1-56592-115-1

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

Sidebar

Related Questions

I have some questions about basic CSS that I was unable to understand or
I have some questions about IIS application pool configuration. I know that idleTimeout specifies
I have some questions about android ui api. Give a example, that I want
I have some questions about some things in Asp.net MVC that still confuses me.
I have some questions about customers about NF mode for DB2. Google had very
I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
I have some questions about logging, more specifically about setting it up and making
I have some questions about Perl's map function. Specifically: How does %hash = map
I have some questions about partitioning and strategy, how and when to use it.
i have some questions about constructors in ColdFusion : must i use the name

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.