[coyotos-dev] Sleep for interval
Charles Landau
clandau at macslab.com
Fri Sep 28 16:56:06 EDT 2007
At 12:24 PM -0400 9/28/07, Jonathan S. Shapiro wrote:
>On Tue, 2007-09-25 at 11:43 -0700, Charles Landau wrote:
>> >In contrast to all other kernel capabilities, which are always
>> >receiving, the definition of the sleep object is that it will remain in
>> >a non-receiving state until the invoker's specified interval has run
>> >out. This has three consequences:
>> >
>> > 1. Sleep always happens to the invoker. Process A cannot place process
> > > B onto a kernel sleep queue.
>>
>> So the sleep object cannot be accurately proxied, which is
>> unfortunate. If you later did decide to implement this outside the
>> kernel, you could not do so compatibly.
>
>Hmm. This is technically true, but I think that it may not matter.
>
>The difference in behavior is this:
>
> 1. In the kernel case, the invoker appears blocked attempting to
> invoke.
> 2. In the emulator case, the invoker succeeds, but then remains
> in the receiving state until the response.
I think it's worse. If you will allow me to describe the scenario in
KeyKOS/CapROS terms, since I may not be current on the latest
iteration of Coyotos IPC:
Process A forks the sleep capability, passing as the last key
parameter a resume key to Process B. In the kernel case, A blocks. In
the emulator case, A doesn't block (at least not for long, assuming
the emulator is responsive). I thought this was what you meant when
you said "Process A cannot place process B onto a kernel sleep queue".
> > At 1:57 PM -0700 9/14/07, Charles Landau wrote:
>> >Another notion is system-up time. I can say "sleep until the
>> >system has run for at least 5 seconds". This might be useful for
>> >timeouts of other programs.
>>
>> This request might be difficult to fulfill if it is not supported in
>> the kernel.
>>
>> I'm suggesting you give the sleeper the choice of (1) waking up after
>> x seconds of uptime, or (2) waking up after x seconds or restart
>> whichever occurs first. Note that uptime gets rolled back on a
>> restart.
>
>The "sleep until uptime exceeds X" case does not need to be implemented
>by the kernel. It can be implemented by a user-mode agent if the kernel
>will disclose the start tick value.
>
>I am certainly not opposed to this function. In fact, I think it's a
>good idea. I just don't see that the kernel needs to implement it
>directly.
I'm not sure what the "start tick value" is (I thought you started at
zero), but I agree there are things the kernel can do that will allow
a user to synthesize this function. It just doesn't seem that hard to
do in the kernel, and it allows more programs to be oblivious to
restarts.
More information about the coyotos-dev
mailing list