Page 1 of 3
OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 7:57 am
by AlexHully
Hi,
The question will be short : could a OS exist without timers?
I mean, no need for cron, watchdogs, tickless kernel.
No timers at all.
Is it a stupid idea to implement?
Bye
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 8:11 am
by iansjack
I guess it could, but I see little point in the exercise.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 8:48 am
by AlexHully
To me, the interest is forcing the event driven OS, with no timer interfering. You need something ? it has to be from hardware or coming from an external input (http..). Otherwise, no service.
It sounds very appealing, not talking about the complexity of such an OS : much simpler. Scheduler : much simpler (tickless).
Overall : simpler/faster.
But we keep the rdtsc (serialized) instruction close. Because it is always useful. As slow as it may be, we don't really care anymore.
In my opinion.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 9:05 am
by bluemoon
While you can definitely implement cron and watchdog with a tickless kernel, however, who want a computer that can't even tell you time of day?
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 9:07 am
by Kevin
Doesn't an event come from the hardware when it signals an expired timer?
Also, if you really were to write an OS without any timers, how would you implement something as simple as a clock in the user interface?
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 9:16 am
by xenos
With no timer at all nothing software will wait forever it it is waiting for an event, and no event ever comes. I guess it would be annoying if an application would wait forever (or at least until the user intervenes) for some hung up piece of hardware, instead of just retrying or aborting the request after some timeout.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 9:49 am
by AlexHully
1) time of day: timestamp counter (rdtsc assembly)
2) Software with no timer: why would an application decide to do an action when the user had to do something in the first place? Just put it on idle and wait for the user to come back.
3) Events are not tied to a timer. They can use it.
xenOS: could you expand further please?
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 9:52 am
by iansjack
Kevin wrote:Also, if you really were to write an OS without any timers, how would you implement something as simple as a clock in the user interface?
Simple. Just use a RTC chip. Reading it can be purely a user-space process with no support needed for it in the OS.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:02 am
by AlexHully
Ianjack, do you agree that constant TSC is ok too? (Intel cpu)
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:08 am
by DavidCooper
The "operating system" of our brains comes close to being an OS with no timers, though there's still a timer of a sort in that it takes a certain amount of time to complete a task, so you can use task completions as ticks of a very inaccurate clock - sometimes you may think you've been working for something for an hour, but when you look at a clock you find that you've been absorbed in the task for three or four hours. If you're trying to multitask, perhaps writing something at the same time as you're doing some cooking, your timings may be way out and you might burn your tea, but you can muddle through. An operating system on a computer could do the same thing, making lots of mistakes and having to redo things. It's much better though to have some kind of timer running and a system to set off alarms to stop the task that is currently running for a moment in order to deal with some other task that's going to go wrong if something isn't done in a hurry.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:12 am
by Kevin
iansjack wrote:Kevin wrote:Also, if you really were to write an OS without any timers, how would you implement something as simple as a clock in the user interface?
Simple. Just use a RTC chip. Reading it can be purely a user-space process with no support needed for it in the OS.
I assume that you just mean reading the current time, because using the RTC IRQ would mean using a timer. If so, that's good enough for implementing something like a "date" command, but for a permanently displayed clock, how do you know when to update the displayed time?
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:28 am
by AlexHully
Good point Kevin.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:34 am
by Muazzam
AlexHully wrote:
The question will be short : could a OS exist without timers ?
Is it a stupid idea to implement ?
Can you clarify the reason, why are you using an extra space before a question mark?
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 10:47 am
by AlexHully
A question mark counts as a word.
Re: OS with no timers.. at all ?
Posted: Tue Jul 21, 2015 11:06 am
by Brendan
Hi,
AlexHully wrote:The question will be short : could a OS exist without timers ?
Yes, an OS can exist without timers.
For each thing where timers are normally used, you either find an alternative (e.g. use a performance monitoring counter setup to measure "instructions retired" to determine when the currently running task has used enough CPU time, which I actually think is superior anyway), or refuse to support it (e.g. if the OS never supports TCP/IP then you won't need timers for TCP/IP time-outs).
Of course just because an OS without timers can exist, doesn't mean that it'd be good - you'd probably have to refuse to support so much (networking, animation, games, a lot of device drivers, etc) that the OS would suck.
Kevin wrote:Doesn't an event come from the hardware when it signals an expired timer?
Also, if you really were to write an OS without any timers, how would you implement something as simple as a clock in the user interface?
Let's define "counter" as something that keeps track of time that can't notify you (e.g. with an IRQ) when a certain amount of time has passed; and "timer" as something that can notify you when a certain amount of time has passed.
If the OS only uses counters and doesn't use timers; it can display "time of day", etc.
If the OS polls a counter regularly and does things when a certain amount of time has passed, then the OS has implemented a timer in software; and in that case the OS is using a timer (it's just not using a hardware timer).
Cheers,
Brendan