Generally, when is mutex required?

I am using the VI Server to launch multiple, identical .vit's in top level subpanels. It seems to be working fine.
However, I have been reading up on re-entrancy, Semaphores, LabView threading, etc. and am now adequately petrified there is a potential for disaster here if I am not careful.
Are there some simple guidelines for when to protect shared objects from concurrent access and when not to worry about it? It gets confusing when multiple identical VI's are running. I have not made them re-entrant, but they are obviously running concurrently. I am guessing that since they were created from a .vit they are technically differently named VIs, right? What surprises me is that a common sub-VIs called by the .vits also runs concur
rently...... and this is a normal VI (not re-entrant).
I gather from reading that in some cases (such as when a DLL call is involved) that some inherent protection is provided and I do not have to worry about it. Do I need to open the diagrams of all subvi's called in order to assess this threat or not?
Other cases (such as a VI that Reads-Modifies-Writes a global variable) concern me. In this specific case, the ReadModWrite.vi is called as a sub-vi from the vit's -- do I need to be concerned with protecting the global with a mutex (semaphore)? How about if the read/mod/write were separated into 3 different sub-VIs (hypothetically)?
If I make sure that anything "critical"(Globals R/Mod/W, GPIB Write/Query, etc) is accessed from a VI that is non-reentrant, then does that solve the problem?
I apologize for the shotgun question, but this issue really does affect many aspects of LabView.

Great question Mike!
A mutex is required when ever you have a data structure that can be modified by more than one entity.
That is the short answer.
These mutexes do not have to be explicit! LV uses mutexes "behind the scenes" to ensure non-re-entrant VI's are not executing at the same time.
So if I understand your "such as a VI that Reads-Modifies-Writes a global variable" as a VI that shared by all of your VIT's that is the one and only method used to modify the global, then your global data is being protected by the mutex that protect the VI!
This is one of the benefits that come along with the "functional global".
RE: the dll calls.
The call library function will default to the user interface thread. The user interfacte thread is single threaded so this ensures there is only one call to to the dll at a time. If you re-configure the nodes then this does not apply.
You can combine the two above thoughts to be able to run a dll in a thread other than the user interface and still ensure only one call at a time. You put the dll call in a non-re-entrant VI. This will harness that same feature to ensure the is only one caller of the dll while allowing it to run in a thread other than the user interface.
So...
Most of the time I can get away without using mutexes (mutexi?) becuase I make extensive use of functional globals.
Now let me share how I architect LV app's and convince myself that I do run into the issues you have raised.
LV uses the data flow paradym so I design my aap's around the data, rather than around the process.
I will start defining my data objects based on the app's requirements.
These data objects can be globals, files, registers, GUI objects, etc. When I have the ability to define these objects (i.e. I can not define device status and control register formats) I will use techniques similar to what is used in DB design, keeping data grouped logicly while keeping LV performance in mind as I go (i.e. If I know I will be accessing an array of clusters based on one of the elements, I will copy that element off to a seperate array to facilitate quick searches, like a "key").
Once I have the data structures defined, I will then go through and design the code that will provide the functionality I need and take carefull note of who write the data objects and when.
It is durring this phase of the design that alarms will go off when I see that data needs to be modified from more than one place.
Each of the alarms are dealt with in turn and the conflicts are handled using the tools that come with LV (LV2 globals, queues, semaphores, etc).
So by the time I start coding I already know where my conflicts are and have plans in place to handle each.
I would be interested in hearing how others approach design.
LV is a unique dev environment that requires design techniques that are unique from other environments.
I hope this answers your question.
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • AnyConnect hangs when checking for required updates

    Several of our customers require us to use Cisco AnyConnect to connect to their computers.  I cannot connect to any of them because AnyConnect hangs when checking for required updates.  If I start AnyConnect myself, it will eventually (after five minutes) tell me that it cannot connect to a server.  If it is started from a web page, AnyConnect hangs forever.
    In the past, this error has been random.  If I try later, or the next day, it may work.  Or it may not.
    No customer has been able to give us any support on this issue.
    Could you please give me some ideas on how to overcome this problem?
    Thank you very much.

    Disable anti virus software if installed
    Make sure the firewall is turned off in System Preferences > Security & Privacy > Firewall
    Make sure Gatekeeper is enabled
    Open System Preferences > Security & Privacy then select the General tab.
    Make sure either Mac App Store or Mac App Store and identified developers is selected. If that area is grayed out, click the padlock icon to proceed.
    OS X: About Gatekeeper

  • Generally when creating a Word file from either a Mac or Win7 pc and opening it on two different machines (either one first) it always prompts that the file is open and will be opened as read only. However opening a CSS file does not prompt that it is alr

    Generally when creating a Word file from either a Mac or Win7 pc and opening it on two different machines (either one first) it always prompts that the file is open and will be opened as read only.
    However opening a CSS file does not prompt that it is already open on or from any machine which is causing code edits to be lost.
    What we found from out testing:
    - The file can be saved from one user to the server and WILL NOT PROMPT on other machines until the saving machine has the Dreamweaver program closed completely
    - The file can be closed and  Dreamweaver minimised to the launch bar but it still will not register on other machines that it has been changed.
    - Also, until the  Dreamweaver program is closed on the machines, it will continue to open it's saved version of the file. 
    Example Scenario:
    - User 1 opens test.css (which is 2000 lines) and adds some code to the end of the file to bring it up to 2500 lines
    - Meanwhile User 2 opens test.css as well (opens as 2000 lines as User 1’s edits have not yet been saved) and adds in code to bring it to 2300 lines
    - User 1 saves his file and closes it - but  Dreamweaver is still open.
    - User 2 also saves his file and leaves  Dreamweaver  open.
    - The server will report the size and last edit of the file the same as User 2 as he was the last person to save it (and if you open from the Win7 Machine it will show as User 2’s 2300 line version)
    - If User 1 then open's the file again (from either the 'recent' in Dreamweaver OR clicking on the file directly in Finder...which version opens.... The version that User 1 saved! Not the true version on the server, but the version that User 1 edited and saved with 2500 lines in it.
    - Same for User 2, he will open 'his' version with 2300 lines in.
    Other information:
    - Files are opened directly from the server
    - Sometimes the users will save incrementally and re-open
    - Most of the time users will save incrementally and keep the files open
    - The users will never not save incrementally and just save when closing the file once finished
    - The users are usually working on the files all day
    - It is always the bottom lines of code that are lost. It could be a case of the two versions being mixed up and cutting off the newly added lines based on the line count (possibly).
    It is as if Dreamweaver is holding a cache of the version locally and then only properly looking back to the server when it has been completely closed. It is very difficult to see how the server is causing such an impact on these files, there are very few logs which are giving any indication to the root cause of the problems.
    Anyone know if this is a known issue?
    Is there a way that there can be a featured implemented on the server that doesn't allow another user to open a file if it is already open on another machine?
    Thanks

    Your server file handling has nothing, and really nothing to do with Adobe software. If files don't get locked for (over-)writing and/or lose connection to the program opening them, then your server is misconfigured. It's as plain and simple and that. Anything from "known file types"/ file associations not being set correctly, MIME types being botched, crooked user privileges and file permissions, missing Mac server extensions, delayed file writing on the server, generic network timeout issues and what have you. Either way, you have written a longwinded post with no real value since you haven't bothered to provide any proper technical info, most notably about the alleged server. Either way, the only way you can "fix" it is by straightening out your server and network configuration, not some magic switch in Adobe's software.
    Mylenium

  • How do I keep my tabs open when I close firefox? I have tried the method in this site (tools- options- general- when firefox starts... but it didn't work.

    I used to be able to close firefox and have all my opened tabs saved. When I open firefox again, those tabs will be opened as I last closed firefox.
    Now, I am not able to do it. The firefox was crashed at one time earlier and I have to open the task manager to force it to close because it is frozen and so was my computer. After I opened it again, there is no tabs saved which I kinda expected. Then I
    go on web surfing and browse various websites. Now, when I close firefox, a box pops up warning me about the opened
    tabs will be closed. So I googled the symptom and it brought me to this website, telling me that if I set
    "tools->open->general->When firefox starts" to "Show my windows and tabs from last time", it should behave as it was before.
    I tried that but it doesn't work.
    Any help is appreciated.

    In case you use "Clear history when Firefox closes" or otherwise clear history:
    *do not clear the Browsing History
    *Tools > Options > Privacy > Firefox will: "Use custom settings for history": [X] "Clear history when Firefox closes" > Settings
    *https://support.mozilla.org/kb/remove-recent-browsing-search-and-download-history
    Clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, passwords, and other website specific data.

  • Strange white light appearing when password input required on locked apps!

    Strange white light appearing when password input required on specific apps... Locked apps.
    It is a thick white line) appearing momentarily on upper left side of my screen.
    This only appears briefly as specific apps are opening up .....only on apps where a password is required,(locked apps) like password managers, Apple App Store, etc.
    (this is a little troubling… And I'm wondering about the security of my phone now)
    I'm using iPhone 5s with latest iOS 7.1 This only started after the latest iOS update!
    Although this line appears very briefly, I was able to get some screenshots examples (see links)
    [IMG]http://i58.tinypic.com/1zo9dt1.jpg[/IMG]
    [IMG]http://i61.tinypic.com/260bns8.jpg[/IMG]
    Apple has no idea what this is… They're only suggestion was to wipe the phone clean and reinstall from the last backup! If that doesn't work, they would replace the phone.
    Before I have to do this, I'm wondering if this could be a phone app doing this, or the iOS or something easily explained/ remedied?
    Any ideas?

    Anyone have any thoughts on this? Searches and experiments
    still not yielded an answer...

  • HT2589 When I'm required to enter billing information, the window becomes invisible. Help?

    I just got my iPad 1 a few days ago. I'm trying to sign in to the App Store, but when I'm required to enter my (mother's ) billing information, the screen goes blank, and I can only tap aimlessly on the screen to enter random stuff into whatever field it could be. I'm purely guessing as to what the heck I'm supposed to be putting in the (invisible) blanks. Please help me, I really want the Instant Buttons app!

    Try resetting your iPad ..
    Hold the On/Off Sleep/Wake button and the Home button down at the same time for at least ten seconds, until the Apple logo appears.
    Then tap the App Store icon and see if you can login.

  • When it's required to share a single object in different classes????

    Hi friends...
    I am new to java programming language....
    when it is required to share a single object in different classes???
    and
    please give me one example with explanation...
    Thank you
    regards Shree

    sun_shree wrote:
    Thanks for all giving reply.....
    please write the constructor which is accepting reference and please,,,,,, explain......
    Thanking youNo.
    This will be covered in any Java textbook or tutorial. Like this one: [http://java.sun.com/docs/books/tutorial/java/javaOO/arguments.html]
    After reading it and writing some code of your own to test your understanding, if you still have a specific question, post again.

  • When UI is required,how to change UI content bgcolor style by css skin

    when UI attribute required="true",there will be an '*' in front of the UI,1in addition,i want to change this UI content bgcolor style by css skin,How to achieve this?

    You could do something similar to setting the inlineStyle attribute of the UI content whose background color you want to change.
    inlineStyle='#{(bindings.TreeBindingName.hints.RequiredAttributeName.mandatory) ? "#C8C8C8" : ""}'

  • Do any one can suggest the lifespan of i pad 4or i pad generally when no accident?

    do any one can suggest the lifespan of i pad 4or i pad generally when no accident?

    My iPad 2 will still give me 8 to 10 hour of continous use. It depends on how you look after your battery.
    Battery care
    1. Make sure you run the battery down to 5% and then charging it to 100% once a month.
    2. You should start charging your iPad when the battery charge is less than 10%. Over discharging the battery will shorten the lifespan of its battery.
    3. Never store the battery fully discharged. Apply some charge before storage, and then charge fully before use.
    4. When possible avoid frequent full discharges. Instead, charge the battery more often. There is no concern of battery's memory when applying unscheduled charges.
    5. Avoid iPad from overheating > 35°.
    6. Remove casing/sleeve when charging to allow heat to dissipate from back cover
    7. To safe battery power turn off :
    a. background app refreshing
    b. push notifications and/or push mail
    c. lower screen brightness
    d. minimize the use of location services
    e. increase Fetch New Data interval.

  • I currently have the iphone using imei is 013428003820386. I'm using normal. When I plug the phone into the laptop to copy the photos to your computer system requires update to the latest version. I agree to the machine but when the update requires activa

    I currently have the iphone using imei is 013428003820386. I'm using normal. When I plug the phone into the laptop to copy the photos to your computer system requires update to the latest version. I agree to the machine but when the update requires activation by icloud account. I logged in with my account but still not activated and security. My account is being used to send mail me this log. I respectfully request that you can help me to reactivate my phone. Thank you very much. I swear this is my phone and I have been using previously. Thank you, thank you

    Don't post personal details on a public user to user technical support forum where nobody can help you.
    If you want help, then contact Apple directly, but not here on a public user forum.

  • Q: General : When will you use Web Service as opposed to just Servlet and/or EJB?

    Hi,
    I don't know if this is an appropriate question to ask for this class as it's not
    workshop
    specific. I was wondering how will I decide when it is appropriate to use a web
    service as opposed to say servlet or an EJB for my application? What is a good
    rationale to use?
    Thanks,
    Sadhana

    Hi Adam,
    Thanks a lot for giving such a lucid explanation of my vague question!
    I understand now the difference between when to use EJBs/Servlets/Web Services.
    Thanks again!
    Sadhana
    "Adam FitzGerald" <[email protected]> wrote:
    >
    Hi Sadhana,
    Web service versus Servlet versus EJB. Which one to use? That is a very
    good question.
    EJBs should be the core desription and processing of your business rules.
    They generally
    have good performance, are easy to integrate into your security set up but
    they require
    access using the RMI-IIOP protocol. This means that generally EJBs are not
    accessible
    outside of your firewall and their clients have to be written in Java (other
    enterprise
    objects or applets or GUI applications).
    Servlets often form a web-based front end to EJBs. They also have good performance,
    integrate into security and only require HTTP access. This means they are
    accessible
    outside your firewall and any client with a HTTP or web API can call on
    them, however,
    there is no standard contract or rules for this type of interaction so you
    will need
    provide direct input into development of the client.
    Web services are also accessible via HTTP and so can be accessed from outside
    your
    firewall. In fact, Web services internally within Workshop and WebLogic
    actually
    operate by using servlets and EJBs but the main advantage is that the mechanism/contract
    for interacting with the web service is a well defined standard (WSDL) and
    can actually
    be registered or retreived dynamically (UDDI). Since web service standards
    are open,
    most popular programming languages already provide client APIs to interact
    with them
    thus freeing the web service developer from direct interaction with the
    client developer
    and letting the client be developed on any platform. The penalty for this
    openness
    is a small performance hit (XML translation) and a slowly maturing security
    model.
    So in summary, use EJBs for business operations that have Java clients within
    your
    enterprise, use servlets to provide web style access to your business operations
    (like web pages) and use web services to enable automated clients that can
    be written
    on any platform either inside or outside your enterprise (firewall). In
    fact, it
    is common to write the EJB first and then to expose some parts of it outside
    of your
    enterprise by writing a web service wrapper (maybe using the EJB controls
    that we
    saw in class).
    I hope this helps.
    Adam
    "Sadhana Jain" <[email protected]> wrote:
    Hi,
    I don't know if this is an appropriate question to ask for this class as
    it's not
    workshop
    specific. I was wondering how will I decide when it is appropriate to use
    a web
    service as opposed to say servlet or an EJB for my application? What is
    a good
    rationale to use?
    Thanks,
    Sadhana

  • Generally when does optimizer use nested loop and Hash joins  ?

    Version: 11.2.0.3, 10.2
    Lets say I have a table called ORDER and ORDER_DETAIL.
    ORDER_DETAIL is the child table of ORDERS .
    This is what I understand about Nested Loop:
    When we join ORDER AND ORDER_DETAIL tables oracle will form a 'nested loop' in which for each order_ID in ORDER table (outer loop), oracle will look for corresponding multiple ORDER_IDs in the ORDER_DETAIL table.
    Is nested loop used when the driving table (ORDER in this case) is smaller than the child table (ORDER_DETAIL) ?
    Is nested loop more likely to use Indexes in general ?
    How will these two tables be joined using Hash joins ?
    When is it ideal to use hash joins  ?

    Your description of a nested loop is correct.
    The overall rule is that Oracle will use the plan that it calculates to be, in general, fastest. That mostly means fewest I/O's, but there are various factors that adjust its calculation - e.g. it expects index blocks to be cached, multiple reads entries in an index may reference the same block, full scans get multiple blocks per I/O. It also has CPU cost calculations, but they generally only become significant with function / package calls or domain indexes (spatial, text, ...).
    Nested loop with an index will require one indexed read of the child table per outer table row, so its I/O cost is roughly twice the number of rows expected to match the where clause conditions on the outer table.
    A hash join reads the of the smaller table into a hash table then matches the rows from the larger table against the hash table, so its I/O cost is the cost of a full scan of each table (unless the smaller table is too big to fit in a single in-memory hash table). Hash joins generally don't use indexes - it doesn't use the index to look up each result. It can use an index as a data source, as a narrow version of the table or a way to identify the rows satisfying the other where clause conditions.
    If you are processing the whole of both tables, Oracle is likely to use a hash join, and be very fast and efficient about it.
    If your where clause restricts it to a just few rows from the parent table and a few corresponding rows from the child table, and you have an index Oracle is likely to use a nested loops solution.
    If the tables are very small, either plan is efficient - you may be surprised by its choice.
    Don't be worry about plans with full scans and hash joins - they are usually very fast and efficient. Often bad performance comes from having to do nested loop lookups for lots of rows.

  • Tips for Using Containment Relationships (When Are They Required?)

    Hello again,
    Our team was recently discussing when to use containment relationships, and we realized that there is room for improvement in our understanding. Having read many of the help topics, the primary use for containment relationships seems to be the ability to determine whether or not an entity is complete. However, as far as we can tell, in our work we have not yet encountered a need for the entity-completeness concept (if we have, it was unbeknownst). Instead, using a containment structure within a data model often seems to complicate matters by distancing entities from the Global (thus making it seem more challenging to reason across instances).
    My best guess, aside from completeness, is that containment relationships are required when mapping from a database structure (e.g. Siebel). For example, a model such as:
    Global
    - the invoice
    - - the invoice line item
    ...might interface more correctly with external data structures compared to a "flatter" structure such as:
    Global
    - the invoice
    - the invoice line item
    ...where a "regular" (non-inferred, non-containment) relationship would be needed to connect invoices to their line items. In the latter scenario, perhaps the relationship would be more difficult to define when the data were mapped over?
    I have a feeling we might be missing something obvious, but I'm curious to know what this community thinks about this question. Can anyone help, perhaps by providing a list of advantages / disadvantages to containment, or maybe the situations in which containment is always required?
    Thanks!
    - Patrick

    I've built numerous demo rulebases for integration, usually with Siebel so I'll use that as my example. What I have learnt through doing this is that integration will be easier if the logical structure of the OPA entities/containment relationships matches the logical structure of the Siebel business components.
    For example, if in Siebel you have something representing Global (which I'll call a Case for this example), and you also have several business components logically below Case, e.g.
    A Case can have multiple Contacts
    Each Contact can have multiple Incomes
    Each Contact can have multiple Resources
    Each Contact can have multiple Expenses
    I would set up the following entities/containment relationships in OPA:
    Global --> one-to-many --> the household member
    the household member --> one-to-many --> the household member's income
    the household member --> one-to-many --> the household member's resource
    the household member --> one-to-many --> the household member's expense
    Note that Contact (Siebel) = the household member (OPA). I could use "the contact" in OPA, but I prefer to use a more business-user friendly name such as "the household member" -- if they are indeed household members, it could also be the person, the taxpayer, etc. or whatever is appropriate for the source material.
    I assume this general principle still applies if the integration is with something other than Siebel.
    Cheers,
    Jasmine

  • [Personalize] when property is require.

    Hi all,
    In custom code for personalize. At field AUDIT_QTY.COMMENT, I want to require every time when user want to cancel sale order. When I'm custom code this item is require and want to cancel at sale order level, It can click EXIT BUTTON to return sale order block but at line of sale order level It can't exit normally. I need to close this form always and it show message "Filed must be entered" (at item : AUDIT_QTY.COMMENT). I don't understand why in header level is not found this error. Please help and advice me to solve this problem.
    Thank you.

    Hi, jpasan.
    Sorry for the delay. Does this happen only when you try to connect to a public Wi-Fi? If yes, how about connecting to a secure Wi-Fi? Did the issue still persist? If not, there will be a possibility that the connection is slower, given the fact that you are trying to connect to a public Wi-Fi.
    You can try to do the hardware reset on your phone. This will refresh the settings of the phone no data will be deleted. Just press and hold the volume down and the power button for about 10-15 secs. Wait for the phone to restart, then try connecting again.
    Just keep us posted. Thanks.

  • Cannot complete scheduled refresh when document library requires check in/out

    Hi,
    I have set up a report with a scheduled refresh but it fails with an error if the document library requires check in/out. In the refresh history it shows the error:- 
    'We couldn't save the refreshed report. ExcelServices operation ended with error: SavingWorkbookNotCheckedOut Correlation ID: 89eb08a4-b14d-45b6-8a34-581e505b67fe'
    If I remove the requirement to have the workbook checked in/out then the refresh works fine.
    Is there a way to have this work on document libraries when required check in/out is enabled?
    Best regards
    Aquila

    Hi Mini,
    Thanks for taking the time to help with this.
    Yes removing the requirement for check out does work, as was stated in my original post "If I remove the requirement to have the workbook checked in/out then the refresh works fine.". This is the workaround that I'm currently using but there
    are some reports where we would like to be able to prevent multiple users editing at the same time hence the required check out.
    We would like to be able to have required check out and scheduled refresh (because if you have cake you're going to want to eat it!), but I'm guessing it's one or the other at the moment.
    Cheers
    Aquila

Maybe you are looking for

  • Runtime error in menu using javascript

    i got a code for building menu using javascript from internet. But when run this file, it gives a runtime error stating Error: 'Trigger' is null or not an object.I am not able to rectify it. Can you please help me with this problem? Its very urgent..

  • Need help in Bpel transformation

    Hi I am reading the xml data file through partnerlink , the receive activity is dispalying the xml record. I want to transform that data into target xsd.The transform activity is not getting assigned. Regards mki

  • Maintaining Price Record for Different Stores and Distribution Centers

    Hi expert I want to maintain price condition record for condition type ZPR0 for one article for different store and different Distribution Center what is t.code and path if sales price should copy from purchase price what are setting thanks

  • Problems with standalone player on myspace

    Can someone help me with the standalone player on myspace. The player is supposed to start automatically. On my computer, it does not work at all neither with IE7 (beta2) nor Firefox. Please help!

  • Material description is repeating

    i hv developed a program in which a material description column values are repeating. i hv cleared the work areas still it is not working...plz help.. dis is the foll prgm. <removed by moderator> Regards, Shalaka Moderator message: Welcome to SCN! Mo