Re: Threading ??? Shell Scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-06-27 at 11:57 -0700, Brian D. McGrew wrote:
> Is there any way to sort of make a shell script threaded???
> 
> Something like...
> 
> #!/bin/sh
> 
> Func1()
> {
> 	Param=$1
> }
> 
> Func2()
> {
> 	Param=$1
> }
> 
> Func1 test1 &
> Func2 test2 &
> Func1 test &
> 
> ???
> 
> I think I got the write concept but bad implementation???

Using '&' forks another process that runs independently.  Usually
when you say something is threaded you mean a single process where
all threads share the same memory.  With forked processes, the
memory is shared copy-on-write, meaning that each instance starts
will the same variable settings and open files but after the
fork any changes are local and cannot affect the other instances.
If they need to share information after the fork it must be done
through pre-arranged file descriptors or similar methods.

-- 
  Les Mikesell
   lesmikesell@xxxxxxxxx



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux