How does scheduling work?

1

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?

Timothy

Posted 2013-01-22T11:29:09.290

Reputation: 533

http://en.wikipedia.org/wiki/Cron#Multi-user_capability – Tamara Wijsman – 2013-01-22T11:37:13.567

Answers

2

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.

Journeyman Geek

Posted 2013-01-22T11:29:09.290

Reputation: 119 122

Hmm, then I guess it does wake up every minute to check if there are any commands or scripts to run. – Timothy – 2013-01-22T14:12:42.017