Skip to Content.
Sympa Menu

k-user - Re: [K-user] Thread Matching

k-user AT lists.cs.illinois.edu

Subject: K-user mailing list

List archive

Re: [K-user] Thread Matching


Chronological Thread 
  • From: Omar Duhaiby <3omarz AT gmail.com>
  • To: Chris Hathhorn <chathhorn AT gmail.com>
  • Cc: Traian Șerbănuță <traian.serbanuta AT gmail.com>, "k-user AT cs.uiuc.edu" <k-user AT cs.uiuc.edu>
  • Subject: Re: [K-user] Thread Matching
  • Date: Tue, 13 May 2014 00:31:44 +0300
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/k-user/>
  • List-id: <k-user.cs.uiuc.edu>

I like this solution. It is very useful. Thanks for sharing it. I just have to tweak it a little to fit my problem.


On Tue, May 13, 2014 at 12:25 AM, Chris Hathhorn <chathhorn AT gmail.com> wrote:
Well, if you want to synchronize all threads with a certain group id,
you can do it by passing a token among the threads in that group. You
can use something like this to pass the token between threads with
consecutive ids:

rule
<k> join(GId:Int, TId:Int, (1 => 0)) ... </k>
<k> join(GId:Int, TId':Int, (0 => 1)) ...</k>
when TId +Int 1 ==Int TId'

You'll probably want to pass the token between the threads twice ("up
and down") -- the first pass you're doing the synchronization, and on
the second pass you know each thread has actually reached the
synchronization point.

Hope this helps -- I'm not sure it exactly relates to your situation,
but I suspect you'll probably need to do something similar.

Chris


On Mon, May 12, 2014 at 4:14 PM, Omar Duhaiby <3omarz AT gmail.com> wrote:
> Could you please elaborate on that? I couldn't understand what you mean by
> low ids and high ids, and what is up and down? Do you mean a tree of
> threads?
>
>
> On Mon, May 12, 2014 at 11:55 PM, Chris Hathhorn <chathhorn AT gmail.com>
> wrote:
>>
>> FWIW, I've done this before by passing a "token" up and down the
>> threads I wanted to synchronize (from low ids to high ids and back
>> again). You match the threads two at a time to pass the token, and
>> when the token comes back down, every thread knows the other threads
>> have reached the synchronization point.
>>
>> Chris
>>
>> On Mon, May 12, 2014 at 3:47 PM, Omar Duhaiby <3omarz AT gmail.com> wrote:
>> > That is a good idea but I need to delete only the threads which have
>> > <parentId> ManagerId </parentId>
>> >
>> >
>> > On Mon, May 12, 2014 at 10:31 PM, Traian Florin Şerbănuţă
>> > <traian.serbanuta AT fmi.unibuc.ro> wrote:
>> >>
>> >> The simplest way to achieve this would be to have a special cell
>> >> wrapping
>> >> all threads in question.
>> >>
>> >> Then, you can write a rule like:
>> >>
>> >>   rule <threads>
>> >>            <thread>...
>> >>             <k> parallelThreadManager(0) => V ...</k>
>> >>             <tid> ManagerId </tid>
>> >>         ...</thread>
>> >>           (_ => .)
>> >>         </threads>
>> >>
>> >> not sure whether you can rethink your configuration this way, whough.
>> >>
>> >> 2014-05-12 16:26 GMT+03:00 Omar Duhaiby <3omarz AT gmail.com>:
>> >>>
>> >>> I have parallel sibling threads assigned to a parent thread by a cell
>> >>> called "parentId". I want anyone of them to match and the rest to be
>> >>> deleted. I did this:
>> >>>
>> >>>     rule <thread>...
>> >>>             <k> parallelThreadManager(0) => V ...</k>
>> >>>             <tid> ManagerId </tid>
>> >>>         ...</thread>
>> >>>         (<thread>...
>> >>>             <k> V:Val </k>
>> >>>             <parentId> ManagerId </parentId>
>> >>>         ...</thread> => .)
>> >>>         (<thread>...
>> >>>             <parentId> ManagerId </parentId>
>> >>>         ...</thread> => . )
>> >>>
>> >>>
>> >>> The last bit of the rule should delete other threads, but it only
>> >>> deletes
>> >>> one such thread. I need it to delete ALL such threads. How can I do
>> >>> that?
>> >>>
>> >>> _______________________________________________
>> >>> k-user mailing list
>> >>> k-user AT cs.uiuc.edu
>> >>> http://lists.cs.uiuc.edu/mailman/listinfo/k-user
>> >>>
>> >>
>> >
>> >
>> > _______________________________________________
>> > k-user mailing list
>> > k-user AT cs.uiuc.edu
>> > http://lists.cs.uiuc.edu/mailman/listinfo/k-user
>> >
>
>




Archive powered by MHonArc 2.6.16.

Top of Page