Click here to Skip to main content
13,141,576 members (28,669 online)
Rate this:
Please Sign up or sign in to vote.
Hi All,
After reading about parallel programming by multicore processor,I have some doubts.
  1. Its undoubtedly best idea for play stations,X-Box [as they have soo... many cores]
    But will it prove to be effective for core i7 running 8 parallel process then running 100 thread in Windows 7 64 bit?
  2. If some how its managed to make all the process running parallel with less critical resource to then will it give better performance over 100 thread?

  3. If not then in which case I can see multicore programming[I am trying VC++ with Open MP] winning over multi thread in my i7,win 7[64 bit] ,4GB ram?

It will be great If I can get a code in C++ or JAVA to run in my machine to compare same task running
  • parallel
  • sequence
  • thread

Eagerly Waiting for your response.

Thanks in advance.

[enhzflep: edited formatting, spelling]
Posted 15-Jun-12 21:46pm
Updated 15-Jun-12 21:57pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

More cores quite simply means you can do more at any one time. Most cores also support threading. Processors work using something called the fetch execute cycle. This cycle has 4 stages and it's possible for 4 separate threads to work within a single processor as each one exists within each stage of the fetch execute cycle.

Effective multi-threading in programming is less of a science and more of an art form. Completing a good bit of multi-threaded programming and watching it work well makes me feel like the conductor of a symphony. All your questions about can an 8 core i7 run 100 threads depends on how the threads are programmed. It's an abstract question to which no definite answer can be given.

My advice would be to write a test to bench mark performance (Although I'm sure you can download multi threading bench mark tests). I don't write JAVA or C++ so can't help you with the code but I've written similar tests in c#.

Start with 2 threads, measure CPU usage and how long it takes to complete the task you've assigned to the thread. Then add more and more threads to the process until the CPU usages peaks and the process times becomes longer.
SoMad 16-Jun-12 4:45am
Great answer, +5 to the conductor :)

Soren Madsen
shankha2010 19-Jun-12 2:12am
this is the result I found which suggests incase of more number of thread that more than number of core present multithreading is advantegious.
Task : To Find first 20000 Prime number
System config:core i7;4GB RAM;Win7 64 Bit

2 thread/core
serial :17004ms
multicore :8689ms
multi thread :9002ms
multicore+multi thread:9002ms

4 thread/core
serial :33665ms
multicore :11170ms
multi thread :11014ms
multicore+multi thread:11061ms

10 thread/core
serial :84896ms
multicore :26131ms
multi thread :22464ms
multicore+multi thread:22823ms
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Gday, I'm not so sure I understand each of your points and your questions - though I'll do what I can to address them.

  1. XBox, PS3 actually only have a couple of cores, like PCs.
    • PS3 - 8 for the cell, 6 as implemented in ps3 variants.

    • Xbox360 - 3 for the PowerPC Xenon

    Just like PCs, the massive parallelism is found within the GPUs

  2. I believe you'll see bottle-necks sooner when spawning many processes. This is since each process gets it's own address space. This will mean a greater number of cache-misses.

  3. Multi-threaded programming can occur on both multi-core chips and single-core chips, provided the chip supports multiple simultaneous threads on each core (SMT), or in Intel parlance - HyperThreading. Even the lowly Intel Atom supports this.

An example of point3 in play - when I create an app to perform simultaneous download of rss feeds, the number of threads may go from 1 to about 15. All I do is spawn new threads. These threads execute on both of the 2 the physical cores in my i3, and all 4 of the logical processors without any direction from me. So my point is, in the i7 whenever you've got multi-threading in place, you're almost certainly (or certainly?) employing multi-core processing.

Because the main memory is now measured in GB, yet the cache memory is still only measured in single-digit MBs - the resource that will be most often taxed is the cache. It's my understanding that multiple processes will eat-up the cache much faster than multiple threads. Cache-misses are generally very expensive in terms of idle cpu-cycles, hence the effort taken to reduce them. - Modern cpus often have cache memory that runs at cpu speed, while main memory is never even close to this figure.

Truly broad and interesting topic for study.
nv3 16-Jun-12 6:37am
Got my 5.
Stephen Hewison 16-Jun-12 12:51pm
Good answer +5. The fact that it's specifically 64bit means I'd definitely lean towards threads over processes. In a 32 bit system you'll quickly run into the lower base memory limit (LBM) especially when talking about thread counts in the 100s. Each process on 32bit windows is restricted to 512MB in the LBM. In 64bit this limit is raised to 2TB.
SoMad 16-Jun-12 23:02pm
Good stuff, +5. It is an advanced topic.

Soren Madsen

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 16 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100