Skip to content
/ worker Public

A simple c++ program to help parallelize jobs in for example shell scripts

Notifications You must be signed in to change notification settings

benreh/worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

	Copyright 2010 Benjamin Reh <ich@benjaminreh.de>

	This file is part of 'Worker'.

    'Worker' is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation version 3 of the License.

    'Worker' is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with 'Worker'.  If not, see <http://www.gnu.org/licenses/>.


Example usage
=============

Let's take a look at the following shell code snippet:

#!/bin/bash
for i in 1 2 3 4 5
do
	sleep 1;
done

normally it takes 5 seconds for this loop to run.

If we add the 'worker' by changing it to 

#!/bin/bash
for i in 1 2 3 4 5
do
	worker sleep 1;
done

on a machine that has for example two processors/cores, the loop
takes 2 seconds to finish. First 1 and 2 run simultaneously, then 3
and 4. The loop exits while job 5 is still running.

In some cases this is an unwanted side-effect and you want to wait for
all jobs to have finished. In that case you can add a 'worker --join'
at the end. The whole code now takes 3 seconds to run.

ATTENTION:
This program is in a very experimental stage.
That means it worked on two of my computers.

I'm still busy making it available for everyone else.

Benjamin Reh
www.benjaminreh.de

About

A simple c++ program to help parallelize jobs in for example shell scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published