This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Minimum Hardware Configuration  RSS feed

 
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish to run four different versions of a java program simultaneously
I then want to gather up the results from all four programs and make a final decision on what to do next

What is the minimum hardware configuration that I could use to achieve this ?
Also, what software could be used in conjunction with this setup ?

Bob M
 
Saloon Keeper
Posts: 5326
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type of hardware do you mean? CPUs? CPU cores? Something else?

Would those processes be running in the same JVM, or would each have its own process?

If the code makes use of Java's multithreading capabilities (fork/join, for example), all codes could run in the same JVM and make progress, although probably not particularly quickly.

If the point is to speed up processing, each JVM should have its own CPU, or on a single CPU, that should have at least 6 cores, so each JVM has a chance of running independently of the others.
 
Bob Matthews
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim

type of hardware..........I am not sure

With your final comment, what is involved having a CPU with 6 cores and running the 4 programs ?

I don't have any knowledge of this approach

I do understand the concept of having 4 CPUs (i.e. 4 computers) and using a message broker such as Apache Active MQ

Bob M
 
Tim Moores
Saloon Keeper
Posts: 5326
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All CPUs have multiple cores these days - which is not the same as having multiple CPUs, but it does has some of the same concurrency benefits.

Server-class machines will have multiple CPUs, and it shouldn't be hard to schedule the various JVMs to run on different CPUs.

But you mention multiple computers - so these processes would not run on the same machine? And you mention MQ because that's how these processes would communicate with one another?
 
Marshal
Posts: 63777
209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Tim means is, in order to run four Java® processes simultaneously, you ideally need four unused available threads. You will want another two threads for all the other tasks running, for example you might want to listen to music whilst executing that program. So that would probably need another two threads, making six.
I don't think I have ever heard of a six‑core chip, so you would want a four‑core‑eight‑thread chip, or an eight‑core chip.

Oh, looking around I have found that Intel do manufacture a six‑core chip:
 
Bob Matthews
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the comments................

With a single computer with a CPU with 6 or 8 cores, could you explain in simple terms how one programs the machine to handle several programs simultaneously

Bob M
 
Campbell Ritchie
Marshal
Posts: 63777
209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would have to run one per core/thread. The easiest way to do that would be to run a Stream in parallel. More information in the package summary.
You could also create a fixed thread pool, using Runtime.getRuntime().availableProcessors() to decide how many threads to create.
 
Tim Moores
Saloon Keeper
Posts: 5326
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell's answer assumes that you would run the programs in the same JVM - which you haven't really said. If each program has its own JVM, then scheduling them on different cores would fall outside the realm of Java coding, and in the realm of operating system and process configuration.

(a bit of reading up later) I think it may not be possible to schedule processes on particular cores. Linux has the taskset command which allows processes to be pinned to particular CPUs (and other OSes has similar facilities), but not cores: Processor affinity
 
Bartender
Posts: 20557
120
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter how many cores or processors a machine has.

The ability to run multiple programs at one time is called multi-tasking.

DOS was not a multi-tasking OS. The early Macintosh had a limited form of multi-tasking (co-operative multi-tasking), as did Microsoft Windows before Windows 95. The Commodore Amiga had multi-tasking. Windows 95 had a hybrid multi-tasking system, Windows NT and later are full multi-tasking.

Unix was multi-tasking from the beginning, and so is its spin-off, Linux. Most minicomputer systems and virtually all mainframes since the 1960s have had multi-tasking.

If you're going to benchmark multiple versions of a program running concurrently, be aware that multi-tasking isn't free. The traditional rule of thumb was that there was about 10% of the computer's time spent in switching from one task to another, since single-CPU multi-tasking could only run one task at a time (concurrently). Multi-processor and multi-core CPUs can run as many threads simultaneously as there are processor cores, although Java in particular often runs multiple task threads within a single JVM.

There's nothing wrong with stress-testing a machine by loading it up with multiple copies of an application. However, normally, they'd be identical copies, since having a mix makes it difficult to figure out how much of the stress is due to differences between versions of the app. You can also stress-test a machine by running multiple different apps, which is more similar to the average everyday workload.

Conversely, if you wanted to see the load variations between different versions/configurations of an application, you'd usually want to keep the number of other applications on the system to a minimum in order to avoid having them obscure the results and run just one version at a time.
 
Tim Moores
Saloon Keeper
Posts: 5326
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:It doesn't matter how many cores or processors a machine has.

The ability to run multiple programs at one time is called multi-tasking.


As the question is specifically about running code in parallel, not just concurrently as multi-tasking would do, I think CPUs and cores matter a lot.
 
Tim Holloway
Bartender
Posts: 20557
120
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the original word used was "simultaneously". Which is a word that has a very precise meaning to technical people, but to the general public is not distinguished from "concurrently"

In any event, I believe that there's a minimum of 4 or 5 threads in even the simplest java app, for stuff like the garbage collector and other internal functions, although the exact number can be expected to vary depending on version, vendor, and possibly other factors.

Obviously, the more processors and cores, the more potential you have for true simultaneity, but so far, only really high-end machines (or graphics cards) have enough discrete processors to be completely simultaneous.

In actual practice, about the only time I deal with processor affinity is when spawning VMs or containers, where one of the primary motivations is to keep a virtual environment from eating the entire machine. That is, to provide a service level.
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!