CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20

Thread: Multithreading

  1. #16
    Join Date
    Nov 2010
    Posts
    7

    How to program multicore

    Is it appropriate to have a program that uses a core to do an intensive calculation and another core to output the results simultaneously on a dualcore machine? can i use MPI library to do this task?

    I tried multithreading on a dualcore machine with the same idea that one thread does the calculation while the other thread displaying results, but the two cores do not process simultaneously.

    Thanks,

  2. #17
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: How to program multicore

    I tried multithreading on a dualcore machine with the same idea that one thread does the calculation while the other thread displaying results, but the two cores do not process simultaneously.
    And how did you find that out?
    Best regards,
    Igor

  3. #18
    Join Date
    Nov 2010
    Posts
    7

    Re: Multithreading

    I look at the performance tab in task manager. I also timed it, the running time on dualcore machine does not improve a lot compared to the one core machine.

  4. #19
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: How to program multicore

    Quote Originally Posted by ktxn View Post
    ..., but the two cores do not process simultaneously.
    Why would you expect them to? According to your description, the first thread does intensive calculations and the second thread displays results. Assuming that the two thread are on separate cores (probably reasonable), then the the second thread has nothing to do until the first thread sends it results for display. This matches your observed behavior.

    In your scenario, mutithreading provides the advantage that the GUI stays alive while the intensive calculation proceeds. But in this scenario, multithreading does not provide a time/speed advantage.

    To obtain a time/speed advantage, the intensive calculation must itself be multithreaded. That generally can be hard to do, unless the intensive calculation has some nice parallel properties.

    Mike
    Last edited by MikeAThon; May 11th, 2011 at 01:00 PM.

  5. #20
    Join Date
    Jun 2011
    Posts
    5

    Re: Multithreading

    In programs there are threads. Threads are doing process. There are many thread with performing different processes. At a time we can do many process with the help of multi threading. Threads have many states like start,intiate,stop,turminate.

Page 2 of 2 FirstFirst 12

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