Java and Multi-Processor Systems

[This may be the wrong form, please point me to the correct one if I should redirect this!]
Is it possible to use Java in a multiprocessing environment where Java can take advantage of the multiple processors? Naturally Threads are the obvious parallel mechanism, but I suspect there are others.
Motivation: Basically we are trying to build an inexpensive system to do scientific and mathematical computing where the runs can take hours or days on traditional uniprocessor systems. Presumably a multiprocessor system would be the first stop, although Grid computing may be as effective.
So any pointers for doing cpu intensive programming with Java would be appreciated!

You need to have atleast one active thread per CPU.The domain I am looking at is "Agent Based Modeling" (ABM). In that sphere, each agent is fairly independent of all the others, making decisions based on "local knowledge". Our current simulation uses 35,000 agents.
You may find that different architecture may limit
the number of processors you can effectively exploit
but you should be able to use2-4 CPUs without
signifciant trouble.I'm not clear on how I can ask Java to use the multiprocessors I may have in my system. Do I simply assign a thread to each agent? That would be quite easy to do.
So I think the question here is: Does Java assign threads to multiprocessors? Does it need a special compile/run flag to do so? Do I need to include special Java code to somehow promote this behavior?
If the processing is really CPU intensive the best
option may be to find the bottlenecks with a profiler
and write them in C. You should be able to get a
significant speed up this way with minimal
conversion.That may be necessary, but in the ABM space, people are leaving C for Java due to its being fast enough and the networking support, memory management, etc just too nice to pass up!
To use multiple threads you need to be able to
exploit a natural parrellism in the work you are
doing. If the task is genuinely single threaded you
wil only every be able to use one CPU.This should be easy, see above .. due to each agent being reasonably independent.
Thanks for the thoughtful response!

Similar Messages

  • JVM's suport for multicore processors and multiple processor systems

    Hi all,
    Do you have any concrete information about Sun Hot JVM 1.5's support for multi-core processors and also its support for multi processor systems. I ask this because i am looking at deploying a multi threaded application written in Java 5 and want to know the best CPU arrangement for optimal performance.
    Does JVM run itself on multiple CPUs?
    Does JVM run native threads on multiple CPUs ? at the same time.
    Is there a place where i can find out the exact behavior of the JVM in sus environments ?
    Thanks.

    Hi,
    Sun's JVM runs very well on multi-thread/core/chip systems and provides several mechanisms to scale well in such environments (for example Thread Local Allocation Buffers (TLABs), parallel gargabe collection threads etc.). Java threads are 1:1 mapped to operating system threads. There are lots of options that allow you to configure the JVM wrt number of gc threads and so on, although the defaults should in most cases work well. There is a lot information available at http://java.sun.com/docs/performance/index.html and some (quite outdated) information about threading at http://java.sun.com/docs/hotspot/threads/threads.html.
    Nick.

  • Multi-Processor Systems vs Single Processor systems

    In general, is it better to run Weblogic on a fast single processor system
    or on a multi-processor system where the individual cpus are less powerful?
    I am assuming that the platforms are WINTEL and all other things (memory,
    disk channels etc) are equal.
    What are the licensing implications of one philosophy over the other?

    Jim Ewing wrote:
    >
    In general, is it better to run Weblogic on a fast single processor system
    or on a multi-processor system where the individual cpus are less powerful?
    I am assuming that the platforms are WINTEL and all other things (memory,
    disk channels etc) are equal.You'll hate me for saying this, but it depends on your application and
    your client load.
    I'd suggest that you run a load test against both systems and compare
    the results.
    >
    What are the licensing implications of one philosophy over the other?You pay for WLS by the number of CPUs.
    -- Rob
    Coming Soon: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnweblogic.com

  • Concurrency in Swing,  Multi-processor system

    I have two questions:
    1. This is a classic situation where I am looking for a definitive answer on: I've read about the single-thread rule/EDT, SwingWorker, and the use of invokeLater()/invokeAndWait(). The system I am designing will have multiple Swing windows (JInternalFrames) that do fairly complex GUI work. No direct interaction is needed between the windows which greatly simplifies things. Some windows are horrendously complex, and I simply want to ensure that one slow window doesn't bog the rest of the UIs. I'm not entirely clear on what exactly I should be threading: the entire JInternalFrame itself should be runnable? The expensive operation within the JInternalFrame? A good example of this is a complex paint() method: in this case I've heard of spawning a thread to render to a back-buffer of sorts, then blitting the whole thing when ready. In short, what's the cleanest approach here to ensure that one rogue window doesn't block others? I apologize if this is something addressed over and over but most examples seem to point to the classic case of "the expensive DB operation" within a Swing app.
    2. Short and sweet: any way to have Swing take advantage of multi-processor systems, say, a system with 6 processors available to it? If you have one Swing process that spawns 10 threads, that's still just one process and the OS probably wouldn't be smart enough to distribute the threads across processors, I'm guessing. Any input on this would be helpful. Thank you!

    (1) You need to use a profiler. This is the first step in any sort of optimization. The profiler does two important things: First, it tells you where are the real bottlenecks (which is usually not what you expect), and eliminates any doubt as to a certain section of code being 'slow' or 'fast'. Second, the profilter lets you compare results before and after. That way, you can check that your code changes actually increased performance, and by exactly how much.
    (2) Generally speaking, if there are 10 threads and 10 CPU's, then each thread runs concurrently on a different CPU.
    As per (1), the suggestion to use double buffering is the likely best way to go. When you think about what it takes to draw an image, 90% of it can be done in a worker thread. The geometry, creating Shapes, drawing then onto a graphics object, transformations and filters, all that can be done offline. Only copying the buffered image onscreen is the 10% that needs to happen in the EDT thread. But again, use a profiler first.

  • Diff between two-level infrastructure and multi-level system landscape

    Hi Experts,
    Can Anyone explain me what exactly is meant by two-level infrastructure (SAP and customer solutions) and multi-level system landscape (SAP, country-specific versions, industry solutions, partner, customer, and so on) in the below statement
    In contrast to customer exits, Business Add-Ins no longer assume a two-level infrastructure (SAP and customer solutions), but instead allow for a multi-level system landscape (SAP, country-specific versions, industry solutions, partner, customer, and so on). You can create definitions and implementations of Business Add-Ins at any level of the system landscape

    Hi
    The user-exit can be implemented once, i.e. it can be used once: so it can be used to solve a particular customer situation.
    The BADI can have several implemantations, so the same BADI can be used several times, and so it can be used to solve problem of customer, for business (so different implemantion for every SAP vertical, for example one for AFS, one for OIL,......), for a specific for a country (it's the case for the FI BADIs used to solve different legal specific of every country where SAP is implemented), .......
    Max

  • Java multi-thread Applet and Multi-processor

    Hello,
    I have a JAVA applet which work fine on a mono-processeur machine and not fine at all on multi-processors.
    It use multi thread (for reading on socket) and some times, request are lost.
    Is that a matter of programming or a JVM bug ?
    This happens on Linux and Windows NT bi-processors.
    We hare using JAVA 1.3.0_02
    Thanks for your help
    [email protected]

    I have already have a look to javax.swing.SwingUtilities.invokeLater() but (I think) it don't work for my need.
    A graphic applet which create 2 threads : one for reading and one for writing on a socket.
    Request sent to the server are memorized in a vector, and once answer is received, the request is remove from vector and treated. Access to the list is protected by synchronize.
    Everything works fine one several plateforme (linux, windows 98/2000/NT, Solaris). The only problem is on multi-processor : request are lost !

  • One adaptive RFC Model and Multi Backend System.

    Hi All,
    I am trying to fetch data from multi backend system by using an adaptive RFC model.
    It is not tidy to create multi model for a RFC function to fetch data from multi SAP system, because we have dozens of SAP systems.(over 40)
    So, I would like to switch to multiple SAP systems with an adaptive RFC model at runtime.
      1 model(Same Function) -
    > System A
    > System B
    > System C
    Is there any sample or tutorial about this sort of senario?
    Thanks in advance.
    Message was edited by: JeongEog IM
    Message was edited by: JeongEog IM

    JeongEog,
    You may use SAP java Connector for doing that. Refer the following links for the step-by-step approach.
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/d2/561106b8b3bc449f890cddfdc8d3e2/content.htm">Example program 1</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/f0/eedf3d0eb8af5ee10000000a114084/content.htm">Open Connection</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/24/efdf3d0eb8af5ee10000000a114084/content.htm">Calling a Function and Closing a Connection</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/14e13d8ee4535ee10000000a114084/content.htm">Example program 2</a>
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/eedf3d0eb8af5ee10000000a114084/content.htm">Connection Pool</a>
    Bala

  • NI instruments / Logic instruments and multi processor warning

    I am running an instance of FM8 and Massive and the rest of my patches are exs and evp88 , on a macbook with 2gb ram , the memory is less than 50% and mainstage has been great up untill today when i got the "mainstage does not support multi processor 's" warning and then the second time this warning came up mainstage force quitted . Anyone experienced this yet ?

    Ola Ramiro,
    como estas?
    I'm using Atmosphere on as a normal plug-in.
    However, there have been some mates that post about here in the forum.
    Try to shearch about it.
    If I have any news, I'll keep you post.
    adieus amigo,
    Jorge

  • Oracle and multi processor

    Hi,
    Does Oracle databases manage automatically multiprocessors? If not what are the parameters to modify?
    what are the functionalities of databases which take into account multiprocessors (queries, backup/recover, etc...) and is it automatically activated?
    If not could you please give me a summary on how activating it (or a path to a document)?
    Thanks in advance.
    Fred

    Yes. No need to modify parameters.
    But what you should do is recollect system statistics
    Go to www.morganslibrary.org/library.html
    and look up system statistics

  • Advantages of multi processor systems?

    I am considering getting a new system to use for my photo processing applications. I see that Adobe has releases LR v2.0 which supports 64 bit OS and has announced that CS4, when ever it is released will also support 64 bits, well at least for Windows. This being the case, switching to Vista 64 seems to be the way to go. BUT what about the processor? The choices seem to be a quad core version from either Intel or AMD or moving higher, a Intel Xeon processor. This gives me two more choices, use two 5100 series processors for a total of four cores or go up to two 5400 series processors for a total of eight cores. The 5100 series approach seems to use less power that the 5400's and can be clocked faster. Also, last year I had the opportunity to quickly run a bench mark with CS3 on a Dell dual Xeon workstation running Windows XP 32 bit OS. It appeared that the the system only managed to make use of only 4 of the 8 processors.
    I have done a fair amount of searching and have not found any good answers to the question of which processor configuration will give the best performance. To keep this discussion reasonable I would like to limit it to one quad core processor vs. two dual core Xeons vs. two quad core Xeons.
    Hopefully some of you will be able to shed some insight. It any of the Adobe folks would care to comment, it would be appreciated. I suspect that Adobe has looked into this issue and has lots of information. The question then would be can they share it? Maybe not.
    Bill

    I run a Xeon Quad Core 2.33GHz at work and a Core 2 Duo 2.66GHz at home. Both are very fast, but the Xeon Quad Core is significantly faster. Is it a difference between going home at 5:00 vs. 6:00? Nope, more like 5:00 vs. 5:10 at best. But it does make the workday more pleasant.
    I would go with Vista 64, 8GB (or more) of RAM and something like a Core 2 Quad Q6600. Pop a $40 cooler on that bad boy, overclock to 3.0+ GHz and watch it fly. For more fun, get a Skulltrain motherboard and add a second CPU when your apps can take full advantage of 8 cores.
    And install an nVidia 9800GX2 graphics card - CS4 is supposed to take advantage of advanced GPUs.

  • Java and multi-domain certificates

    Hi, I tried using a so called MDC or multi-domain certificate with my Java application but when connecting with a webbrowser I get the following error in Firefox (Internet Explorer gives a similar error but provides less info) :
    "The certificate is only valid for www.somedomain.com%2Csub1.somedomain.com%2Csub2.somedomain.com%2C"
    I assume the %2C should be commas or at least have been interpreted as commas.
    My question, was this certificated created wrong or does Java not support this type of certificate?

    I doubt it is a Java issue. If your SSL handshake is reaching the stage where the server sends its certificate to your browser, then the server is already satisfied with its own certificate. I doubt the server pays much attention to the subject name or any of the subject alternative names of its own certificate. And the server cannot change any of the fields of this certificate, so what it is sending the browser is exactly what you got back from the CA.
    You say you did not create the certificate, but you almost certainly created almost all the fields of the certificate by creating something called a certificate signing request. This is what you give to the CA. The CA uses this to populate the fields of a certificate that it signs and gives back to you.

  • Java and interaction with system mouse events

    I would like my Java app to be notified of all Mouse events (primarily clicks is what I am interested in) even when they occur outside the java app or when java app is not the focus. For example the user may be clicking on the File menu of Microsoft Word. I'd like to know that a mouse click occured at x,y coordinate when that happens.
    Can this be done with Java API or is there a need for native code that talks to the OS (Windows and OS X) directly, which should be called with Java Native Interface?
    I would appreciate any pointers in the right direction.

    Hi,
    I'm also trying to find a way of intercepting mouse clicks when they occur outside java components.
    The code for getting the pointer location from the desktop is:
    import java.awt.*;
    public class MouseLocation
         private MouseInfo mInfo;
         private PointerInfo pInfo;
         private Point point = new Point();
         private int buttons = 0;
         private double pointX = 0d;
         private double pointY = 0d;
         private Robot robot;
         public MouseLocation()
              try
              {     robot = new Robot();     }
              catch(Exception e)     {     }
              hasMouse();     
              pointerLocation();
         }//ends constr.
         private void hasMouse()
              buttons = mInfo.getNumberOfButtons();
              if(buttons == -1)
                   System.out.println("No mouse detected.  Program terminated.");     
                   System.exit(0);     
         }//ends hasMouse()
         private void pointerLocation()
              try
                   pInfo = mInfo.getPointerInfo();
                   point = pInfo.getLocation();
                   pointX = point.getX();
                   pointY = point.getY();
                   System.out.println("pointer is at: (" + (int)pointX + ", " + (int)pointY + ")");
                   delay();
              catch(HeadlessException he)     
                   System.out.println((he.toString()) + ".  Program terminated.");     
                   System.exit(1);
              catch(SecurityException se)     
                   System.out.println((se.toString()) + ".  Program terminated.");     
                   System.exit(1);
         }//ends pointerLocation()
         public String getPointerLocation()
         {     return (point.toString());     }//ends getPointerLocation()
         public void delay()
              try
                   robot.delay(6000);     
                   pointerLocation();
              catch(Exception e)     {     }
         }//ends delay()
         public static void main(String[] args)
              MouseLocation ml = new MouseLocation();
         }//ends
    }//ends class MouseLocation

  • Java and the embedded system

    Dear readers,
    I'm having a project in mind about developing an embedded system and I want to use the flexibility of java to implement it . I'm new to the embedded system, so please try to guide me and recomend me websites as much as you can.
    Thanks in advance

    brahim wrote:
    Dear readers,
    I'm having a project in mind about developing an embedded system and I want to use the flexibility of java to implement it . I'm new to the embedded system, so please try to guide me and recomend me websites as much as you can.[www.google.com|http://www.google.com/search?hl=en&q=java+embedded+system] is a good start.
    Thanks in advanceNo problem.

  • Multi processor Solaris 2.6 and mutex locks

    hi,
    is anyone aware of any documented issues with Solaris 2.6 running
    on dual-SPARC processors (multi-processor environment) where the
    programs using "mutex locks" (multi-threaded applications), require
    some special handling, in terms of compiling and linking, to some
    special libraries.
    as far as i remember, in some OS book, maybe Peterson's, it was said
    that the mechanism for implementing mutex-locks on multi-processor
    systems is to use low-level spin-locks. this brings down performance
    on a single-processor system, making the processor doing busy-wait,
    but this happens to be the only way of mutex-locking in a multi-processor
    system. if this is so, then where is such behaviour documented in case
    of Solaris 2.6.
    i have had problems with my applications crashing (rathing hanging up)
    in a vfork() on such a system, but same application works fine, with
    100% reproducability, on a single-processor system.
    thanks for any inputs or suggestions and/or information.
    regards,
    banibrata dutta

    I am also facing similar problem. Application which written using Mulit-Threaded using Posix Mutexes. When i run on SINGLE processor manchine, i.e.
    SunOS sund4 5.7 Generic_106541-11 sun4u sparc SUNW,Ultra-5_10
    It works perfectly.
    But when try to run on dual processor machine, i.e.
    SunOS sund2 5.7 Generic_106541-11 sun4u sparc SUNW,Ultra-250
    It is blocking in the one of mutexes.
    Please inform us what is problem. Mr. B. Datta, you comes to know
    any channel, please inform me also at [email protected]
    Thanx & regards,
    -venkat

  • WLS on Multi-Processors

    A few questions about WLS 5.1 on multi-processor machines:
    1. Is there anything that needs to be done(other than purchase another
    license) for a weblogic server to work on a multi-processor system?
    2. Will WLS take advantage of all processors with just ONE invocation of WLS?
    Or will I have to run one instance of WLS for each processor?
    3. Will performance gains be uniform or will certain features gain more
    from multiple processors?
    Any answers, insights or pointers to answers are appreciated.
    Thanks.
    -Heng

    >
    I consider WebLogic to be a great no-nonsense J2EE implementation (not
    counting class loaders ;-).Look for major improvements in that area in version 6.0.
    Thanks,
    Michael
    Michael Girdley
    BEA Systems Inc
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]...
    Rob,
    I consider WebLogic to be a great no-nonsense J2EE implementation (not
    counting class loaders ;-). Gemstone's architecture is quite elaboratewhen
    compared to WebLogic, and BTW they spare no opportunity to compare to
    WebLogic although never by name. (Read their white paper on scalabilityto
    see what I mean.) I am quite impressed by their architecture; it appearsto
    be set up for dynamic reconfiguration of many-tier processing. Forexample,
    where WL coalesces (i.e. pass by ref if possible), Gemstone will always
    distribute if possible, creating a "path" through (e.g.) 7 levels of JVMs
    (each level having a dynamic number of JVMs available in a pool) and if
    there is a problem at any level, the request gets re-routed (full failover
    apparently). I would say that they are set up quite well to solve the
    travelling salesperson problem ... you could probably implement aweb-driven
    neural net on their architecture. (I've never used the Gemstone product,
    but I've read about everything that they published on it.) I would assume
    that for certain types of scaling problems, the Gemstone architecturewould
    work very very well. I would also guess that there are latency issues and
    administration nightmares, but I've had the latter with every app server
    that I've ever used, so ... $.02.
    Cameron Purdy
    [email protected]
    http://www.tangosol.com
    WebLogic Consulting Available
    "Rob Woollen" <[email protected]> wrote in message
    news:[email protected]...
    Dimitri Rakitine wrote:
    Hrm. Gemstone reasons are somewhat different.I'm not a Gemstone expert, but I believe their architecture is quite
    different from a WebLogic cluster. Different architectures might have
    different trade-offs.
    However, out of curiosity, what are their reasons?
    Anyway, here is my question:
    why running multiple instances of WL is more efficient than running
    one
    with
    high execute thread count?The usual reason is that most garbage collectors suspend all of the jvm
    threads. Using multiple WLS instances causes the pauses to be
    staggered. Newer java vms offere incremental collectors as an option so
    this may no longer as big of an issue.
    -- Rob
    >

Maybe you are looking for

  • How can someone else have the same iCloud email address as me?

    I registered for my iTools account as soon as they were offered and have had the same email address ever since. My account has not been hacked and I regularly change my password for the account. I frequently get emails from Apple notifying me that so

  • Photoshop CS2 and Windows 7

    I have Photoshop CS2 and recently acquired Windows 7.  I want to bring images in directly to Photoshop but the images go through Photo Gallery in Windows.  I can import them into PS, but i want them to come into PS directly.  Also I cannot include im

  • BAPI_ACC_DOCUMENT_POST and tax posting through the BAPI

    Hi, We are using the BAPI_ACC_DOCUMENT_POST to post accounting documents. The BAPI works fine without the tax data but we need the tax data also to get posted for the line items. Please let me know how the ACCOUNTTAX and CURRENCYAMOUNT table paramete

  • Jsp Custom tags Weblogic 6.1

              Hi,           I had posted a message before regarding the docs for weblogic custom tags, my           query is whether the custom tags listed in the javadocs of weblogic api like BeanParamTag,           FormAnchorTag etc should be used for

  • Can't get Safari to stay logged in to sites.

    I want to make the Switch from Google Chrome to Safari, but this has proved impossible so far, because Safari will not stay logged in to a lote of sites.  It seems that various Internet forums are the worst offenders, but I've noticed it on occasion