Can threads be implemented as processes?

Hi all,
a project I'm working on has recently had a JVM added to it. The rest of the
program is a regular single-threaded C written console application. The JVM
has been added for using GUI (swing) components. The program runs on
both Linux and Win32: in the first case it spawns a number of processes,
whilst in the second case it has an equivalent number of threads (circa 16.)
I guess threads can be implemented as processes if the virtual machine
runs in shared memory. But don't understand why it wouldn't use green
threads. Apparently, processes on the Linux box are coordinated via SIGRT_0
and SIGRT_1, after catching bus errors (perhaps null pointers exceptions).
And strace eventually hangs.
Can someone confirm that the processes are actually threads?
Should the main C program be compiled with particular flags?
(Currently we just compile with -dl and dlopen(libjvm.so) at run time
to invoke JNI_CreateJavaVM)
TIA

It is quite old, yes. We have to stick to version 1.3, the actual version is
1.3.1_04 IIRC, because of something coded against specific swing
peculiarities.
Of course threads are more efficient, that's their reason to exist.
However, I haven't been able to find any doc about that, except a single
sentence mentioning that on Solaris the implementation was not using
native threads. BTW, I haven't been able to find the source code for
Linux libjvm either.
Our C application continuously calls into the JVM to get user's input.
Should it use mutexes? Catch signals? I cannot work it out without some
detailed description. Isn't that relevant for programmers? Or is just me
looking in the wrong places?

Similar Messages

  • How can I use the same thread pool implementation for different tasks?

    Dear java programmers,
    I have written a class which submits Callable tasks to a thread pool while illustrating the progress of the overall procedure in a JFrame with a progress bar and text area. I want to use this class for several applications in which the process and consequently the Callable object varies. I simplified my code and looks like this:
            threadPoolSize = 4;
            String[] chainArray = predock.PrepareDockEnvironment();
            int chainArrayLength = chainArray.length;
            String score = "null";
            ExecutorService executor = Executors.newFixedThreadPool(threadPoolSize);
            CompletionService<String> referee = new ExecutorCompletionService<String>(executor);
            for (int i = 0; i < threadPoolSize - 1; i++) {
                System.out.println("Submiting new thread for chain " + chainArray);
    referee.submit(new Parser(chainArray[i]));
    for (int chainIndex = threadPoolSize; chainIndex < chainArrayLength; chainIndex++) {
    try {
    System.out.println("Submiting new thread for chain " + chainArray[chainIndex]);
    referee.submit(new Parser(chainArray[i]));
    score = referee.poll(10, TimeUnit.MINUTES).get();
    System.out.println("The next score is " + score);
    executor.shutdown();
    int index = chainArrayLength - threadPoolSize;
    score = "null";
    while (!executor.isTerminated()) {
    score = referee.poll(10, TimeUnit.MINUTES).get();
    System.out.println("The next score is " + score);
    index++;
    My question is how can I replace Parser object with something changeable, so that I can set it accordingly whenever I call this method to conduct a different task?
    thanks,
    Tom                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    OK lets's start from the beginning with more details. I have that class called ProgressGUI which opens a small window with 2 buttons ("start" and "stop"), a progress bar and a text area. It also implements a thread pool to conducts the analysis of multiple files.
    My main GUI, which is much bigger that the latter, is in a class named GUI. There are 3 types of operations which implement the thread pool, each one encapsulated in a different class (SMAP, Dock, EP). The user can set the necessary parameters and when clicking on a button, opens the ProgressGUI window which depicts the progress of the respective operation at each time step.
    The code I posted is taken from ProgressGui.class and at the moment, in order to conduct one of the supported operations, I replace "new Parser(chainArray)" with either "new SMAP(chainArray[i])", "new Dock(chainArray[i])", "new EP(chainArray[i])". It would be redundant to have exactly the same thread pool implementation (shown in my first post) written 3 different times, when the only thing that needs to be changed is "new Parser(chainArray[i])".
    What I though at first was defining an abstract method named MainOperation and replace "new Parser(chainArray[i])" with:
    new Callable() {
      public void call() {
        MainOperation();
    });For instance when one wants to use SMAP.class, he would initialize MainOperation as:
    public abstract String MainOperation(){
        return new SMAP(chainArray));
    That's the most reasonable explanation I can give, but apparently an abstract method cannot be called anywhere else in the abstract class (ProgressGUI.class in my case).
    Firstly it should be Callable not Runnable.Can you explain why? You are just running a method and ignoring any result or exception. However, it makes little difference.ExecutorCompletionService takes Future objects as input, that's why it should be Callable and not Runnable. The returned value is a score (String).
    Secondly how can I change that runMyNewMethod() on demand, can I do it by defining it as abstract?How do you want to determine which method to run?The user will click on the appropriate button and the GUI will initialize (perhaps implicitly) the body of the abstract method MainOperation accordingly. Don't worry about that, this is not the point.
    Edited by: tevang2 on Dec 28, 2008 7:18 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Communication between thread in the same process using file interface.

    Hi,
    I am developing  driver and i need to communicate between two thread.
    >can anyone guide me on implementing communication between two thread in the same process using File Interface. First thread will be driver and second will be application.I need to send IOCTL like commands using File interface ie is WriteFile(),ReadFile()
    from Host process to driver through file-interface(which run's in driver context).Host process should not be blocked for the duration of the driver to process the command.
    >File-interface will run in driver context and it will be responsible to receive command from application and pass it to the driver.
    what are the complexity introduced?
    >Can anyone also give me the link/reference to get more information on this topic?
    >How to replace IOCTL command's for instance baud _rate change command with a file interface for example with IRP.

    Here  is the detailed query:
    Hardware Abstraction Layer will interact with Driver(Both will be running in complete different process) .there is a IOCTL for command and  File interface for read and write.
    My requirement is:
    Both should run in the same process so HAL will run as one thread and driver as another thread in the same process .I don't want HAL to wait for completion of request and also i don't want driver to be blocked .
    We are planning to use a File Interface for communication between Hardware abstraction layer and Driver
    HAL will send the command or read/write operation to a file interface and driver will get the command or read/write request from the File interface
    There is a flexibility to change Hardware Abstraction layer and also the Driver
    Is it possible to use IOCTL between two thread under same process? if not what other options do we have.
    Can we use File interface to  send command (like IOCTL) between two thread?

  • Could threads of a same process run on different CPU in the same time ?

    Hello,
    probably stupid question..., but I would like to understand if several threads inside a same process can run in the same time on separate CPU.
    If the response is positive, how can I bind a thread on differant CPU using C API ?
    Also what is the algorithm implemented by Solaris for the laod balancing ?
    Is there any white paper on this subject ?
    Thanks for any tips

    Threads in the same process can run at the same time on separate CPUs.
    You can bind a thread to a CPU using the processor_bind(2) API.
    That algorithm is not public. You will have to wait for OpenSolaris so that you can look at the implementation at that time.
    There is much public documentation on Solaris threading support on the web. Use google. The following document provides a good historical context of Solaris thread support.
    http://www.sun.com/software/whitepapers/solaris9/multithread.pdf
    Gary

  • Can BPm pick up existing process from ECC without human intervention

    Hi
    Is there any way BPM can read/pick the existing process from ECC system (may be solution manager workflow) and model the same.
    Just trying to make sure from experts that it is not possible before replying client.
    Lavanya
    Edited by: Lavanya Sambaraju on Nov 19, 2010 8:23 AM

    Hi Anil
    Yes, we wanted to know if the process/workflow mainateined in ECC or solution manager can be dyna,mically picked up by BPM.
    And your solution -  "Currently BPM can talk to any other system through web services.If you can expose any functionality as web service in solution manager, you can call that from BPM"
    how to implement this from solution manger?
    All we know was to expose the BAPI/RFC's functionalities  as web services from ECC and consume in BPM tasks or directly call these BApis in to BPM tasks.
    Could you please share with us.
    Thank you.

  • Implement workflow process for material reservation using tcode IW32

    Hi
    How can I implement workflow process for material reservation using tcode IW32
    - PM order.
    Thanks,
    Amos

    Hi;
    Have been able to find the solution to create the IDoc MRESCR after entering a reservation? 
    I am in the same situation and I do not see the IDoc output in the BD87. 
    It would be nice if you share the solution.
    Thanks in advance

  • Sale order bom can be used in to process order or not

    To change the BOM for particular order items the sale order BOM can be created , to copy the sale order BOM into production order CO08 can be used , whether the process order can be created with ref to sale order any option is available is SAP

    Hi,
    There is no such transaction for process order with respect to Sale order.If planned order is created with respect to sale order after MRP,that can be converted to process order thorugh COR8 transaction.
    try to explore COR8 transaction

  • How can I change the default process of VK_ENTER in JTable

    Now I have met a requirment to process the "enter" key event in JTable. But it is found that the JTable has a default process on the ENTER key press, and it will select the next row. Even the worse, the default process is invoked before the KeyListener I registered.
    How can I remove that?
    I have tried the follow ways: 1.remove several keys, such as "selectNextRow","selectNextRowExtendSelection", from the actionMap,
    2.invoke processKeyBinding() in the constructor of my subclass of JTable.
    But both lead to failure.
    And I can't find the default process to the VK_ENTER in the java source code. I need help on this.
    BTW, does anyone know how to eliminate the focus traversal between cells. When I press left arrow or right arrow, the focus traverses in the scope of the selected row.

    thanks
    i also found solution for my poblem:
    i have this code:
    jMenuItem jMnItEdit;
    jMnItEdit.setAccelerator( KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ENTER, 0));
    also i had ActionListener bounded to this JMenuItem
    but Ialso had in form JTable and it always grabbed my VK_ENTER event and that menu item wasn't working at all
    but when i overrode that input map for JTable and set
    tableInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "none");
    everything started to work perfectly,
    thanks a lot

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader.
    For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer.
    "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>".
    Current Situation: The above command line parameter when executed is working as expected in a User's Workspace.
    When executed in a command line on the Application Server, it is working as expected.
    But, the same is not working while executing it from Deployed environment.
    Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2.
    Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a

    We are trying to implement a process so that any document that needs to be printed through our Java application will be printed as PDF using Adobe Reader. For which, We created and execute the below command line to call Adobe Reader and print the PDF on a printer."C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /T "\\<Application Server>\Report\<TEST.PDF>" "<Printer Name>". Current Situation: The above command line parameter when executed is working as expected in a User's Workspace. When executed in a command line on the Application Server is working as expected. But, the same is not working while executing it from Deployed environment.Software being used: 1. Adobe 11.0 enterprise version. 2. Webshpere Application Server 8.5.5.2. Please let us know if there is a way to enable trace logs in Adobe Reader to further diagnose this issue.

    This is the Acrobat.com forum.  Your question will have a much better chance being addressed in the Acrobat SDK forum.

  • I just created a slideshow dvd in imovie, and when I hit finalize it said that it would take 7 hours to finalize.  I've only had my macbook pro for 6 months, and this is the first imovie I've done...is this normal?  If not how can I speed up this process?

    I just created a slideshow dvd in imovie, and when I hit finalize it said that it would take 7 hours to finalize.  I've only had my macbook pro for 6 months, and this is the first imovie I've done...is this normal?  If not how can I speed up this process?  Thanks in advance for all of your help!

    Hi
    Time needed can depend on several things.
    • less than 5 GB free space on Start-up (Mac OS) hard disk = Redicolous long times AND a DVD that most probably will not work OK
    Medicine - I never go under 25GB free space
    • Use of strange file formats into iDVD - can force it to de-code first then re-encode - this can take long long times
    I use
    Video - StreamingDV as from miniDV tape Cameras - or QuickTime Movies Converted to StreamingDV
    Audio - .aiff 16-bit 48 kHz - (no .mp3, .wma etc)
    • Use of old Mac - My G4 600MHz took about 24 hour per hour movie. my dG5 - about 2 hours per hour (I use Pro Quality encoding)
    • Pro Quality encoding - takes about x2 to process a movie
    Yours Bengt W

  • Is there a tool available that can be executed by another process to scale the actual size of a PDF?

    Is there a tool available that can be executed by another process to scale the actual size of the printed PDF file by X%?  We are attaching PDF files to printed output using the Oracle DocuMaker product, and are running into margin issues with the attached PDF.  We need to keep a 3/4 inch margin on our pages for sorting/finishing equipment, and the attached PDFs do not all conform to our margin requirements.

    What email program are you using? And what do you mean by "Safari mail"?

  • How many different way can we call a BPEL process

    Hi Guys,
    How many ways can we call a BPEL process
    I know 3 ways
    1 ) Thru PLSQL 2) using Java API 3) From another BPEL Process.
    are there any other ways .... if so what are they ..... .
    Thanks
    Tom...

    Hi Tom,
    your normal BPEL process (a regular process you create with the "new BPEL process" wizard), can be configured in Oracle application server to be accessible
    - via SOAP over HTTP or
    - via JMS
    since it is has a WSDL based service interface.
    JDeveloper as well allows additionally more options for starting a BPEL process such as a file based interface, an e-mail as a starter etc.
    Still, I like to see the ESB as a virtualizer of the endpoint protocol, so I suggest you model the BPEL process regularly, exposing its functionality through WSDL and use ESB services that wrap your BPEL process to deal with the actual endpoints.
    Cheers,
    Hajo

  • How to create an OS command that can be used in the process chains

    I need to create a command that can copy files from one location to another for a unix machine.
    I have the commands for the unix machine, but need to create a Z customer command so it can be executed in a process chain in SAP

    Hi Again,
    You can use ABAP program in the process chain.
    I guess there are some OS level commands in ABAP which will allow you to open, close, read , write and move files.
    Serach in ABAP help or on net.
    Bes regards,
    Sunmit.

  • I inadvertently created a very large file. Not needing it I sent it to the Trash Can. However, the deletion process never completes. Any suggestions as to how to delete it ?

    I inadvertently created a very large file on my hard drive. Not needing it I sent it to the Trash Can. However, the deletion process never completes. Any suggestions as to how to delete it ? I re-installed the OS but the file was still there taking up needed space.

    Command-click all of the files you want to delete and don't actually move them to the Trash until you've gone through the entire folder.
    (63341)

Maybe you are looking for