akry
akry

Reputation: 645

preemption in FreeBSD

I am now looking for a piece of source code which treats about kernel preemption in FreeBSD.

In Linux kernel, there is a c-source file called "sched.c" in which set_current_state() macro is used to set the state of process (TASK_RUNNING, TASK_INTERRUPTIBLE or whatever). Those macros are defined in "sched.h". Could you tell me the corresponding source file(s) (which has the definition of those macros if they exist in FreeBSD) in FreeBSD kernel source tree?

Upvotes: 1

Views: 950

Answers (1)

arrowd
arrowd

Reputation: 34401

Relevant files are src/sys/kern/sched_4bsd.c (4BSD scheduler) and src/sys/kern/sched_ule.c (ULE scheduler). But there are no TASK_* defines or set_current_state() macro, since FreeBSD and Linux use different schedulers.

You may need to read one of them (i recommend 4bsd, since it's simpler) to find what you are interested in.

BTW, there was a project to port Linux' BFS scheduler, the code is there http://rudot.blog.com/. You might find it useful.

Upvotes: 3

Related Questions