Answering questions one by one, although not necessarily in the same order:
Is pthread_t a data type similar to int or char , indicating that we are defining a thread? The compiler allocates pthread_t thread1 memory immediately after this sentence or waits until it finds a pthread_create() call
pthread_t is an int like type and is created when it is defined, and not when pthread_create called. In the fragment:
pthread_t tid; int x = pthread_create (&tid, blah, blah, blah);
this is the first line that creates the variable, although it does not contain anything useful before returning from pthread_create .
How long is pthread_t , 2 bytes or 4 bytes?
You care about how much space it takes, more than you need, how much space the FILE structure takes. You should just use the structure as intended. If you really want to know, then sizeof is your friend.
Any good info on how to set thread attributes?
If you want to use anything other than the default attributes, you must first create an attribute variable and then pass this to the pthread_create call.
Can we pass only one argument to the pthread_create function of the function? Can't we send 2 or 3 arguments to the pthread_create() function in the called thread?
As long as you are allowed to pass only one additional parameter to the stream, nothing prevents you from making this one parameter a pointer to a structure containing one hundred different things.
If you are looking for information on how to use pthreads, there is a lot of material at the end of the Google search, but I still prefer the dead-tree version:
