Arun Srinivas wrote:
few more trivial Q's (bear with me I'm a newbie to kernel world):
1) As I said I have a process that spawns 2 threads(thread A and B).I am
trying to measure the exact time @ which they are being scheduled.For
this I am using the rdtsc() (when threads A and B come) in
enqueue_task()..where they are being inserted into the priority array.
Is this a correct way of measuring?
Not exactly. They can be enqueued "onto" the runqueue without being
scheduled if there is another process running at the time.
You should look in schedule(). And use sched_clock instead of rdtsc.
I think you'll find schedule() already calls sched_clock, so you should
be able to do this with minimal overhead.
Note also, that schedule() may be called multiple times without
switching your task off the CPU - so keep that in mind if you are looking
for the time at which it is first scheduled on.
2) also in task_struct.....is "tgid" the id of my process and each of
threads hav a unique pid??
Something like that.
3) I saw frm the kernel docs tht realtime tasks hav priority 0 to 99. So
using setscheduler means do I have to enforce a priority in one of these
ranges to make my threads as soft/hard realtime task.
Well, if you have nothing else running with a realtime scheduling policy,
then your process that is will always be scheduled first.
The priority only distinguishes between two realtime processes.
Oh, and Linux is not hard realtime. Meaning you don't have a deterministic
scheduling latency. But these days it is pretty good - probably not something
you'd have to worry about.
Nick
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]