CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2000
    Location
    Washington DC, USA
    Posts
    715

    Question about Threads and CPU's...

    Question about Threads. I'm programming on a quad processor solaris box. My question is how do my cpu's get scheduled? Are they scheduled by process or by thread.

    Meaning when I'm running a single multithreaded process does my program take advantage of the multi processors? Or do I need to run multi-processes to saturate these cpu's?

  2. #2
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    It is one processor per process. Threads are meant to be light-weight (LWP) so they all share the same processor.
    Succinct is verbose for terse

  3. #3
    Join Date
    May 2000
    Location
    Washington DC, USA
    Posts
    715
    I actually asked this question quite some time ago. During off line research this is what I discovered.

    Solaris has what is called kernel level threads which are scheduled across cpu's depending upon what activity is being done on the box. The os itself will try to optimize this, so if you've got four processors and four processes cross execution on the processors wont occur, but if you have one process with many threads the scheduler is likely to cross execute. Linux also has kernel level threads.

    HP/UX does not have kernel level threads and I was not able to determine conclusively one way or the other about NT.

    So it depends on the OS if threads in the same process are executed on different processors.

  4. #4
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    That's strange: when I was running a huge multi-threaded process, only one processor was used. All the others stayed idle. This happened on both Solaris 2.6 and HPUX 11. Things may have changed since I last looked at it (2000)
    Succinct is verbose for terse

  5. #5
    Join Date
    May 2000
    Location
    Washington DC, USA
    Posts
    715
    Hp-ux that's what I've found too. But 2.6 should have spead the load out. I'll try to dig up my documentation on this. I wouldn't mind learning I've been informed incorrectly on this.

    How did you determine your other cpu's were not involved in solaris?

  6. #6
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    No documentation to back this up. I just looked at the processor graphs. There was a command to let you see what each processor was doing but I can't remember what it is since I haven't used multi-processor Suns for some time. Whenever I ran a multi-threaded program, one processor would shoot up but the others just remained flat.
    Succinct is verbose for terse

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured