[lkml]   [2003]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRE: [lkml] RE: self piping and context switching

> More specifically, I was wondering if the write to the pipe or
> the call back
> into poll involved anything that might prompt the scheduler to replace the
> thread in this scenario.

Sure, it could, but there's no particular reason to expect it to. The one
exception would be if another thread was already blocked waiting for that
particular pipe. In this case, your sending data on the pipe would unblock
that thread, which could trigger a pre-emption.

> > It's reasonable to expect that this will be the most common case and the
> > one to optimize. It is unreasonable to fail if this doesn't
> > happen, since
> > it's not guaranteed to happen. Note that if by "without a
> > context switch"
> > you really mean without another thread getting a chance to run,
> > then it is
> > totally unreasonable.

> Are you referring to transitions to/from kernel space? If so, wouldn't the
> write
> on the pipe and the call to poll both result in transitions?

Yes, but there's no reason that transition should cause the kernel to want
to change processes. The kernel generally tries to let processes complete
their timeslice. An exception could certainly be if the write to the pipe
causes a new thread to unblock and that that thread has a higher dynamic
priority (which it well might, since it was waiting).

Personally, I don't think the kernel should ever pre-empt threads/processes
with equivalent static priorities, but that's another whole argument. ;)


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:48    [W:0.051 / U:5.496 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site