# How to implement fork cocept in ruby

**URL:** <https://www.ruby-forum.com/t/how-to-implement-fork-cocept-in-ruby/189944>\
**Category:** Ruby\
**Created:** [June 10, 2010, 10:59am UTC](https://www.ruby-forum.com/t/how-to-implement-fork-cocept-in-ruby/189944 "2010-06-10T10:59:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucky1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d07c76/32.png) [@lucky1234](https://www.ruby-forum.com/u/lucky1234)\
**Post date:** [June 10, 2010, 10:59am UTC](https://www.ruby-forum.com/t/how-to-implement-fork-cocept-in-ruby/189944/1 "2010-06-10T10:59:09Z")

</div>

Hi,  
I need to implement fork concept in my application.  
I want to do the task1 and task2 at a time. need to start task1 and and  
task2  
at a time but task1 will complete within seconds .but task2 will will  
take time,it’s the long run process.so want to do this seperate  
process this will not interupt other process.  
So how can we implement fork in ruby

---

<div class="post-metadata">

**Author:** ![lucky1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d07c76/32.png) [@lucky1234](https://www.ruby-forum.com/u/lucky1234)\
**Post date:** [June 10, 2010, 11:41am UTC](https://www.ruby-forum.com/t/how-to-implement-fork-cocept-in-ruby/189944/2 "2010-06-10T11:41:37Z")

</div>

What appears to be the problem with the existing implementation of fork?

---

<div class="post-metadata">

**Author:** ![lucky1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/d07c76/32.png) [@lucky1234](https://www.ruby-forum.com/u/lucky1234)\
**Post date:** [June 10, 2010, 12:00pm UTC](https://www.ruby-forum.com/t/how-to-implement-fork-cocept-in-ruby/189944/3 "2010-06-10T12:00:21Z")

</div>

On Thu, 2010-06-10 at 17:59 +0900, Lucky Nl wrote:

> Hi,  
> I need to implement fork concept in my application.  
> I want to do the task1 and task2 at a time. need to start task1 and and  
> task2  
> at a time but task1 will complete within seconds .but task2 will will  
> take time,it’s the long run process.so want to do this seperate  
> process this will not interupt other process.  
> So how can we implement fork in ruby

I think you probably want to look at threading if your background job is  
written in Ruby, or IO.popen if it’s not. You can still do

pid = fork {  
… stuff …  
}

in Ruby, but it’s probably more complicated than you need. What is the  
background job you want to monitor / control?
