Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5947399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:57:31+00:00 2026-05-22T16:57:31+00:00

When I read through the GHC Wiki commentary on the scheduler I was confused

  • 0

When I read through the GHC Wiki commentary on the scheduler I was confused about this section:

One reason behind marking a Capability
as free when it is handed over is to
support fast callouts. When making a
safe foreign call we have to release
the Capability, and therefore hand it
over to another worker thread. If the
foreign call is short, we don’t want
to incur the cost of a context switch
on returning, but since we marked the
Capability as free there’s a good
chance the returning Task will be able
to re-acquire it immediately and
continue. The worker that we woke up
will find that the Capability is
owned, and go back to sleep again
(this may incur a double context
switch if there are no free CPUs on
which to run the worker, however).

My question:
For the bold sentence, what indeed will lead to the “Double context switch”, with or without marking a capability as free. Furthermore, what are the two “switches” if they happen — from who1 to who2, then who2 to who3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:57:32+00:00Added an answer on May 22, 2026 at 4:57 pm

    Partially answered here: http://www.haskell.org/pipermail/cvs-ghc/2011-May/062287.html (a copy: http://markmail.org/message/2q6fjthw2wvof244?q=switch+list:org.haskell.cvs-ghc&page=2)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read through several questions similar to this one before posting, but did not
I've read through a few questions about this here on s.o. and none seem
I have read through this SO question about 32-bits, but what about 64-bit numbers?
I read through the related questions and didn't find my answer. This isn't about
I've read through this post about disposing of datasets and I still have a
I read through this very interesting q/a about how computers reboot , and although
I read through many post on Stackoverflow about this problem, but I can't seem
I read through various threads like this one for example. But it really escapes
I've read through similar errors however I'm confused as to how to avoid this
I read through many of solutions of this problem already, but I still can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.