Skip to main content

A worker dispatcher with multiprocessing and multithreading.

Project description

Module burncpu is a worker dispatcher with multiprocessing and multithreading.


  • All CPU cores can be used.
  • Workers can be stopped gracefully by system signals.
  • Pure python code.


Use the following command to run the sample module.

python3 -m burncpu.sample

Then monitor CPU status, some changes take place at these time.

Time Events
0s All CPU cores are IDLE.
10s Workers begin to call one_second_task many times.
60s Workers begin to terminate.

Pressing Ctrl+C or sending system signal can also terminate the sample.

Finally copy and modify the source code to make your own.


To import

from burncpu.dispatcher import WorkerDispatcher

class WorkerDispatcher

WorkerDispatcher.__init__(worker_count=0, use_core=0, time_limit=0)

Create a dispatcher instace.

How many threads would be created, 0 means to create (use_core * 2) threads.
How many cores would be use, 0 means all cores.
Stop workers after given seconds. Running functions still run at that moment. Queued functions would be cancled.

WorkerDispatcher.dispatch(func, args)

Dispatch a function to one of workers randomly.

Function to call.
Argument list of this function.


Sleep dispatcher for given seconds.

Seconds to sleep. Dispatcher would not sleep given seconds actually. It sleep many times during given seconds, so that system signal (e.g. Ctrl+C) can be handled.


Wait until all workers stopped.


Check if the dispatcher is alive.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for burncpu, version 0.0.16
Filename, size File type Python version Upload date Hashes
Filename, size burncpu-0.0.16-py3-none-any.whl (3.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page