Hi Henry, I have seen the Glossary entries. I agree with you that understanding the meaning of the words will go a long way. I might not be expressing myself clearly. Please bear with me. In the context of threading what are these things? _____ 'keyword', Do I assign it? Is it always 'worker'? What is 'keyword' made up of? Is 'keyword' a box? What is its shape? What does it look like in a completed sentence? _____ Why would I introduce the 'worker' keyword? _____
What is the criteria for work that can be done in parallel? (As an aside, on T. Under heading Threadpools, it mentions parallelizable primitives. Which are those primitives?) _____ pyx1 =. block1verb t. '' block1args So where u t.'' n y is block1verb = u block1args = n So, a pxy is the solution to a threaded operation? _____ pyx012 =. blockverb t. ''"0 block0args;block1args;block2args... How are threads allocated? In part I am thinking here about building for performance. If am understanding, this will depend on the structure of the operation. I reference the [fun with threads] posts Starting Tue Apr 12 10:11:15. _____ Thank you. Ak On Tue., Dec. 20, 2022, 10:52 Henry Rich, <henryhr...@gmail.com> wrote: > Your questions 'what is...' are answered by > https://code.jsoftware.com/wiki/Vocabulary/Glossary and if any are > missing, report that fact and I'll add them. I think once you > understand what the words mean most of your questions will be answered; > please re-ask anything that is still unclear. > A 'keyword' is a string that carries a special meaning. The meaning of > the 'worker' keyword is given where that keyword is introduced. > Your 'three basic models' can be implemented with J threads but I don't > see them as basic. The J pyx model is basic. > > You use threads where you see blocks of work that can be run in > parallel. The blocks need to be big enough to be worth the overhead of > starting a task and moving the parameters/result to and fromillisecond > millisecond of work . A might be big enough and a dozen > milliseconds almost surely. >> >> >> >> > When you have identified those blocks, you start them as tasks using (u > t. n). You could write > > pyx0 =. block0verb t. '' block0args > pyx1 =. block1verb t. '' block1args > pyx2 =. block2verb t. '' block2args > etc. > > or, if the blockverbs are the same, you could use > > pyx012 =. blockverb t. ''"0 block0args;block1args;block2args... > > Sometime later, when you need the results, you look inside the pyx. > That's all there is to it! The results are always there! (of course, > what is happening is that your program is blocked until the task has > finished.) > > Henry Rich > > > On 12/20/2022 12:13 PM, Ak O 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 > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm