Professional Web Applications Themes

AIX user-threads mapping - AIX

Hi all, I am new to *nix* programming. I was reading about AIX user-mode threads. I want to get the following things cleared: 1) IBM DOCS: In AIX thread is the basic unit of scheduling. This is claimed by Windows NT also. Of linux, as far as I know, this is not the case and basic scheduling unit is process. Q: Can somebody shed light on how thread scheduling is done if OS is not natively supporting it. Does the thread libary act as scheduler? 2) IBM DOCS: AIX user-mode threads are mapped to kernel-mode threads. Mapping may be 1:M ...

  1. #1

    Default AIX user-threads mapping

    Hi all,
    I am new to *nix* programming. I was reading about AIX user-mode
    threads. I want to get the following things cleared:

    1) IBM DOCS: In AIX thread is the basic unit of scheduling.
    This is claimed by Windows NT also. Of linux, as far as I know, this
    is not the case and basic scheduling unit is process.
    Q: Can somebody shed light on how thread scheduling is done if OS is
    not natively supporting it. Does the thread libary act as scheduler?

    2) IBM DOCS: AIX user-mode threads are mapped to kernel-mode threads.
    Mapping may be 1:M or M:M or M:N
    Q: If M:M mapping is used then is it any different from Windows NT
    Q: In M:1 mapping would just one user-thread mapped to a particular
    Virtual Processor (VP) run at a time even on multi processor machines
    Q: Does this mean that the kernel schedules only kernel-threads? Is it
    true of Windows NT also?

    3) IBM DOCS: AIX has three type of threads user-mode, kernel-mode,
    kernel-only. kernel threads runs in user mode environment when
    executing user functions.
    Q: Does this mean kernel code calls user mode code/libraries? How is
    it different from Windows NT?

    Thanks in advance
    pkk Guest

  2. #2

    Default Re: AIX user-threads mapping

    com (pkk) writes:
     

    By user-level threads people usually mean threads package implemented
    completely in the user space (the kernel is unaware of the existance
    of any threads). AIX standard threads are *not at all* like that.
     

    The picture on linux is quite a bit more complicated than what your
    statement above implies, and also changes depending on whether you
    are talking about LinuxThreads or NPTL.
     

    If OS has no knowledge of threads (i.e. you have user-level
    threads), then the threads library has to act as a scheduler
    (nobody else knows threads exist at all).

    That is not what happens on AIX or Linux (with default threads
    packages).
     

    No, it is not any different from NT: with M:M the kernel knows
    about every thread in your process.
     

    Yes: there is only 1 kernel thread, so at most 1 thread can ever run.
     

    The kernel can only schedule things it knows about, and the only
    things it knows about are kernel threads. So yes on AIX and on NT.
     

    Huh? Where did you get this from?
     

    I don't think AIX kernel ever calls into user-mode.

    On NT the kernel calls into user-mode all the time -- when you
    create a Window Class, you register a WindowProc, which the kernel
    will call when/if events are posted to your window.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.
    Paul Guest

  3. #3

    Default Re: AIX user-threads mapping

    pkk wrote: 

    Obviously your "IBM DOCS" refer to:
    http://www16.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/understanding_threads.htm
    http://www16.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/kernextc/kern_threads.htm
     

    Then a user thread will be treated as whatever entity that kernel
    can schedule (support natively). "Thread scheduling" can only be
    done at library level in this case, if necessary.
     

    To be accurate:
    M:1, not 1:M
    1:1, not M:M.
     

    1:1 is pretty much the same as System Scope: there's no hidden
    user(libary) secheduler any more, every thead is scheduled by
    kernel scheduler.

    Don't know NT.
     

    More subtle than that.
    A simple test will show that your threaded process uses as many
    CPUs as possible at any given time, regardless what M/N setting is.
     

    Yes. Don't know NT.
     

    No. A thread (except for kernel-only thread) switches between
    user-mode (when executes user code, before or after system-call)
    and kernel-mode (when executes kernel code through system-call).

    Again, don't know NT :(

    Tao Guest

  4. #4

    Default Re: AIX user-threads mapping

    Tao Chen wrote:
     
     
    >
    >
    > Then a user thread will be treated as whatever entity that kernel
    > can schedule (support natively). "Thread scheduling" can only be
    > done at library level in this case, if necessary.
    >[/ref]

    First sentence should say,
    "Then a user thread will be *transfered/mapped to" whatever entity
    that kernel can schedule (support natively), by the thread library."

    Tao Guest

  5. #5

    Default Re: AIX user-threads mapping

    Hi again,
     [/ref]
    machines
     
     [/ref]
    machines
     

    Q: so we already have two conflicting answers.
    Please elaborate how can two threads run if all user-threads are
    mapped to a single VP.
     [/ref]
    it [/ref]
     

    Q: Should then we say that just like NT every thread has some part
    (atleast the initialization) executing in kernel. Corresponding to
    each such thread there is a data structure in kernel representing the
    thread which the kernel uses to schedule it.

    Thanks in advance
    pkk Guest

  6. #6

    Default Re: AIX user-threads mapping

    Tao Chen wrote:
     
    >
    > To be accurate:
    > M:1, not 1:M[/ref]

    Actually, we call it M:N, where N >= 1. It's a per-process
    configurable ratio.

    --
    Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
    __________________________________________________ ______________________

    Gary Guest

  7. #7

    Default Re: AIX user-threads mapping

    Tao Chen wrote:
     
    >
    > More subtle than that.
    > A simple test will show that your threaded process uses as many
    > CPUs as possible at any given time, regardless what M/N setting is.[/ref]

    Um, I'm not sure this is true. The default for M:N is 8:1 (IIRC),
    which means only one of the (user-space) threads for that process will
    be running (on the kernel-space thread, or VP) at any given time. That
    said, there may be some smarts in the system that ask for more kernel
    resources, but I don't think that happens.

    --
    Gary R. Hook / AIX PartnerWorld for Developers / These opinions are MINE
    __________________________________________________ ______________________

    Gary Guest

  8. #8

    Default Re: AIX user-threads mapping

    Gary R. Hook wrote:
     
    >>
    >>
    >> To be accurate:
    >> M:1, not 1:M[/ref]
    >
    >
    > Actually, we call it M:N, where N >= 1. It's a per-process
    > configurable ratio.
    >[/ref]

    http://www16.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/understanding_threads.htm

    Regards.

    Tao Guest

  9. #9

    Default Re: AIX user-threads mapping

    pkk wrote:
     

    Maybe because the M:N ratio applies to *each* cpu, instead of the whole
    system? Again, I'll suggest you do some simple test on a MP system.

    Regards.

    Tao Guest

  10. #10

    Default Re: AIX user-threads mapping


    On Wed, 27 Jan 2004, pkk wrote:
     


    The *best* place to post this types of questions is at:

    comp.programming.threads

    Also check out the www.opengroup.org site and follow the links to find white
    papers on definitions and behavior of the various Pthread functions and
    modes of operation.

    BTW: the Linux threads have a 'pthread_*' API but their behavior is NOT POSIX
    compliant, exactly because Linux uses a process as the kernel execution object
    that user level threads maps to. There are several problems, especially
    related to SIGnals. I think that there is an effort to overhaul the linux
    threads to make them POSIX compliant but I don't know how far this effort has
    gone.

    -MT


    Michael Guest

Similar Threads

  1. Replies: 1
    Last Post: April 8th, 02:29 PM
  2. Replies: 1
    Last Post: April 6th, 05:53 PM
  3. Replies: 1
    Last Post: March 30th, 04:47 AM
  4. User Control: Mapping Error
    By Sergey Polyakov in forum ASP.NET Building Controls
    Replies: 0
    Last Post: May 24th, 04:51 PM
  5. HELP - User threads "Waiting on a buffer"
    By Greg Collett in forum Informix
    Replies: 2
    Last Post: October 30th, 12:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139