Question related to basics.m example


I’m quite new to multithreading concepts, therefore excuse me if these are all dumb questions.
After listing the basics.m code and the sample output, in the section called “Synchronization” the author discusses three cases, as follows: (I’ve only copied the starting sentence of each case, not the whole text. Kindly refer to the book for the actual discussion. The italicized text contain my questions.)

(1) threadFunction starts executing immediately. … (I think I understand this one.)

(2) threadFunction starts executing a little later, like at the top of the loop. … [Do I understand correctly from this point that the arguments passed to the pthread_create are not somehow “frozen” when the thread is created (by “created” I mean when the code path reaches pthread_create the first time), rather the arguments are the ones on the calling function’s stack when the thread is actually scheduled? (I might have follow up questions based on the answer to this.)]

(3) threadFunction starts executing a little later, in the middle of the loop. … (I didn’t understand this one… For one, the ThreadInfos array initialization had already been done before we started creating threads. I’m not able to imagine the situation where a thread gets half the data for one thread and half the data for another. Could someone explain this to me, assuming the author didn’t make a mistake. )

Thank you in advance!