Is it possible to have 2 threads running at the same time?

Is it possible to have 2 threads running at the same time at different times eg 1 repeats every 20 miliseconds and the other 40 for example. Also could you have 2 run() methods in one script, in one file? If so how? Help soon would be appreciated. Thanks.

Is it possible to have 2 threads running at the same
time at different times eg 1 repeats every 20
miliseconds and the other 40 for example. Yes.
http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html

Similar Messages

  • How do I use the same SubVIs in the different VIs? Those VIs have to run at the same time.

    Hello,
    If I have two VIs.And both of them has the same SubVIs.
    For example
    VI1 contains:
    SubVI1: Initialize Instrument
    Data acquisition
    SubVI2: Close Instrument
    VI2 contains:
    SubVI1
    Monitoring the Board and VI1
    SubVI2
    When I run those two VIs at the same time, why can't I use SubVI2(which is in the VI1) to close the Instrument?
    The function has been run correctly, but it didn't work. The VI1 did closed, but the instrument didn't closed, neither did data acquisition.
    In order to close instrument, I have to run SubVI2(which is in the VI2).
    What I want to do is that when I run SubVI2(which is in the VI1), then, the instrument closed and data acquisition stopped.
    Is there any problem between the thread? Or anything wrong with SubVI's VI property?
    Thanks a lot!

    Hi, everyone
    Thanks!
    It seems that I didn't solve this problem, but now I maybe understand why it happened.
    GerdW  said:
    Why do you want to initialize an instrument in 2 different places?
    Why do you want to close an instrument in 2 different places?
    Graziano  said:
    i guess the problem is that, running two times SubVI1 you initialize instrument two times (it is not desirable...), and, worst, running SubVi2 you close instrument twice!
    That makes me think about the number of doing init & close. My project calls on that there must be a strict requirements about the number of calling those function in one process.
    That is to say,when running them, if VI1 and VI2 are in different process but not in the same one, the program is going to run successfully. But now, VI1 and VI2 are threads which in the same process, so my project's strict requirements makes them run failue.I used SPY++ to analysis, and found those two threads are actually in one process.
    Graziano  said:
    I suggest to put SubVI1 and SubVI2 outside VI1 and VI2, and you run them once, at the start and stop of your measurement.
    I believe that is a good idea, I can deal the problem in this way. Thank you!
    But if anybody has the idea which can deal with the problem between the threads, I will be so glad......
    What does that called, Synchronized between threads.....maybe......
    To altenbach
    I am afraid showing the code doesn't work, because all the VI SubVIs and code is base on the japanese system.and all of them must call the functions form DLL which is protected by my company. I am sorry about that......
    Thanks a lot!! Everyone.

  • How many threads can be running at the same time

    Hi!!
    Dows anyone knows how many Threads can be running at the same time in the JVM.
    I'm making a multi thread client-server app and I would like to know how much simultneous connections the JVM support. I'm using one Thread per connection.

    Hi, thanks to all for your answers.
    I think that I made the wrong question, as you said: "that means the number of threads currently created".
    I'm worry about this because my application is already online (It's a mail server -SMTP and POP3 server using ORACLE for the users database- ) and some other user post in the "multi-tread forum" that almost any JVM can only have 700 threads created at the same time, and I've never heard or read anything about this.
    what you mean with the stack space (memory??)
    I'm using the JavaWebServer 2.0 and a servlet to start the main Thread.
    Again Thanks to all for the answers but I think that the schapel answer is the one that solve my doubt...

  • Java threads. Are they running at the same time?

    Hello everybody. I am implementing a multiagent system in java and at some point in the program i need a specific function (from a specific class) to run at the same time in several "copies". Those functions are communicating with each other with some messages, so as you can understand not running at the same time is a big problem because of this messages.
    Below i am giving you an example of the code i am using. I would like your opinion whether those functions are running parallel or serial. If they are not running parallel what should i do? Any opinion or something that can help me would be perfect. Thanks in advance.
    //my class
    public class Agent extends Thread {
                           public void MinConflicts(Agent array[],int max_moves){//code in here}
    public static void main(String[] args) throws IOException {
                  Agent[] fbi = new Agent[num] //num is inserted by the user
                 //code here
                 for(i=0;i<num;i++){
                         fbi.start(); //starting the treads
    for(i=0;i<num;i++){
    fbi[i].MinConflicts(fbi,max_moves); //running the function that i want to run parallel
    //code here also :)

    What you appear to be doing here is creating an array of Thread references (which I hope at some point gets populated with actual Thread object references!)......because your first loop is wanting to cycle through each array slot starting the referenced Thread. Then the next loop iterates through the array again, this time calling the method for each Thread object.
    Assuming that you do populate the array, what this code will do is start each Thread which, I believe, will start and immediately terminate because run() has not been over-ridden. The second loop winds up calling the method for each Thread in the array. You are actually calling it from the main thread though. So, as previously advised, I think that you will run each method sequentially.
    The direction that I would head with this is to override run() in your agent Thread and have that run() method call the MiniConflicts() method. Then, in your main routine you can do away with the second for loop. The looping start will start all of the individual threads and they will execute the run() method......which in essence will be executing your MiniConflicts method.
    This reply is NOT a total design... I am sure that there are holes to be filled... but I think that will get you headed in the right direction.

  • I have a mac book pro i7 2.00Ghz and 4Gb RAM. I want to run at the same time Omnisphere,Trilian and BFD 2. Will it work fine? Anybody that has some experience? Thanks

    I have a mac book pro i7 2.00Ghz and 4Gb RAM. I want to run at the same time Omnisphere,Trilian and BFD 2. Will it work fine? Anybody that has some experience? Thanks

    Well this is not a problem I have already bought one, my great worry is the processor and the memory..

  • Multiple scripts running at the same time?

    Is there a way to have multiple scripts successfully running at the same time?
    At the moment if I start a second script while the first one is still running, the second one completes successfully but the first one stops. This seems to be because the first one is no longer the active document once the second one opens so can't continue.
    Is there another way to script things like this so that multiple can run independently at the same time? You might ask why I'd want to run two at the same time and not just wait, but i've setup an asp.net web form front end and having problems if two people click the button around the same time.
    I'm guessing this isn't going to be possible and i'm going to have to look for ways of doing this in asp.net instead and somehow queue the requests so you have to wait longer if the script is already running?
    Thanks,
    Andy

    I'm
    guessing this isn't going to be possible and i'm going to have to look
    for ways of doing this in asp.net instead and somehow queue the requests
    so you have to wait longer if the script is already running?
    This is correct. The scripting interface to PS is single-threaded so you will need to queue up requests.

  • Two processes running at the same time in Lookout

    I have installed Lookout 5.0 with 200 I/O Points onto our server computer. The application of motion control is next to the 200 I/O points through OPC PMAC server/client. Now I would like to have a second process in the same server for trouble shooting and testing without stopping the motion control process. However, this second testing process could have also many I/O points through Serial and USB ports. I assume that the total amount of I/O points of both processes will be greater than 200.I prefer to have independent processes for control and testing because access levels. Can I have these two processes running at the same time when needed?

    Hi,
    From your description you are using a third party OPC server for the motion application. You could have a second Lookout process communicating with the same OPC server with no problems, as long as you do not exceed the number of I/O points your license supports.
    Also, the process you are using for testing obviously could not overwrite datamembers (or registers if you will) that would interfere in the overall application, in other words you can test your application as long as you keep the coherency of the test.
    So the answer would be, yes it is possible, however you are still limited to the number of I/O's your license supports... You may even consider upgrade the number of I/O's you have in your license.
    Best Regards
    Andre Oliveira

  • Having two background brarchive running at the same time with -f 1 options

    Good morning,
    I need to run two brarchive in parallel as background  process.
    I would like to have on for the save and one for the copy.
    I need that because they would have different files.
    1. Is this configuration supported or not?
    As a file is created for the locking (.lock.bra) I have the feeling that a single process is supported?
    2. Just to double check, can I run two brarchive with two different config file in a serial manner
    (lauch the 1st one, wait for its end, launch the 2nd one, waits for its end).
    3. If you are using that kind script on your systems, could you please provide them?
    4. If brarchive is launched by a script how do you shut it?
    Do you do just a kill of the script or do you kill it and send another signal to the brarchive if it is currently running?
    Thanks in advance for your answers.

    Good afternoon Eric,
    > Why do you want to use option -f 1? what are the reasons being this?
    -f makes it run in background.
    For me, there two advantages for doing that.
    1. You start it once, when you start sap, and it runs regularly
    2. When you stop sap, you stop braarchive.  Then you are sure that no crontab jobs are going to be started when you have stopped SAP.
    > you want to stop  brarchive with option -f running? try:
    >
    > brarchive -f stop
    This is what is currently done right now.
    It works well.
    I can use it because we do a single copy of the archive log up to now.
    We are going to run two brarchives (one to save to a tape robot with backint and one that scp).
    I would like this to run as daemon.
    Now, that you have answered that I can not have two brarchives running at the same time (thanks for your answer),
    I need to write my own daemon in sh or perl that would do:
    1. Run brarchive first run (with -p backint init<SID>.sap file)
    2. Wait for the en of the brarchive process and log
    3. Run brarchive second run (with -p scp/stage init<SID>.sap file)
    4. Wait for the end of the brarchive process and log
    5. Sleep during a few minutes
    6. Handle stop signal so that it ends the forked brarchive that may be running.
    I am sure that people on this forum have already wrote such scripts.
    I may open another thread as it divert a little from my original question.
    Thanks in advance for your help.

  • Two different Resultsets for the same query (running at the same time)

    I am using the Thin Driver for Oracle 8.1.6. I am invoking queries in multithreading mode (each thread has his own connection to the oracle DB). If i am invoking the same SQL-Statement in two different threads nearly at the same time, only the ResultSet of the first query is complete. The ResultSet of the second query is not complete (the number of tuples differs each time I run the program). Principally the two ResultSets should be the same (no changes are done at the same time in the DB), but they are not.
    Anybody knows this problem and knows how to solve it? Principally read accesses on DBs should not make such trouble ...
    I hope anybody can help me.

    Pranav,
    As this BADI is having option checked 'Multiple use'. You can implement multiple implementations.
    You need not to deactivate the existing implementation.
    Reddy

  • Multiple Libraries for Video running at the same time on one PC

    Hi Everyone -
    I want to clarify this is for VIDEO files, not music for my 6 ATV's on the network.
    Problem: I have well over 1000 VIDEOS in my iTunes Library, and I am wanting to have multiple libraries availible at the same time; not just whichever the computer has open.
    We have several atv's on the network and I would like to take my video organization one step further; instead of scrolling forever in the atv menus for the video you want; I could make several libraries all availible at the same time. 
    Such as:
    Kids Library
    Workout Library
    Parents Library
    etc
    This in turn would shrink the primary library and have less videos to sort by.  I know how to create the Libraries, I just dont know how to have them all running at the same time.
    Infastructure:
    Windows 7 Ultimate with Drobo B800FS (16TB of storage) all connected to Cisco 3660 Gig switch with multiple atv's hardwired back.

    iTunes can only open one library at a time. If you have multiple computers, or virtual machines, each could be serving a different library.
    tt2

  • Can a vodcast and a photocast run at the same time ?.

    Hi,
    I would like have a video podcast play and a photocast run at the same time is this feasible?
    Geoff

    Since they're different apps and there's no way to sync something like that: no. Sounds like you could just do a video slideshow to me. That's supported by all major video creation apps.
    -S

  • FRM: 10270 Cannot attach the library when two forms run at the same time

    I get the error message FRM: 10270 Cannot attach the library SYSLIB while opening menu BMENU but only when i try to open a second form while the first form is still running.
    Both forms are working fine as long as they ar not running at the same time.
    It seems like the second form opening does not have access to the FORMS60_PATH, because you can not open a third form because it can't find it.
    All the forms anf libraries (plx)is in the FORMS60_PATH.
    I am running developer_6i forms & reports on a HPUX 11i machine and I am trying to access them through jinitiator 1.3.1.9 on a XP machine.
    Best regards
    Macke

    Thanks a lot for the tip. I used truss and realised that it found the library but was not allowed to open it. The kernel parameter maxfiles was set to low.
    I increased it and everything works ok
    BR
    Marcus

  • Dreamweaver and Fireworks won't run at the same time

    Recently, I've run into a problem where I cannot run Dreamweaver and Fireworks at the same time.
    I have Dreamweaver CS4 & Fireworks CS4, which I can still run at the same time.
    However when I run Dreamweaver CS5.5 and try to launch Fireworks CS5.1 I get a C++ Runtime error in FW CS5.1.
    And when I run Dreamweaver CS6 and try to launch Fireworks CS6, Fireworks CS6 freezes before fully loading.
    If I run DW CS6 and launch FW CS4, I can get them both to run together, but when I close FW4, DW CS6 crashes.
    Any suggestions would most appreciated.
    David

    Historically, I've always kept prior versions installed because sometimes, albeit infrequently, I need to access extensions that aren't compatible with the newer versions of CS. Since I can run DW & Fireworks CS4 together, I'm inclined to leave them installed.
    I've thought about uninstalling CS 5, but I don't think that would resolved my issue. I've already tried most of what's in the Adobe troubleshooting suggestions save for creating a new administrator account.
    I think I'll hobble along with my current workarounds since I'll be migrating to a new computer very soon, which should acomplish what creating a new administrator account would. I'll probably limit the reinstall to CS 6 to eliminate any issues that might be related to having multiple versions installed, which in reality shouldn't be an issue because again, I've always done that successfully in the past.
    Thanks for the suggestion just the same.

  • Two Telnet read VI's running at the same time interfere with each other

    I have a situation where multiple tests must test multiple UUT’s on the same computer. To send commands to and get responses from the UUT's I use a telnet session. The telnet read VI uses a semaphore. Therefore when two separate top level VI's are running, each calling the Telnet read VI, if one Top Level VI is using the Telnet Read VI the other Top Level VI waits for the first one to complete before it can use the Telnet Read VI. This VI is setup for reentrant execution but because of the semaphore it cannot truly be used as a reentrant function. This causes severe problems when trying to communicate with two different telnet sessions simultaneously.
    In the past I have avoided this problem by compiling everything into an executable. Then each Top Level program runs completely independently with no interdependences. However, now I am implementing Teststand and I need to call the same Top Level VI's. I need to be able to get information into them and back out of them from Teststand. This means that I can no longer compile them into stand alone executables. I did compile each top level VI into its own Share DLL thinking that then each top level program would have its own library to call upon. This did not work. Even though both top level programs are compiled into their own DLL there is still interdependency when calling the telnet read VI. One program waits for the other to finish reading from its telnet connection before it can read from its own telnet connection. Since I have to continuously read from the telnet connection, sometimes for up to half and hour, the tests do not function simultaneously. How can I get around this? Is there a solution?
    Josh
    PS The Telnet Read VI I am refering to came with the Internet Toolset package. Attached is a copy of the VI I use to communicat with the UUT's.
    Attachments:
    GUI_Telnet_W-R_Auto.vi ‏64 KB

    Sorry about the confusion.
    The file I attached is in the hierarchy of two separate top-level VI's. The telnet connect is opened once and closed once in each top-level program. The ref number is then passed into and out of the VI that I attached. I use this VI to repeatedly send commands via telnet and wait for the appropriate responses. The telnet read VI is given a read line separator and reads from the telnet connection until it matches the read line separator with a text string read back from the telnet connection. If not match is found it times out and creates an error.
    I am not sure how to provide an example of the overall scheme since the problem occurs when both top level VI's are compiled each into their own shared DLLs. Those DLLs are then call from Teststand and at some points they are both running at the same time on the same computer connected to two different UUT's.
    The question I have is why does one DLL share functions with the other? When one DLL is using the telnet read VI the other DLL waits for the first one to finish with it before it can it use the telnet read VI. If they were both compiled separately each into their own DLL shouldn't they each have their own set of functions to call upon instead of having to share? I know that if the two top-level VI's are not compiled they cannot both execute the same sub-VI at the same time. The only way to get around this is to set the execution property on the sub-VI to reentrant.
    I actually fixed the problem by setting the VI I attached and the Telnet Buffered Read.VI (called by Telnet Read.vi) execution properties to reentrant. However, I am still concerned about two separate DLLs sharing sub-VIs. Why does it do this?
    Joshua

  • If I have two appointments at the same time, they overlap in the iOS 7 calendar rather then appearing side-by-side so that I can't read one of them due to the identical colors of the two appointments.  Is there any way to fix this with a setting?

    If I have two appointments at the same time, they overlap in the iOS 7 calendar rather than appearing side-by-side in the daily view, so that I can' read both of them due to the same background color.  Is there a way to change this via a settings change?

    I fyou have "all day" event that are taking up the entire day, check the event. All day event only appear at the top of the time line (and just below the week view). I suspect they are not actually set up as all day, but have specific time frames assigned.
    In teh screen shot below, "Sample" is an all day event; NFL: CAR@SF is not.

Maybe you are looking for

  • Relative links within a content area

    Hi Have anyone created a relative link, that is an anchor that points to a resource in the same page or content area, that works with the Portal Pages?. Thanks

  • Help with array (cont)

    here is the driver program if that helps: import java.util.Scanner; public class Project7ADriver       static RandomIntList list = new RandomIntList(10);       static Scanner scan = new Scanner(System.in);     // Create a list, then repeatedly print

  • Classname AbsTime not Found WTH?

    Win Vista, LV 8.6.1 OK, so I got around the can't-resize problem of yesterday by trashing the cluster and moving the old contents into a new cluster. I hadn't edited that cluster typedef in years, but now I want to add some stuff. One of the things I

  • Early 2008 MacPro/UPS shutting down too quickly?

    apologies in advance, as I'd bet this has been covered before - just couldn't find it with Search? the problem is - in broad, general terms - I have an early 2008 8-core hooked up to an APC UPS XS 900 battery backup. The Mac Pro's a couple of years o

  • Videos don't play until fully buffered?

    Every video i try to play doesn't actually start till the video is fully buffered. It's not so bad if its a 2 min video but if im trying to watch a movie or a long youtube video i have to wait ages till it'll actually work. any suggestions on how to