views:

334

answers:

6

I have three similar questions:

  1. Which known applications have benefits of multicore processors?
  2. Which known applications use posix threads (pthreads)?
  3. What can pthreads do that Java threads cannot?
+2  A: 

[answering the first question] Apps which benefit most (and most easily) from multicore processors are server apps which service many clients and have high per-client CPU cost, like web servers, database servers, and other application servers-- and apps which run on top of those servers. By spreading client load across several processors, as long as those clients aren't contending on shared resources (e.g. shared data, or a disk drive) you'll get a large speedup.

Single-user apps (e.g. batch processing, command-line tools, GUI tools) can also be made to benefit from multicore, but they often must be substantially re-architected to get a big perf win.

BTW, you might want to split #2 and #3 questions out into a separate SO question-- the general question of parallel benefits is pretty different from a Java vs. Posix thread comparison.

Justin Grant
Nice explanation, and do you know name of any application that use parallel programming (pthreads)?
dede
+3  A: 

Answer to first two questions: most Linux open source projects written in C use pthreads. For example Apache. What can pthreads do that java threads cannot? They can work without Java Virtual Machine.

riopan
+1  A: 

Almost all mainstream desktop applications use multiple threads, so they all get some benefit from multiple processors.

The applications that get the most benefit from multiple processors are those that perform huge amounts of independent computations. Audio, Video, and Image processing, for example.

The pthreads and Java programming models are fairly similar, given the obvious differences between Java and C programming. Java is a little bit higher-level, so there ate some features in pthreads that are abstracted a bit in Java. Basically, you can do the same things with both.

Mark Bessey
A: 

I love SMP boxes for batch programming. Use vintage 1970s unix "pipe" technology:

% step1 < some.data | step2 | step3 > some.output

Now, that wasn't hard, was it?

Of course, the other comments are true about servers. You can do some fancy processing by breaking a batch into parallel substeps, but you have to write a "smart" controller to manage it.

Roboprog
A: 

Performance difference between Pthreads and Java threads can be easily seen by comparing their context switching time .... Java's way slower :(

Ali
A: 

Which known applications have benefits of multicore processors?

Any application that uses multithreading or multiprocessing. One example: Google Chrome uses multiprocessing by dedicating a separate process to each tab window. It benefits from multiple processors if multiple tabs are using CPU resources at the same time. (It also uses multithreading.)

Which known applications use posix threads (pthreads)?

Posix threads are used on POSIX compliant systems. This usually means Unix or Linux (Mac is posix compliant too, but I'm not sure if Cocoa threads build upon pthreads). Example: Firefox and Google Chrome on Linux.

What can pthreads do that Java threads cannot?

What can a car steering wheel do that a truck steering wheel cannot? They both do their thing but were where designed to be used on a specific platform.

StackedCrooked