In the following program, what are the possibilities for the ordering of threads? Assuming \"function\" will print thread id which is unique (since here we have only one process
I don't think there will be any specific ordering. Threads on the modern machines are executed in parallel and its not deterministic which thread's print statements will get executed first !
The only ordering constraint that can be assumed is that thread 2 will come before thread 1 because of second pthread_join