OS with no timers.. at all ?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

OS with no timers.. at all ?

Post 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
Last edited by AlexHully on Wed Jul 22, 2015 2:35 pm, edited 2 times in total.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: OS with no timers.. at all ?

Post by iansjack »

I guess it could, but I see little point in the exercise.
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

Re: OS with no timers.. at all ?

Post 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.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: OS with no timers.. at all ?

Post 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?
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: OS with no timers.. at all ?

Post 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?
Developer of tyndur - community OS of Lowlevel (German)
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: OS with no timers.. at all ?

Post 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.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

Re: OS with no timers.. at all ?

Post 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?
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: OS with no timers.. at all ?

Post 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.
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

Re: OS with no timers.. at all ?

Post by AlexHully »

Ianjack, do you agree that constant TSC is ok too? (Intel cpu)
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: OS with no timers.. at all ?

Post 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.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: OS with no timers.. at all ?

Post 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?
Developer of tyndur - community OS of Lowlevel (German)
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

Re: OS with no timers.. at all ?

Post by AlexHully »

Good point Kevin.
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: OS with no timers.. at all ?

Post 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?
AlexHully
Member
Member
Posts: 62
Joined: Mon Jul 20, 2015 3:32 pm

Re: OS with no timers.. at all ?

Post by AlexHully »

A question mark counts as a word.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: OS with no timers.. at all ?

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply