in reply to multiple threads with different "timers"

Is there a way to run independent timers without one persistent thread for each?

What I do in a somewhat similar situation is to have a timer interrupt every 1 or 2 seconds. The handler for that event (or signal) processes a list looking for work to do. In your case the list might be a hash with period and function entries where period would be how often to start the thread (when time % period is equal to 0, possibly taking into account the potential for missed events) and where function is the function to start the thread. Presumably you could have more entries in the hash including args to the function.

In my application in addition to period I put in the absolute time to start the function and use that instead of the period directly. Then if I miss a tick the start time is earlier than the clock so the routine needs to be started. I update the start time entry (by adding the period to the start time or current time) before actually calling the function.

HTH, --traveler