THREADS PARALLEL TASKS

Hi Form
If have n tasks to execute in Simoltaniously with out any ' Sleep' process involved
1)Do I need to Put each task in a new thread, If So How ??
2)IDo I have to use Thread Groups , If So How ??
Please state the same with simple Examples.
Please Help me
Karthik

If there is no delay involved and all it does is use the CPU, then having more threads than CPUs is of no benifit at all. In fact it can add overhead which slows down your program. i.e. A CPU can only run one thread at a given moment.
If you want to use a ThreadPool I suggest you use the concurrency library (standard in version 5.0)
Use this version with JDK prior to 5.0
http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html

Similar Messages

  • How to create parallel tasks using parallel for loops

    Hi,
    I am setting up a program that communicates with six logic controllers and has to read the system status every 100 ms. We are using OPC datasockets for this, and they appear a little slow. 
    I have created a uniform comm. method for all controllers, and now I find myself programming this method six times to communicate with each system. I am wondering if this could be done more elegant using the parallel for loop, in which case I would program an exchange once and then have six workers running simultaneously. Since a picture is more clear that a thousand words, what I am asking is this:
    Is it possible to replace something like
    by
    and have this for loop running these tasks in parallel (on different cores / in different threads)?
    I have configured the loop to create 8 instances at compile, so I would have 2 instances surplus available at runtime if I find I need an additional system.
    The benefits of the method show in the second picture to me are:
    * takes less space
    * modifications have to be made only once
    * less blocks, wires and stuff makes it more clear what's going on.
    * flexibility in the actual number of tasks running (8 instances available at runtime)
    * if more tasks are required, I need only to update the maximum number of instances and recompile, i.e. no cutting and pasting required. 
    Unfortunately, I don't have those system available yet, so there's no way to test this. Yet, I would like to know if the above works as I expect - unfortunately the labview help is not completely clear to me on this.
    Best regards,
    Frans 
    Solved!
    Go to Solution.

    Dear mfletcher,
    First of all: thanks for confirming that my intuition was right in this case.
    As for your question on the help: below is a copy/paste from the help on the 'configure parallelism dialog box' 
    Number of generated parallel loop instances—Determines the number of For Loop instances LabVIEW generates at compile time. The Number of generated parallel loop instances should equal the number of logical processors on which you expect the VI to execute. If you plan to distribute the VI to multiple computers, Number of generated parallel loop instances should equal the maximum number of logical processors you expect any of those computers to ever contain. Use the parallel instances terminal on the For Loop to specify how many of the generated instances to use at run time. If you wire a larger number to the parallel instances terminal than you specify in this dialog box, LabVIEW only executes as many loop instances as you specify here.The reason for me doubting if what I programmed would work the way I intended lies in the fact that the help only mentions processors here, which would be interpreted as actual cores. Thus on a dual core machine, the number should be 2.
    I think it would be helpful to mention something about threads here, because in some case one would like to have more parallel threads than there are cores in a system.
    In mu case I would like to create six threads, which on my dual core processor would be spread over only two cores. Then these six threads run in parallel.I know that in case of heavy math that would not help, but since I am doing communications, which have timeouts and such, and that probably runs smoother in six parallel tasks even though I only have two cores. 
    Hope this helps in improving the help of the for loop.
    Regards,
    Frans 

  • How to enforce order of execution of parallel tasks?

    How do I set the order of execution of parallel tasks in a container?
    The execution isn't truly random. It appears to be set to a random constant at package creation.
    Demo
    I set up a dummy package.
    Max concurrent executions = 1
    sequence container with four script tasks that do a thread.sleep
    The tasks always execute in the order 4, 2, 1, 3. Closing/opening the solution makes no difference to the order of parallel execution.
    Is there a way i can change the execution order? Do I need to change the guid/id of the object (tried this but it invalidates the xml) or is there an order somewhere else in the XML?
    I've found a hack/workaround but it's a bit ugly so I'm wondering if there's a way to do it without adding dummy tasks.
    Basically if i create a dummy start task and then drag off "on success" constraints to each of the four threads, the threads will execute in parallel in the order in which i created the constraints
    Why do i want to do this? I have a number of parallel tasks in a sequence container where three will take a long time and the rest won't take as long.
    I'll minimise the time required for the execution of container by using parallel tasks AND controlling the queue order (longest first). It won't matter whether I have 1 logical cpu or as many logical cpus as i have tasks.
    Thanks
    Jakub @ Adelaide, Australia

    I think the problem you are trying to say is 
    a) You have multiple tasks( i assume 10) now out of these 3 execute slowly.
    b) You done have any constraints for task execution, so what you want to achieve is that the 7 task should continue without waiting for the other 3 in your case the 3 are starting up earlier and other 7 are not able to start as a result.
    AS arthur pointed out these are 2 diff things constraints and parallel execution, and there would always be some task which would be started at some point of time.
    But if you know in advance some tasks are going to take time, i would suggest keep 2 diff sequence containers in 1 keep the 7 tasks which runs fast in another one keep the other 3 which tend to run slow
    Abhinav http://bishtabhinav.wordpress.com/

  • Task's Process context doesn't get updated in parallel tasking

    All,
    I have a parallel task in my BPM process flow; the parallel task can have a max of 3 owners. The owners can either approve / reject the task. There are 3 boolean attributes in the process context that are used to store the decisions of these task owners.
    When the process is initiated, these 3 attributes are set to true. So, there is no issue if all the 3 owners approve the task. The flow continues. If one of the owners reject first, followed by the other 2 owners approving the task, then the decisions are not captured. Hence, rejection flow is not triggered at all. But if the first 2 owners claiming the task approve and the last one rejects, the rejection flow is triggered.
    Observation: When a owner approves / rejects, I am able to see the changed decision in NWA PROCESS context and in the output mapping of this task. But now, when the 2nd owner claims the task, the input mapping of this task doesnt have the updated value of the first owner's decision.
    How to solve this issue?
    Can someone please assist?
    Many thanks,
    Subathra M

    Hi Subathra,
    Is it the same webdynpro component that is assigend to the 3 parallel task? In that case you can use one attribute to capture the decision. if tthe first user selects approve and then the second user select reject the attribute will be updated to reject.
    Regards,
    Shilpa

  • Changing OSM task state/status from another parallel task flow

    Hi, guys!
    I have a problem with implementing parallel task flow. Let's consider such situation: there are two parallel task flows, the first flow contain manual task, upon completion which I need to change second flow's task state/status and vice-versa. I studied XMLAPI functions, wsapi operations, api from automation package but couldn't find appropriate aproach.
    Thanks!
    Edited by: serj129 on 15.08.2011 2:50

    Have you any suggestions?
    I tried to implement 2 automation task, which contain automation plugins. First task implemented xquery sender as completed event, the second task implemented xquery reciever, which changes status to success, but this approach isn't working.
    All properties of automation plugins configured properly, but I always receive next exceptions:
    ####<Aug 22, 2011 4:39:52 PM ALMT> <Warning> <EJB> <car07-eth0.telecom> <AdminServer> <ExecuteThread: '13' for queue: 'oms.automation'> <oms-automation> <> <> <1314009592567> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception was:
    java.lang.RuntimeException: No transaction associated with request.
    java.lang.RuntimeException: No transaction associated with request
         at oracle.communications.ordermanagement.cluster.message.ClusterMessageHandlerBean.onMessage(Unknown Source)
         at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:466)
         at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:371)
         at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:327)
         at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4585)
         at weblogic.jms.client.JMSSession.execute(JMSSession.java:4271)
         at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3747)
         at weblogic.jms.client.JMSSession.access$000(JMSSession.java:114)
         at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5096)
         at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
    >
    ####<Aug 22, 2011 4:39:52 PM ALMT> <Warning> <EJB> <car07-eth0.telecom> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1314009592571> <BEA-010216> <The Message-Driven EJB: BiTTLautomation.BiTTLautomation.OSMManualListenerMDB is throwing exception when processing the messages. Delivery failed after 185 attempts. The EJB container will suspend the message delivery for 60 seconds before retry.>
    ####<Aug 22, 2011 4:40:09 PM ALMT> <Info> <oms> <car07-eth0.telecom> <AdminServer> <Timer-8> <admin> <> <> <1314009609038> <BEA-000000> <impl.OrchestrationCascadingLRUPolicy: Evicted order /order/474 from orchestration cache due to cache entry expiry>
    ####<Aug 22, 2011 4:40:24 PM ALMT> <Info> <oms> <car07-eth0.telecom> <AdminServer> <ExecuteThread: '13' for queue: 'oms.automation'> <oms-automation> <BEA1-08945C597092560E5D6A> <> <1314009624879> <BEA-000000> <plugin.AbstractAutomator: Creating automation plugin [class oracle.communications.ordermanagement.automation.plugin.XQuerySender_iults7_Impl] built using SDK version [7.0.2.437]>
    I suggest that it is not correct approach, because of automation context restored from DB is related to other task.
    Have any ideas of changing task status from OSM DB directly. This approach is temporary, for compatibility with performing manual tasks in 2 systems: OSM and other
    Thanks!
    Edited by: serj129 on 22.08.2011 3:59
    Edited by: serj129 on 22.08.2011 3:59

  • DAC Lite maximum number of parallel tasks cannot be more than 5

    Hi,
    I am getting below error in my DAC server log.
    13 SEVERE Wed Feb 13 17:16:50 IST 2008 For DAC Lite the maximum number of parallel tasks cannot be more than 5
    14 SEVERE Wed Feb 13 17:16:50 IST 2008 For DAC Lite ETL can be run on only one Informatica Server.
    What does this mean? I have just done Oracle BI Apps 7.9.4 installation as per installation document on linux server. Do i need to do any configuration changes to rectify this? I don;t understand why this error is coming. I restarted my server also but still i am getting the same error.
    I have only one informatica server installed on DAC server.
    Thanks,
    Prasad

    Check the settings for your Informatica Server on the DAC Setup View.
    There is a Max Sessions variable. What is set to?
    To be honest I have never seen this "DAC Lite" entry. Something has not been installed or set up properly.
    Is this an installation on Windows or Linux?
    If Linux/UNIX I suspect a file was not change to Unix format when it was copied over from Windows and that may be having an impact on things here.

  • Parallel Task Error resolution for Marketing Campaign Load

    Hi,
    During a Marketing campaign load, we encountered the "Parallel Task Error".
    Description of error:
    Error/Warning : Error invoking service 'Mktg Data Load Service', method 'CampaignLoad' at step 'Load Segment Tree Cells/Segments'.(SBL-BPR-00162)*
    +*
    One or more of the parallel tasks may have encountered an error.  Any queued tasks that were scheduled to follow the failed task have been cancelled.(SBL-MKT-00453)*
    Further investigation revealed that the unique constraint on the S_CAMP_CON table was not being met. As per a suggestion by one of the Oracle Support Web's SR, they had asked to change the value of the field 'Token Number' (in the load file format) to a randomly generated number using the formula:
    CAST((RCOUNT(1) + 001) as varchar(40)) || '001')
    However, the issue arises when we assign more than one nodes of a segment tree to a campaign. Due to this, the token number would be repetitive between records of the two nodes.
    Hence, to overcome this error, instead of defaulting the value of Token Number to a system generated field, or using the above function, we made it default to a unique value (for example: account id), coming from a database column. This way we made sure that the token number is unique for all the records being loaded by the campaign.
    This resolved the error, however we would like to confirm if this is the right approach? Can someone let us know if there is any other solution to avoid the error?
    Thanks in advance

    Hi,
    During a Marketing campaign load, we encountered the "Parallel Task Error".
    Description of error:
    Error/Warning : Error invoking service 'Mktg Data Load Service', method 'CampaignLoad' at step 'Load Segment Tree Cells/Segments'.(SBL-BPR-00162)*
    +*
    One or more of the parallel tasks may have encountered an error.  Any queued tasks that were scheduled to follow the failed task have been cancelled.(SBL-MKT-00453)*
    Further investigation revealed that the unique constraint on the S_CAMP_CON table was not being met. As per a suggestion by one of the Oracle Support Web's SR, they had asked to change the value of the field 'Token Number' (in the load file format) to a randomly generated number using the formula:
    CAST((RCOUNT(1) + 001) as varchar(40)) || '001')
    However, the issue arises when we assign more than one nodes of a segment tree to a campaign. Due to this, the token number would be repetitive between records of the two nodes.
    Hence, to overcome this error, instead of defaulting the value of Token Number to a system generated field, or using the above function, we made it default to a unique value (for example: account id), coming from a database column. This way we made sure that the token number is unique for all the records being loaded by the campaign.
    This resolved the error, however we would like to confirm if this is the right approach? Can someone let us know if there is any other solution to avoid the error?
    Thanks in advance

  • Parallel task for comments

    Hi,
    Is is possible to create a parallel task to let a few user enter comments while the workflow is still running and tasks being completed by other users ? (I mean the users who receive the comment task in their SAP inbox does not block the rest of the WF and wether they have completed their task or not, others can still perform their decision task)
    Where would the comments be stored in that case ?
    Thanks in advance for you help.
    T

    Hello,
    You'd have to decide beforehand who can add the comments - they will be the ones receiving the workitem.
    The commnts can be stored in the workflow container, or the users could add attachments. In both cases you could have the workflow do something with them at the end (eg send them somewhere).
    You could have a 1-from-2 fork, one with the comments and one with the rest of the workflow. The comments branch could loop around, waiting each time for more comments.
    regards
    Rick Bakker
    Hanabi Technology

  • What is the difference between thread and task

    hi ,this is guruvulu bojja
    what is the diff between thread and task .
    can u give me the example for distinguish a thread and a task .
    How can i know thread is better than a task .
    please tell me what is the task in o/s level and task.
    <b>how the o/s distinguish a therad and task.</b>

    Hi Guruvulu,
    <b>Threads</b> enhance performance and functionality by allowing a program to efficiently perform multiple <b>tasks</b> simultaneously.
    In the case of <i><b>common memory</b></i> <b>threads</b> naturally have shared data regions while it has to be specially created and initialized for <b>tasks</b>.
    Simply put, a <b>thread</b> is a program's path of execution. It allows execution of two or more sections of a program at the same time.
    Regards,
    Pooja.

  • Parallel Tasks but Optional

    Hello Everyone.
    I have a requirement where I need to fork 5 parallel tasks ( all different subprocess), wait for 4 to finish and complete the join but let the 5th one be optional. It means that The join does not need for the 5th task to be completed. The 5th subprocess again forks off multiple tasks ( all same task this time) which may be treated as separate tasks and has no dependency on each other, can be performed at any time. This means that they dont have to join for the 5th subprocess to be end.

    If you just want any 4 of the 5 to complete before continuing, add a new integer instance variable. In your Join activity, add this logic:
    counter = counter + 1
    if counter > 3 then
        action = RELEASE
    end
      If it's one specific subprocess you do not want to wait for, create 4 Boolean instance variables that represent each of the manditory subprocesses. Each of these would be set to true as their copy spawned by the Split reaches the Join activity. Your logic in the Join would look like this:
    case copy.activity.source.id
      when "IdOfSubflowActivity1" then
           flag1 = true
      when "IdOfSubflowActivity2" then
           flag2 = true
      when "IdOfSubflowActivity3" then
           flag3 = true
      when "IdOfSubflowActivity4" then
           flag4 = true
    end
    if flag1 && flag2 && flag3 && flag4 then
        action = RELEASE
    endDan

  • Do more Number of Threads reduce task duration

    Hi,
    Ihave made an application which 100 parse an XML and writes it to a different file. And it takes some time this task is done is different thread. If I use 5 threads or let say 10 threads to perform this task. Will it make any difference or it will take some what same amount of time.
    Thanks & Regards
    Ritesh

    It all depends on how fast your discs are etc. I think
    the slow part is to read/write from/to disc, and too
    many threas will only make it worse (since the disc
    has to read/write from several places on the disc).
    Not just that but the scheduling of those multiple threads eat up CPU time (and a bit of RAM) as well.
    And unless you have a multi-CPU machine they won't run truly in parallel.
    So it could well take longer to complete the entire task (even if small files might appear faster if processed in different threads from long one, those long ones will then take longer).

  • How to run two thread parallel y on two cores of dual-core ??

    I want to run two threads on two cores ???
    is there any package which support parallel computing??
    can we do this by using java.util.concurrency pakage??
    Thanks you
    please Reply.....

    vikram_p wrote:
    I want to run two threads on two cores ???ok
    Threads are automatically spread over the available cores, as the OS sees fit.
    is there any package which support parallel computing??Java does so without any external libraries.
    can we do this by using java.util.concurrency pakage??yes
    One question mark per question is plenty, thank you.

  • Can Essbase support more than 8 threads parallel processing?

    Recently both AMD and Intel start to release their 6 cores Xeon CPU to achieve higher CPU performance. Existing Essbase can configure to max 8 threads in parallel processing, will Oracle consider to upgrade the configuration parameters e.g. max 12 threads so that Essbase can enjoy the benefits from hardware upgrade?

    What we have tested is even with the the max no. of threads is 8 in 64 bit server, It didn't help us in improving the single explicit job performance compared to 4 threads in the 32 bit server.
    But the 64 bit server provided the more stability when multiple explicit jobs are triggered parallel by the way we can make the batch window short.

  • Parallel Task Processing

    Hi all,
    due to some performance issues - I have broken a task into 4 tasks so that they can be run in parallel.
    The particular task is the 1sided reclass (it is taking 22-23 mintues to run)
    I have broken this into 4 tasks, each pointing to different sets of companies.
    However when the task group is kicked off - a little while later I get an error message re data is locked.
    I have 4 tasks - each assigned to a method.  Each method is assigned a set of companies in the trigger, and in the source I have set company as inherited from trigger.
    I cannot understand why the data would be locked when each task is looking at different companies.  Also - we are using the matrix scenario, but each PC is only assigend to a single company.
    Anybody got any ideas.
    Thanks

    Eugene
    I have four methods - and I assigned a single company within each method - to see if this would work - but it did not.
    Is this what you meant when you said to assign the appropriate method to eash company individually ?
    Thanks

  • How to create Threads or Tasks in ABAP OO

    Hi,
    I would like to know if it is possible to run a method of an ABAP class in background. I know that it is possible to run Function modules in background.
    Does something similar exists in ABAP OO like Threads in Java or for example .Net?
    Kind regards
    Michael

    No, this is not supported in ABAP OO, as you know it is supported by funciton modules.  At some point I would think that SAP will bring this functionality to classes, but we will have to wait and see.
    Regards,
    RIch Heilman

Maybe you are looking for

  • Encrypt/decrypt streams with same password

    Hi all! I'would like to know if I can encrypt/decrypt streams using key's which are hardwired in my application. By a hardwired key I understand a key which is generated using the same seed; practically I don't keep the key, but the minimum info to r

  • Getting socket permission exception

    package LoadDriver; import java.sql.*; public class LoadDriver public Statement driver() throws Exception String dbUrl = "jdbc:db2:deal://extreme:50000"; String user =""; String password =""; Statement s; Class.forName("com.ibm.db2.jcc.DB2Driver"); C

  • Play back quality

    Hi When I burn a dvd it plays back with no problems on my mac but on my set top dvd it seems to jitter and shimmer. suggestions appreciated. Thanks. Trevor

  • Runtime error smartform

    HI experts ,                   I have smartforms for Stock Report. and respective selection screen in se38. while executing its shows Below runtime error. Runtime Errors         CALL_FUNCTION_CONFLICT_LENG Exceptn                CX_SY_DYN_CALL_ILLEGA

  • Wireless Router 877W users cannot get ip address from DHCP

    Users can connect to wireless but they cant get ip address what can be the problem ? Thanks no aaa new-model resource policy ip subnet-zero ip cef no ip dhcp use vrf connected ip dhcp excluded-address 10.10.10.1 ip dhcp excluded-address 192.168.239.1