What triggers Fiber.unpark?
Arkadiusz Gasiński
jigga at jigga.pl
Thu Oct 17 21:04:29 UTC 2019
Hey Chris,
Thanks again!
I just had to stare long enough at this stack trace from the 7m mark of
Alan’s presentation to get that it’s that fiber/thread that unlocks the
lock that also re-submits the waiting fiber/thread for execution.
Arek
On Thu, 17 Oct 2019 at 22:12, Chris Plummer <chris.plummer at oracle.com>
wrote:
> Hi Arek,
>
> Look at the 7m mark of the video for an example of what happens when
> java.util.concurrent.locks.ReentrantLock.unlock() is called, triggering
> the unpark of a Fiber waiting on that lock. It's the holder of the lock
> that triggers the unpark (and this case it was another fiber holding the
> lock). So yes, totally different than how the I/O case is handled.
>
> Chris
>
> On 10/17/19 12:45 PM, Arkadiusz Gasiński wrote:
> > Awesome, thanks!
> >
> > I think that this YT video link is enough of a record (no pun intended
> > on the records JEP ;))
> >
> > Also, I assume that this is only for I/O, right? If a Fiber is waiting
> > for a lock, it's a different entity that triggers unparking?
> >
> > Thanks,
> > Arek
> >
> > On Thu, Oct 17, 2019, 21:33 Chris Plummer <chris.plummer at oracle.com
> > <mailto:chris.plummer at oracle.com>> wrote:
> >
> > On 10/17/19 12:53 AM, Alan Bateman wrote:
> > > On 16/10/2019 21:58, Arkadiusz Gasiński wrote:
> > >> Just noticed that the previous question in the mailing list was
> > >> pretty much
> > >> the same (what a coincidence) and actually checked your talk
> > from JVMLS,
> > >> @Alan. I’m still wondering what’s calling this InnocuousThread
> > that
> > >> in turn
> > >> unpark Fiber? Also, is this thread used for all Fiber unparking or
> > >> only in
> > >> case of I/O?
> > >>
> > > sun.nio.ch.Poller is probably what you want. The `polled` method is
> > > invoked when a file descriptor is ready and it unparks the fiber
> > that
> > > is parked waiting on that file descriptor.
> > >
> > > -Alan
> > This part of the video shows the stack when the poll completes and
> > the
> > fiber is unparked:
> >
> > https://youtu.be/NV46KFV1m-4?t=509
> >
> > Maybe Alan can copy-n-paste the stack trace from the presentation
> > here
> > for the record.
> >
> > Note this is on macos, which uses KQueuePoller. On linux is uses
> > EPollPoller. Poller.startPollerThread() is where the
> > InnocuousThread is
> > created:
> >
> > Thread t = JLA.executeOnCarrierThread(() ->
> > InnocuousThread.newSystemThread(name, poller));
> >
> > And the above code is triggered from the Poller static initializer.
> >
> > Chris
> >
>
>
>
More information about the loom-dev
mailing list