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 8095271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:04:15+00:00 2026-06-05T21:04:15+00:00

I spent a lot of time figuring out the function in the code level

  • 0

I spent a lot of time figuring out the function in the code level and I really got confused now.

First in the core.c, the function __schedule() or schedule() seem to be the most promising ones. Typically in __schedule(), I have found the code hrtick_clear(rq) which seems to be a timer. Then also in __schedule(), the function next = pick_next_task(rq) will be called which will try to find the next task to schedule. For the normal task, the CFS algorithm is used. So then I went into the fair.c file to check the pick_next_task_fair function. By tracking that function, I have seen the hrtick_start(rq, delta) has been called.

So obviously it seems that there is a timer based on hrtick is used to periodically activate the scheduling algorithm. But the strange thing is that in the core.c file, I really can not find how the timer is configured to call the __schedule() or schedule() periodically. I didn’t see that timer is configured to call this function.

Is there other function used? Can linux task scheduler expert give me a hint:>

  • 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-06-05T21:04:16+00:00Added an answer on June 5, 2026 at 9:04 pm

    Nothing special is needed. The timer just triggers an interrupt, and the interrupt logic already has to handle figuring out which task to run when you return from an interrupt. See, for example this code from entry_32.S which handles returning from an interrupt:

     358    ENTRY(resume_userspace)
     359        LOCKDEP_SYS_EXIT
     360        DISABLE_INTERRUPTS(CLBR_ANY)    # make sure we don't miss an interrupt
     361                                        # setting need_resched or sigpending
     362                                        # between sampling and the iret
     363        TRACE_IRQS_OFF
     364        movl TI_flags(%ebp), %ecx
     365        andl $_TIF_WORK_MASK, %ecx      # is there any work to be done on
     366                                        # int/exception return?
     367        jne work_pending
     368        jmp restore_all
     369    END(ret_from_exception)
     ...
     615    work_pending:
     616        testb $_TIF_NEED_RESCHED, %cl
     617        jz work_notifysig
     618     work_resched:
     619        call schedule
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I spent lot time figuring out a simple regex to return a group (only
I spent a lot of time to find out why my app crashed. My
I've spent a lot of time building out tests for my latest project, and
I've spent a lot of time trying to figure out what the each line
I spent the day experimenting with AWS for the first time. I've got an
I spent a lot of time trying to figure out a good way to
I spent a lot of time on this one and now I am stuck.
I spent a lot of time googling, now I'll try it here. Some of
I've spent a lot of time today trying to figure out how to get
I've spent a lot of time reading c tutorials and getting this code to

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.