Jon Flanders' Blog

Interesting (or perhaps not) WWF threading tibit

Saturday, September 17, 2005 7:53:36 PM (GMT Daylight Time, UTC+01:00)

When you call WorkflowRuntime.StartWorkflow - the workflow itself is started from one of the CLR thread pool threads (this is done via the Runtime's ThreadingService - this is what the default threading service does).

What this means is that a running workflow will *not* keep a process alive - since the the CLR thread pool threads have IsBackground set to true.  Even the DefaultThreadingService's thread (it uses one thread to cycle over any workitems it has in its internal queue - any workflows that need executed) won't keep the process alive.

On a threading related note - please don't assume (just like in BizTalk) that the parrallel activity spawns multiple threads - it doesn't.  There is a scheduler inside of the workflowruntime that will schedule execution of activities instead of each parrallel branch in parrallel - but not on multiple threads (each contained activity is queued).  So the execution of each branch happens in parrallel  - but not on multiple threads - each branch has its first activity executed first before the scheduler executes the second activity and so on.

WWF   #    Comments [2]   

Saturday, September 24, 2005 1:10:46 PM (GMT Daylight Time, UTC+01:00)
Very interesting! Does this mean, that I cannot use the disgner to sync two threads running different workflows, but have to write my own mechanisms? Or put differently: can there be only one workflow per service in the designer? I would be very happy to hear some more on these issues. Thanks, Torsten
Thursday, September 29, 2005 6:56:40 PM (GMT Daylight Time, UTC+01:00)
If you had two workflows and you need to synchronize between them - yes I beleive you'd have to write your own threading service to enforce that - outside of what you could do with inter-workflow communication.
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview