Hi

I would like to create a daemon python process in windows which will spawn 8 processes out. Whenever, there is a job, it will be pushed to the queue and the job will be run. If the full 8 processes are been utilised, then the jobs will remain in the queue for their turn.

My question is

1) How do I create such a daemon program in python such that it will be clean and good, and wun hog down any resources unncessary

2) My idea of pushing the job into the queue is for the daemon program to keep polling a file. If there's a new job, it will be written in the file. Once the daemon program read the file and finds a new entry, it will be push to the queue for it to be executed. Somehow, I feel that this method is not very good as keep polling means that I will keep hogging resources. Would you all have any ideas which will be bettter?

Thanks!

Recommended Answers

I am not so sure about interprocess communication alternatives, but I do not think OSes take much penalty for repeatedly checking when one file was last written to.

Jump to Post

All 4 Replies

I am not so sure about interprocess communication alternatives, but I do not think OSes take much penalty for repeatedly checking when one file was last written to.

For creating the daemon without it eating you, check http://pypi.python.org/pypi/python-daemon

python-daemon is for unix/linux. Daemons are very different in linux and windows (where they are called services).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.