0

hi
i am doing a program that has to order a great set of numbers, but i need to use threads
i am working with microsoft visual c++ 6.0 and i use windows.h
when i tested the program, my threads used only 25% of the processor and i am very desesperated, BECAUSE the teacher asked us for a program that use the 100% of the processor all the time of its execution
please
tell me if there is any trick with the threads, in the priority o how could i do that possible
greetings
luis

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Stinomus
0

This is merely an overview, but with only 25% I'm assuming you're using single threaded code on a quad core machine? You'll need to spawn worker threads and use semaphore mechanisms to keep them apart when accessing the master number pool. They should carve up the pool into Processors x 2 worker threads and sort each stack group themselves. Then the last worker thread running should merge the results of the sort from the other threads!

0

What is the high-level approach you are taking to solving your problem in parallel?

As wildgoose said, it seems like you aren't actually running anything in parallel.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.