Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For a project at my university I am researching ways to trace, log and manipulate the process scheduling of certain processes. I would like to launch an number of applications, everyone in a single process. At first I would like to trace and log their scheduled execution. But at the next step I would like to manipulate their scheduled execution in order to prefer a single process in it's first $n execution.

Does someone know an existing approach to realize this (for instance a modified sched.h)?

share|improve this question
    
I'm a little confused by the "number of applications" and "single process" bit. How are multiple applications occupying a single task? –  Joel Davis May 6 '13 at 12:28
    
Also, what platform is this on? –  Joel Davis May 6 '13 at 12:28
    
Joe, you are right. The single process part is a little bit redundant.I am developing under OSX 10.8 but the destination platform will be a normal debianstyle linux. –  arbyter May 6 '13 at 13:38
1  
What are you trying to trace? Context switches? Between processes or between threads of the same process? What kinds of modifications do you want to make to the scheduler? Are you doing this on OSX or Linux (the tools are likely to be very different)? –  Gilles May 7 '13 at 1:40
add comment

1 Answer 1

To keep track you can use getcpu or sched_getcpu (ideas from this question), but there isn't any signals realted to the scheduling so it might be a bit hard to keep track of that directly on the code.

Another not much elegant solution is find this information in the /proc/$PID "files"

To control where the CPU affinity check hwloc , taskset or control for runtime control: sched_setaffinity

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.