2

I have an assignment to modify the scheduler code for linux kernel and I am stuck at the first point in my assignment. I am unable to find which file the schedule() is implemented. I am a newbie and for sure I feel that there would be some structured way to find which specific files functions are in. Any help appriciated.

[EDIT] I have source of kernel version 3.5.4

Aman Deep Gautam
  • 8,091
  • 21
  • 74
  • 130
  • Might be useful: http://stackoverflow.com/q/3086864/274261 – ArjunShankar Oct 02 '12 at 08:19
  • Do u want to implement a new scheduling algo? or just switch to an already available kernel scheduler? – askmish Oct 02 '12 at 08:21
  • Actually the assignment is to implement lottery scheduling algorithm but I am stuck at this first place, unable to find `schedule()` function location. – Aman Deep Gautam Oct 02 '12 at 08:22
  • It should be in `kernel/sched.c` file. – askmish Oct 02 '12 at 08:28
  • @askmish That is what I was trying to find but I think that in version 3.5.4 there is no such file. There is one with the name `sched.h` but that would not do. Can you please see or give some pointers how to find it – Aman Deep Gautam Oct 02 '12 at 08:33
  • 1
    Then it should be at: kernel/sched/core.c Alternatively you could grep for schedule() in the linux directory. :) – askmish Oct 02 '12 at 08:48
  • 1
    despite of the answer to your specific question, a useful tool that you can use to inspect quickly the linux kernel code is: http://lxr.linux.no/+trees I found it really useful when I need to study the LKCF stack (Linux Kernel Cripto Framework) – sergico Oct 02 '12 at 09:17

3 Answers3

2

schedule() function is implemented in: linux/kernel/sched/core.c

if you want to learn more about process scheduling, ULK3 is probably perfect for you!

b3h3m0th
  • 1,330
  • 1
  • 11
  • 22
1

Actually I am new for linux kernel too. For navigation through linux kernel code I use:

  • cscope which is a good tool. There is a guide for using cscope with large projects such as linux kernel.
  • Online Linux Cross Reference. Especially the identifier search.
Alexey Shmalko
  • 3,678
  • 1
  • 19
  • 35
0

If you want to find some function name, you can use grep -r "schedule" in the root of source tree and if you have ctags you can navigate to his definition from any occurrence of his call.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253