On Thu, Dec 29, 2016 at 11:32 AM, scott Ford <idfli...@gmail.com> wrote:
> Guys, > > Then if one was writing a multi-threaded C or C++ application in a MVS > address space is it considered TCBs for each thread ? > > Scott > > Assuming you are using the pthread_create() function to do threading, then the answer is "Most likely". POSIX has three types of threads: light, medium, and heavy weight. In z/OS UNIX, I don't see a way to make a "lightweight" thread. A medium weight thread is dispatch on a particular TCB, but when the thread terminates, the TCB can be reused for a new thread. A heavy weight thread terminates the TCB when thread terminates. At least, that is how I am reading the documentation. In any case, at least for medium & heavy threads, the thread runs on a single, specific, TCB for its entire life. Ref: http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxb100/ptc.htm <quote> Handling MVS tasks and threads: Each thread that is created with pthread_create runs as an MVS subtask of the initial pthread-creating task (IPT). The IPT is the task that issued the first pthread_create call within the address space. Note: The IPT is not the same as the pthread-creating task initialization routine. The IPT refers to the task that the first thread runs on, whereas the pthread-creating task initialization routine is the routine given control when a pthread_create is done. When all the threads created with pthread_create and the IPT have ended, the next task in the address space to issue a pthread_create call is made the IPT. </quote> Note that a thread has more "structures" associated with it than if you used the historic ATTACHX to start a new subtask. It's a bit more like the way that PL/I did it in the past. With ATTACHX, the TCB attached is a subtask of the original TCB. If, in turn, code on the new TCB does an ATTACHX, the newest TCB is a subtask of that TCB - in a "tree" structure. With POSIX threads, the first TCB to do a pthread_create() is called the IPT thread and _all other threads_ (see above) are "owned" by this thread. That is, there is not a "tree" of threads, just a "pile of" threads [grin/]. -- Heisenberg may have been here. http://xkcd.com/1770/ Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN