Re: Callin tcl procs in parallel
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: Callin tcl procs in parallel

From: Gerald W. Lester <Gerald.Lester@cox.net>
Date: Thu Jun 30 2005 - 05:35:09 CEST

Rush wrote:
> This is my first attempt to creat a Tcl script and would like to get
> some information from the group.
> I am just writting a wrapper which calls a proc from another tcl script
> and passes some parameters to it. The proc that I am calling remains
> same and only the argument changes. proc that i m calling only takes
> one argument at time and than runs for a long time. I have to wait for
> it to finish up and then pass the next argument.
> is there anyway by which i can call this proc multiple times
> pararllely? something like multi threaded code?
>

First off why does the called proc "run for a long time"?

1) If it is CPU bound (i.e. doing a computation) then doing them in
parrallel will only help if you have multiple CPUs.

2) If it is I/O bound, switch to using event driven I/O and do them in
parrallel.

3) If it is waiting on an external application, this is a special case of
(2) -- see that point.

4) If it is waiting on a database (e.g. Oracle) you can try either async
calls or using subproceses -- you may find this slows down your application
since you may now have lock contention.

-- 
+--------------------------------+---------------------------------------+
| Gerald W. Lester               | "The man who fights for his ideals is |
| Gerald.Lester@cox.net          |  the man who is alive." -- Cervantes  |
+--------------------------------+---------------------------------------+
Received on Thu Sep 29 14:23:56 2005