Hi Ak, That's a lot of questions. I, too, would like to better understand pyxs.
In the meantime, here are some things I've written up on multithreading: https://code.jsoftware.com/wiki/NYCJUG/2022-05-10#Trying_to_Multithread, https://code.jsoftware.com/wiki/NYCJUG/2022-07-12#Multi-threaded_Photo_Flipping, and https://code.jsoftware.com/wiki/NYCJUG/2022-08-09#A_New_Multi-threading_Project . It looks like I'm using the "Manager Model" in these exercises. Good luck! Devon On Tue, Dec 20, 2022 at 12:13 PM Ak O <akin...@gmail.com> wrote: > I hope you are all well. Thank you for your hard work on this subject. > > I am having difficulty understanding how to correctly apply the T. and t. > (tcapdot/tdot) Primitives based on the vocabulary documentation pages. > > > The concept of threading is new to me. The documentation pages (T./t.) use > many terms that I am unclear on. > > I appreciate your efforts to explain them. Thank you for your help. > > > Ak. > > > > Vocabulary_tdot Page > > > Reading from the Vocabulary documentation page tdot (at indentation). > > > i. t. ''"0 i. 5 > ++-+---+-----+-------+ > > ||0|0 1|0 1 2|0 1 2 3| > ++-+---+-----+-------+ > > In the context of threading, what is this statement meant to characterize? > Is there a sentence of the form ,'execute some operation in some distinct > thread (having thread attribute(s)..).'? > > [x] u t. n y runs ([x] <@:u y) in an idle thread and returns its > result, which is a pyx. A pyx is a special box. It looks like an atomic box > and can be used like any other box. When the pyx is opened, the opening > thread will block until the value is available. If the creation of the pyx > ended in error, that error will be signaled when the pyx is opened. > > > What is: > ->the purpose of a 'pyx'? > Where does a 'pyx' fit into the threading concept? > What is: > ->thread? > ->idle thread? > How is a thread identified? > > > The n argument to t. controls execution of the task. The format is > > [[<]important parameters][,< keyword[;value]]... > The important parameters are: [threadpool#] > > What is: > -> a task? > -> important parameters? > -> [threadpool#] > -> threadpool > -> i. t.(0;('worker'))"_1 i.5 > > > threadpool# indicates which threadpool the task should be assigned to. > > How is a threadpool assigned? > How is a threadpool identified? > > > Threads are assigned to threadpools when they are created. > > How are assigned threadpools identified for created threads? > > > By default, threadpool 0 is used. > > What is the equivalent representation for this statement (i.e [x] u t. n y > runs ([x] <@:u y))? > > > One keyword has been defined. > > What is a 'keyword' (conceptually and type)? > Is it predefined? > > The worker keyword controls whether the task should be executed in the > originating thread if there is no waiting thread for it to run in. > > How does the keyword control the task executing thread? > > > u t. 'worker' > u t. (<'worker') > u t. ('worker';1) > > What differentiates these forms? > Is it always 'worker' a standin? > A few words on cases where one form might be chosen instead of another. > > > > ---> > Reference questions > > In trying to understand how to build threading structures (threaded > program), three basic models are given: > (https://hpc-tutorials.llnl.gov/posix/designing_threaded_programs) > Quote: > Several common models for threaded programs exist: > > Manager/worker: a single thread, the manager assigns work to other > threads, the workers. > Typically, the manager handles all input and parcels out work to the > other > tasks. At least two forms of the manager/worker model are common: > static > worker pool and dynamic worker pool. > > Pipeline: a task is broken into a series of suboperations, each of > which is handled > in series, but concurrently, by a different thread. An automobile > assembly > line best describes this model. > > Peer: similar to the manager/worker model, but after the main > thread creates other > threads, it participates in the work. > > Can you please show or diagram the J primitives used to compose the three > models? > > > ---> > > > - - - Please give a Primitives translation from C to J under the Creating > Pthreads heading, Reference Source (https://randu.org/tutorials/threads/). > - - - > > - - - Please give a Primitives translation from C to J under the Pthreads > Attributes heading, Reference Source (https://randu.org/tutorials/threads/ > ). > - - > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > -- Devon McCormick, CFA Quantitative Consultant ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm