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

Recommended Answers

All 2 Replies

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!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.