public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Arun Srinivas <getarunsri@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: help needed pls. scheduler(kernel 2.6) + hyperthreaded related questions?
Date: Thu, 24 Mar 2005 11:17:08 +1100	[thread overview]
Message-ID: <42420704.9080701@yahoo.com.au> (raw)
In-Reply-To: <BAY10-F42DB434C4A842D9EB1D3AAD94F0@phx.gbl>

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


  reply	other threads:[~2005-03-24  0:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22 22:09 help needed pls. scheduler(kernel 2.6) + hyperthreaded related questions? Arun Srinivas
2005-03-22 23:16 ` Nick Piggin
2005-03-23  6:07   ` Arun Srinivas
2005-03-23  7:37     ` Nick Piggin
2005-03-23  9:47       ` Arun Srinivas
2005-03-24  0:17         ` Nick Piggin [this message]
2005-03-29  3:28       ` sched_setscheduler() and usage issues ....please help Arun Srinivas
2005-03-29  4:40         ` Steven Rostedt
2005-03-29  4:51           ` Lee Revell
2005-03-29  6:03             ` Jan Engelhardt
2005-03-29 11:35               ` Steven Rostedt
2005-03-29 11:38                 ` Jan Engelhardt
2005-03-29 11:43               ` Arjan van de Ven
2005-03-29 11:46                 ` Jan Engelhardt
2005-03-23  7:07   ` help needed pls. scheduler(kernel 2.6) + hyperthreaded related questions? Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42420704.9080701@yahoo.com.au \
    --to=nickpiggin@yahoo.com.au \
    --cc=getarunsri@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox