Re: help needed pls. scheduler(kernel 2.6) + hyperthreaded related questions?

From: Arun Srinivas (getarunsri_at_hotmail.com)
Date: 03/23/05

  • Next message: Herbert Xu: "Re: [patch] Real-Time Preemption, -RT-2.6.12-rc1-V0.7.41-07"
    To: nickpiggin@yahoo.com.au
    Date:	Wed, 23 Mar 2005 15:17:38 +0530
    
    

    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?

    2) also in task_struct.....is "tgid" the id of my process and each of
    threads hav a unique pid??

    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.

    thanks in advance for your patience.

    >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: Wed, 23 Mar 2005 18:37:16 +1100
    >
    >Arun Srinivas wrote:
    >>If the SMT (apart from SMP) support is enabled in the .config file, does
    >>the kernel recogonize the 2 logical processor as 2 logical or 2 physical
    >>processors?
    >>
    >
    >You shouldn't be able to select SMT if SMP is not enabled.
    >If SMT and SMP is selected, then the scheduler will recognise
    >the 2 processors as logical ones.
    >
    >>Also, as the hyperthreaded processor may schedule 2 threads in the 2
    >>logical cpu's, and it may not necessarily be form the same process i.e.,
    >>the 2 thread it schedules may be from the same or from the different
    >>process.
    >>
    >
    >Yes.
    >
    >>So, is there any way I can tell the scheduler (assuming I make the
    >>scheduler recogonize my 2 threads..i.e., it knows their pid) to schedule
    >>always my 2 threads @ the same time? How do I go abt it?
    >>
    >
    >Use sched_setaffinity to force each thread onto the particular
    >CPU. Use sched_setscheduler to acquire a realtime scheduling
    >policy. Then use mutexes to synchronise your threads so they
    >run the desired code segment at the same time.
    >

    _________________________________________________________________
    Screensavers unlimited! http://www.msn.co.in/Download/screensaver/ Download
    now!

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Herbert Xu: "Re: [patch] Real-Time Preemption, -RT-2.6.12-rc1-V0.7.41-07"

    Relevant Pages

    • Re: SCHED_FIFO and SCHED_RR broken by cfs
      ... SCHED_FIFO realtime scheduler. ... In my opinion a high priority real time user process with SCHED_FIFO ... should be only interrupted by the kernel or a process with an higher ...
      (Linux-Kernel)
    • Re: Xterm Hangs - Possible scheduler defect?
      ... >> perogative to don steel toed shoes(set important kernel threads to a higher ... >> priority) before pulling the trigger. ... I specifically directed the scheduler to run my thread at a higher ... >higher priority than the kernel I would have written something in kernel ...
      (Linux-Kernel)
    • Re: Kernel newbie questions
      ... > loosely) suck so badly... ... vaguaries of the user-proc scheduler. ... Once you move it into the kernel, ... is setting it's priority such that other processes, ...
      (comp.os.linux.misc)
    • SCHED_FIFO and SCHED_RR broken by cfs
      ... SCHED_FIFO realtime scheduler. ... In my opinion a high priority real time user process with SCHED_FIFO ... should be only interrupted by the kernel or a process with an higher ... static inline void getCPUfreq ...
      (Linux-Kernel)
    • Re: RFC for a new Scheduling policy/class in the Linux-kernel
      ... B is holding a lock. ... A grants its priority B until B releases the lock. ... We want to charge B's critical section to B, ... scheduler computes how much time A has used recently, ...
      (Linux-Kernel)