March 29, 2024, 11:22:19 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Scheduler behaviour  (Read 3954 times)

Offline dmitryperets

  • New Member
  • Posts: 1
Scheduler behaviour
« on: May 02, 2005, 09:11:52 PM »
Hi,

I implemented a scheduler logger (as a part of my homework). It writes a log every time when a context is going to be switched. I put the function which writes the log into the schedule() body, just before the line

prev = context_switch(prev, next);

My function logs the pid of both prev and next (prev->pid and next->pid) and also writes the jiffies value.

Now the problem. I always get some very strange thing in the log. It looks like this:

PID = 123 switched to PID = 456 at jiffies=67584
PID = 456 switched to PID = 123 at jiffies=67584

Note that the jiffies value is THE SAME. Like the switch was performed twice somehow... And the switch is from one process to another and then back to the first one... I didn't change anything else in the scheduler. So do you have any idea of what it can be?

P.S. I get the log using the system call that I've implemented (it copies the log using copy_to_user function)

Thank you.