How do programs designed for scheduling (e.g. Task Scheduler in Windows, cron in Unix systems) know that it "is time" for them to run a certain scheduled command or script?

I imagine it's not something like a timed function checking the system clock every second or minute. Is there some kind of trigger being activated when a time stamp corresponding to a certain planned task is reached?


This probably varies between OSes. For cron, the crond manpage indicates that there's a daemon running in the background which activates itself every minute to check if there's a task that needs to be run.

Windows also has a service that does this according to this support page, though I have no idea of its granularity. Its likely it works similarly.

  • Hmm, then I guess it does wake up every minute to check if there are any commands or scripts to run. – Timothy Jan 22 '13 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.