Liste des Groupes | Revenir à ca embedded |
Don Y <blockedofcourse@foo.invalid> wrote:You asked: "What OS?" The OS doesn't matter. Rather, howIt matters. OS kernel should implement something simple, but enoughThat is confusing formulation of the problem. First, what is>
"the OS"?
Doesn't matter. The question is about how one should EXPECT an OS
to handle such things.
to support higher layers. At higher layers you may have something
more fancy.
A library function or a *service*.I take this and what you write later that you think aboutIf by "the OS" you mean operating system kernel, then you want>
it as simple as possible and move various functions to upper
layers. In particular, in general purpose OS you may have
timers which activate a task some time after scheduled time
(hopefully close to scheduled time, but there is no warranty).
Maybe you are thinking of such a timer.
I am thinking one layer above that, in terms of abstraction.
Imagine some concurrent agency "watching the clock" and
taking action on your request to make something happen at a
particular time. *YOU* may be busy with something else.
library interface for "applications".
Correct.You can not solve _all_ scheduling problems. It does notHowever, there may be higher level "scheduler". For example>
Unix 'cron' and 'at' are userspace programs, but are considered
part of operating system. 'cron' and 'at' are rather crude,
if you may need more. In particular, an automations system
typically must schedule various activities with specific time
constraints.
>
Anyway, your system probably is intended to do something useful
and that will lead to some requirements. Once you have more
concerte requirements, you can think how to best satisfy them.
If you have only handful of time-dependent tasks and each
differs a lot from other, then putting all higher level
time handling in the tasks may be reasonable. But usually
it pays to have common handling. As George mentioned there
can be interdependencies between task, so it is likely that
you may need a higher level scheduler to coordinate them.
My contention is that said service can't possibly know of all
of the interdependencies that could exist (examples provided
in other posts). So, let the service focus on a single criteria:
the time at which you desire the action to occur.
mean that you should not solve some. Windows style interfaceYou should only solve those that are commonplace -- and, only
where you have a lot of specific cases and can not do anythingThe "constraints" would then have to be available/accessible
else than provided choices does not look attractive to me.
OTOH 'constraint language' to specify various constraints
(which may be combined in arbitrary ways) could go quite
far. There is also time-honored approach of allowing "user"
extentions (possibly up to replacing "standard" scheduler).
The code doesn't even have to be malicious. I'm sure everyoneConsider, however, that the service may be displaced by some higherAgain, this is question of design of your OS and your requirements.
priority tasks executing on its hardware. So, it can't guarantee
that it ever *sees* the specific time you've specified; other
tasks may have preempted it. So, expecting to hit a specific
time is wishful thinking.
If you have badly behaving third party code, then it may be hard to
give any warranty.
But if you have need and apropriate resurcesYes. Or, the developer may have "noticed" (or expected)
then there are ways to get real-time behaviour (that is hitting
specified time window). Even if you do not have real-time
motivation, I think that time windows (as opposed to discrete
events) appear frequently. For example, you want to turn on
a device during night tariff.
Anyway, if you can not give reasonable warranties for timeNo. It means you care MORE about other things.
when your scheduler runs, then it means that you do not care.
By extention, you do not care when scheduled tasks run.Exactly. Baking that into the OS is wrong. It should
Which may be fine for some purposes and in such case simplistic
handling which you propose may be good enough.
When you wrote your original post, I had someting different in
mind. Not so long ago I looked at one of home automation
system. I searched for some specific info and one of first
things that I found was a discussion about scheduling interface
in the system. A user wanted simply looking thing "if washing
machine is idle for some specified time, then turn its power off".
System allowed specifying conditions which caused some actions.
But there were limitations on what could be put as a condition,
and in effect correctly specifingt needed thing was rather
awkward.
In *one* sense of the term. A service can operate at anOut-of-kernel does not mean unprivileged.But kernel>
timers frequently are "volatile", that is they will be gone
when system is turned on again (if that is undesirable, then
higher level layer may restore timers that were supposed to
persist). AFAIK general purpose kernels handled timers
as you argue, that is dully activated corresponding task.
OTOH long delays were usually delegated to userspace which
could have complicated rules.
You have to assume these are unprivileged (out-of-kernel)
tasks -- because you don't want to bring more code *into*
the kernel.
Tasks may haveExactly. Everything in my world is capability based.
special rights which other tasks do not have. For example
one may allow elevated scheduling priority only to system
tasks. Even otherwise unprivileged task may be special
because it provides "well-known" interface to other tasks.
The app has to declare what it wasn't to be able to accessSo, I argue that a simple criteria be adopted and the writer ofFor me important question is "who is the master?". Do you allow
the task requesting the scheduling (and the task being scheduled)
address their own specific criteria IN EXPLICIT CODE to enforce
these, instead of hoping some other service can be made aware of
these requirements (by embelishing that service? by including
support fr up-calls to the task doing the scheduling??)
>
The "scheduler" can then just focus on ensuring each event gets
processed exactly once and at a time NO EARLIER than the time
specified. This is much easier for a developer to wrap his head
around than trying to second-guess the scheduler ("What if the
scheduler is blocked for some period of time? How will *it*
handle things when NOW is later than it *could* have been -- or,
when there are MANY competing things in the queue?")
third-party code to play any tricks it wants.
Or do you giveUsers can schedule some activities/actions through a "user accessible
control to the user. As a simple example, task may decide to
do some work at night, presumably to avoid interference with
user work. But a user may prefer to work at night, say on a
specific day. So user may wish to delay execution of the task.
If you want to empower users, then central facility is
proferable, as this is easier to control than separate tasks.
I have my own bias, I want computers to do what I want. ForYes. Hence the "SLEEP" option in the start menu.
expample, when I make a break I prefer to have some special
combination of keys to put system to sleep _immediately_.
When I work, I may think for longish time, and systems thatThat requires adjusting the sleep interval. I often leave
go to sleep based on "inactivity" distract me (especially
when I am trying to understand a text or a picture on the
screen and the screen goes blank).
Les messages affichés proviennent d'usenet.