Using Shared Memory in LabVIEW

I'm trying to use shared memory with LabVIEW. Can I use it, a DLL in C with LabWIEW for use shared Memory?

Lidia,
Check these out (for memory mapping):
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000006A1D0000&UCATEGORY_0=_318_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=build+cvi+shared+dll&USEARCHCONTEXT_QUESTION_S=0
http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000005BC10000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=Communicating+Between+Built+LV+App&USEARCHCONTEXT_QUESTION_S=0
But in general you don't need to use this when you use dll's. It is used to
share data between different processes. If you need LabVIEW data in a dll,
try to pass it as a pointer to an array, or as a string pointer.
Regards,
Wiebe.
"lidia" wrote in message
news:506500
[email protected]..
> I'm trying to use shared memory with LabVIEW. Can I use it, a DLL in C
> with LabWIEW for use shared Memory?

Similar Messages

  • I want to used shared memory in LabVIEW. I think I can do it using a DLL in C.

    I think I can use shared memory with a DLL in C. But, Can I use some utility included in LabVIEW to do that, without include my DLL?

    Jorge M. wrote:
    > Hello,
    >
    > here's the info. It works.
    >
    > http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000006A1D0000&UCATEGORY_0=_318_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=build+cvi+shared+dll&USEARCHCONTEXT_QUESTION_S=0
    Another one:
    http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000005BC10000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=Communicating+Between+Built+LV+App&USEARCHCONTEXT_QUESTION_S=0
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Using Shared memory

    Hi folks,
    This the first time I use shared memory and my question is:
    Does shmat function attache the segment to the same address in diffrent procsses, in anther word can I use the same pointer in process A and B?
    Thanks

    The issue of alignment is rather tricky.
    shmat(2) may perfectly return you misaligned address, so I'd consider using memory-mapped files instead.
    mmap(2) returns page-aligned memory (unless you specify MAP_FIXED and some weired first parameter), so you may rely further on the compiler to do the alignment for you...

  • Short Dump TSV_TNEW_PAGE_ALLOC_FAILED while using shared memory objects

    Hi Gurus,
    We are using shared memory objects to stor some data which we will be reading later. I have implemented the interfce IF_SHM_BUILD_INSTANCE in root class and using its method BUILD for automatic area structuring.
    Today our developments moved from dev system to quality system, and while writing the data into the shared memory using the methods ATTACH_FOR_WRITE and DETACH_COMMIT in one report. We started getting the run time error TSV_TNEW_PAGE_ALLOC_FAILED.This is raised when the method DETACH_COMMIT is called to commit the changes in the shared memory.
    Everyhting works fine before DETACH_COMMIT. I know that it is happening since the program ran out of extended memory, but I am not sure why it is happening at DETACH_COMMIT call. If excessive memory is being used in the program, this run time error should have been raised while calling the ATTACH_FOR_WRITE method or while filling the root class attributes. I am not sure why it is happening at DETACH_COMMIT method.
    Many Thanks in advance.
    Thanks,
    Raveesh

    Hi raveesh,
    as Naimesh suggested: Probably system parameter for shared memory area is too small. Compare the system parameters in devel and QA, check what other shared memory areas are used.
    Regarding your question, why it does not fail at ATTACH_FOR_WRITE but then on DETACH_COMMIT:
    Probably ATTACH_FOR_WRITE will set an exclusive write lock on the shared memory data, then write to some kind of 'rollback' memory and DETACH_COMMIT will really put the data into shared memory area and release the lock. The 'rollback' memory is in the LUW's work memory which is much bigger as the usual shared memory size.
    This is my assumption - don't know who can verify or reject it.
    Regards,
    Clemens

  • How to use shared memory as an array of pointers?

    Hi,
    Can we use the pointer returned by "void** ptr = (void * *)shmat();" for accessing the elements in array fashion?
    I have a pointer to pointer to struct - an array of pointers & I want to access the elements by using array notation of ptr[index].
    But, when I do so, my process crashes with SSEGV.
    My code is somewhat as below:-
    size_t size = nSize*sizeof(void *);
    key_t key = 90000;
    int id = shmget(key,size,0777 | IPC_CREATE);
    void** ptr = (void**)shmat(id,(void*)0,0777 | SHM_SHARE_MMU);
    memset(ptr,0,size);
    void* tmpPtr = ptr[100]; // this line causes crash.I was trying to do this on the basis of following code, which uses malloc & works fine:-
    uht->t = (void **)malloc(nSize*sizeof(void *));
    pUHT_ITEM curr_item = (pUHT_ITEM)uht->t;
    How can I achieve this?
    Please help. Thanks.
    Message was edited by:
    grbSunUser

    After debugging the program using dbx, I found that after certain specific index, I get an error of "dbx: cannot access address 0xfd032000", if I do "print suht->t[51200]".
    What I did is that I created shm segment of size = 50000 * (sizeof(viod*))
    This turns out to be 200084.
    By doing step by step print of each index in this shm segment, I reached upto the index of 51199. When I did "print suht->t[51199]" in dbx, I got "suht->t[51199] = (nil)", means this was accessible location.
    But, when I tried "print suht->t[51200]", I got an error of "cannot access...".
    I think this is index from which, if process tries to access, will cause crash.
    How are these numbers related? Should I not do "50000 * sizeof(void*)"?

  • How do debug an application in Shared Memory debug mode using JDev

    I don't see the option of using "Shared memory" debug mode in JDev. There is only socket debug option(Attach/Listen) in debugger but no shared memory debug option.
    Is it missing or is it hidden somewhere.
    Can anyone let me know as all IDEs provide that.

    Any updates?

  • Shared memory used in Web Dynpro ABAP

    Hi Gurus,
    I am using shared memory objects in Web Dynpro ABAP. Everything was working fine until we went live to production. After some research I realized that users are not always able to reach data in shared memory because of different approach of web environment and classic GUI when using more servers. Solution would be to go to database instead of shared memory. However I am still interested if there might be some other way to solve it. Any ideas?

    Marek Veverka wrote:
    Hi Gurus,
    >
    > I am using shared memory objects in Web Dynpro ABAP. Everything was working fine until we went live to production. After some research I realized that users are not always able to reach data in shared memory because of different approach of web environment and classic GUI when using more servers. Solution would be to go to database instead of shared memory. However I am still interested if there might be some other way to solve it. Any ideas?
    To my understanding writing to the database is the safe option. There are no other ways to solve your problem with Shared memory.

  • When is shared memory used?

    I understand that two JVM's both running Coherence on the same box will generally but not always communicate through shared memory, rather than via the network.
    Can you indicate under which scenarios this occurs, and by implication, which scenarios it does not occur?

    Hi Andy,
    Coherence 1.x/2.x always uses a network interface (UDP unicast/multicast) for inter-JVM communication. However, the OS network stack may internally use shared memory for intra-machine communication.
    Jon Purdy
    Tangosol, Inc.

  • Shared memory between LV and a DLL

    Hello
    I am building a DLL in Visual .NET. It is called by LV in a .vi
    The DLL is counting some stuffs over a network, and I d'like to see the
    counter status in the vi, dynamically. This means that when the
    variable is changed is the DLL, the LabView variable changes too.
    I tryed to do this using shared memory, and passing a pointer to the
    DLL. Unfortunately, it seems that the value isn't updated while the DLL
    is running.
    Please tell me the way to do this. I read about global variable, but it isn't much better.
    Thanks versy much !
    Fabien
    PS: I am using LabView 7.1 and VisualStudio .NET 7.0.9500  in C language.
    Message Edité par faquin le 08-02-2005 07:45 AM

    Since you say the DLL does not finish executing, you will need some method where both programs can communicate.
    Here are a couple of suggestions (haven't tried any of them):
    You can try using TCP (search the example finder and this site for examples and tutorials).
    You can try opening a connection to the LV VI server from the DLL to set the value of the indicator.
    If the DLL is threadsafe, maybe you can have another DLL which will serve as a buffer - your DLL will call it to put the data in and LV will call it to extract the data (assuming LV can call 2 threadsafe DLL functions at the same time).
    Try to take over the world!

  • Shared memory:  apache memory usage in solaris 10

    Hi people, I have setup a project for the apache userID and set the new equivalent of shmmax for the user via projadd. In apache I crank up StartServers to 100 but the RAM is soon exhausted - apache appears not to use shared memory under solaris 10. Under the same version of apache in solaris 9 I can fire up 100 apache startservers with little RAM usage. Any ideas what can cause this / what else I need to do? Thanks!

    a) How or why does solaris choose to share memory
    between processes
    from the same program invoked multiple times
    if that program has not
    been specifically coded to use shared memory?Take a look at 'pmap -x' output for a process.
    Basically it depend on where the memory comes from. If it's a page loaded from disk (executable, shared library) then the page begins life shared among all programs using the same page. So a small program with lots of shared libraries mapped may have a large memory footprint but have most of it shared.
    If the page is written to, then a new copy is created that is no longer shared. If the program requests memory (malloc()), then the heap is grown and it gathers more private (non-shared) page mappings.
    Simply: if we run pmap / ipcs we can see a
    shared memory reference
    for our oracle database and ldap server. There
    is no entry for apache.
    But the total memory usage is far far less than
    all the apache procs'
    individual memory totted up (all 100 of them, in
    prstat.) So there is
    some hidden sharing going on somewhere that
    solaris(2.9) is doing,
    but not showing in pmap or ipcs. (virtually
    no swap is being used.)pmap -x should be showing you exactly which pages are shared and which are not.
    b) Under solaris 10, each apache process takes up
    precisely the
    memory reported in prstat - add up the 100
    apache memory details
    and you get the total RAM in use. crank up the
    number of procs any
    more and you get out of memory errors so it
    looks like prstat is
    pretty good here. The question is - why on
    solaris10 is apache not
    'shared' but it is on solaris 9? We set up
    all the usual project details
    for this user, (jn /etc/projects) but I'm
    guessing now that these project
    tweaks where you explicitly set the shared
    memory for a user only take
    effect for programs explicitly coded to use
    shared memory , e.g. the
    oracle database, which correctly shows up a
    shared memory reference
    in ipcs .
    We can fire up thousands of apaches on the 2.9
    system without
    running out of memory - both machines have the
    same ram !
    But the binary versions of apache are exactly
    the same, and
    the config directives are identical.
    please tell me that there is something really
    simple we have missed!On Solaris 10, do all the pages for one of the apache processes appear private? That would be really, really unusual.
    Darren

  • Shared memory (System V-style) - High usage of phys memory and page outs

    Hi!
    I get a much higher usage of physical memory when I use shared memory than I would expect. Please, I would really need someone to confirm my conclusions, so that I can revise my ignorance in this subject.
    In my experiments I create a shared memory segment of 200 MB and I have 7 processes attaching to it. I have a ws of 1 GB.
    I expect to see what I see when I attach to the shared memory segment in terms of virtual size, i.e. SIZE in prstat. After attaching (mapping it) to the process all 7 processes are about ~203 MB each and this makes sense. RSS, in prstat, is about 3 MB for each process and this is ok to me too.
    It is what I see when each of the 7 processes start to write a simple string like 'Hello!' in parallel to each page in their shared memory segment that I get surprised. I run out of memory on my ws after a while and the system starts to wildly page out physical memory to disk so that the next 'Hello!' can be written to the next page in the shared memory segment. It seems that each page written to in the shared memory chunk is mapped into each process private address space. This means that the shared memory is not physically shared, just virtually shared. Is this correct?
    Can memory be physically shared, so that my 7 processes only use 200 MB? ISM? DISM?
    I create a shared memory segment in a C-program with the following calls:
    shmid = shmget(key, SHM_SIZE, 0644 | IPC_CREAT)
    data = shmat(shmid, (void *)0, 0);Thanks in advance
    /Sune

    Your problem seemed reasonable. What were you doing wrong?
    Darren

  • Shared memory usage

    hi group,
    I have a scenario that i have to use shared memory concept in routines of BI...here i have to write a abap code and check on a file. and i want to take that file from the shared memory concept. and then check. i also dont want to fetch th data from table but want to fetch this data also from some file using shared memory... i am totally new to shared memory concept and objects used there...can anyone guide me the step by step procedure for this...also if some help file available then that will be a great help...
    thanks in advance..

    A program which may help you is "ipcs". Specifically, "ipcs -am" run as root
    will give you information on all of the shared memory segments in use. The
    size of the segment is part of the data. This should give you a picture of
    what is going on in the system.
    Alan
    Sun Developer Technical Support
    http://www.sun.com/developers/support

  • Shared memory in /var/run instead of /tmp

    I use shared memory segment on a diskless node.
    This shared memory segment are stored in /tmp.
    Is there a way to put them in a "memory based" directory, as /var/run (solaris 8) instead of
    the disk-based directory

    My problem was especially to change toe location
    of the shared memory on file system. I succeed
    with FIFO but not with shared memory. I
    don't find any solution.
    concerning the definition of memory base vs. file
    based I have no clue but the following extract from
    docset
    ------[Extract from solaris 8 documentation]-----
    The /var/run File System
    A new TMPFS-mounted file system, /var/run, is the
    repository for temporary system files that are not
    needed across system reboots in this Solaris release
    and future releases. The /tmp directory continues to
    be repository for non-system temporary files.
    Because /var/run is mounted as a memory-based file
    system rather than a disk-based file system, updates
    to this directory do not cause unnecessary disk
    traffic that would interfere with systems running
    power management software.
    The /var/run directory requires no administration.
    You may notice that it is not unmounted with the
    umount -a or the umountall command.
    For security reasons, /var/run is owned by root.

  • Q_CAT:1494: ERROR: xa_open() - failed to get shared memory

    I am getting this error while booting tuxedo.
    My question is how do I calculate shared memory on solaris and then which parameter to increase in /etc/system file.
    Thanks

    Vaibhav,
    You need to make sure that the product of SHMMAX and SHMSEG is at least
    equal to the total amount of shared memory needed by Tuxedo and any other
    applications running on your machine.
    "tmboot -c" will tell you the amount of shared memory required for the
    Tuxedo bulletin board, but this does not include any space required by /Q.
    To get /Q shared memory requirements, you can use the qmadmin subcommand
    "qspacelist". If you have more than one queuespace on your system, you must
    do this for each queuespace on your system, and add this total to the
    bulletin board requirements. If any other applications on your machine use
    shared memory, add their requirements as well. In case requirements change
    in the future, it is good to add a comfortable amount of padding to this
    sum.
    Ed
    <Vaibhav Gaur> wrote in message news:[email protected]..
    I am getting this error while booting tuxedo.
    My question is how do I calculate shared memory on solaris and then which
    parameter to increase in /etc/system file.
    Thanks

  • Shared memory - free_instance method doesn't work

    I am using shared memory to store data, set the data in a program and then read in an update task.  My write and read both work, but I would like to "delete" the shared memory instance after the read in the update task.  I am using the free_instance method - it works sometimes, but a very small percentage of the time.  Here is the code I am using:
    To write to shared memory:
    data: lv_inst        type shm_inst_name,
              lo_shared_area type ref to z_cl_binkill_shared_area,
              lo_root        type ref to z_cl_binkill_rmnqty.
        lv_inst = ordim_confirm-matid.
        shift lv_inst LEFT DELETING LEADING space.
        concatenate ordim_confirm-who ordim_confirm-vlpla lv_inst into lv_inst.
        try.
        Attach Shared Area
          lo_shared_area = z_cl_binkill_shared_area=>attach_for_write( lv_inst ).
        Create Root Object ( Object to be created in Memory )
          create object lo_root area handle lo_shared_area.
        Set the value for our message
          lo_root->set_data( ordim_confirm ).
        Set the root back into the Area
          lo_shared_area->set_root(  lo_root ). "<- Note the 2 spaces before go_root (didn't work without!)
        Commit and detatch
          lo_shared_area->detach_commit( ).
        catch cx_shm_attach_error.
        endtry.
    To read from shared memory and then (hopefully) delete:
    DATA: lv_inst          TYPE shm_inst_name,
            ls_ordim_confirm TYPE /scwm/s_rf_ordim_confirm,
            lv_rc            TYPE shm_rc,
            lo_shared_area   TYPE REF TO z_cl_binkill_shared_area,
            lo_root          TYPE REF TO z_cl_binkill_rmnqty.
    lv_inst = ls_ordim_c-matid.
              SHIFT lv_inst LEFT DELETING LEADING space.
              CONCATENATE ls_ordim_c-who ls_ordim_c-vlpla lv_inst INTO lv_inst.
              TRY.
                  lo_shared_area = z_cl_binkill_shared_area=>attach_for_read( lv_inst ).
                  lo_root        = lo_shared_area->root.
                  TRY.
                      ls_ordim_confirm = lo_root->get_data( ).
                    CATCH cx_root.
                      CLEAR ls_ordim_confirm.
                  ENDTRY.
                  lo_shared_area->detach( ).
                  lv_rc = lo_shared_area->free_instance( lv_inst ).
                CATCH cx_shm_attach_error.
                  CLEAR ls_ordim_confirm.
              ENDTRY.
    Any ideas why the free_instance doesn't work?
    Jeff Mathieson

    If an UICommand element inside a UIData table does not invoke the method behind the action binding, then this generally means that the row object is out of the scope while the action event is getting to be fired. Test it by putting the managed bean in session scope and see if it will solve the problem. If so, and if you want to keep the managed bean in the request scope, then change/rearrange your data loading logic so that the data is available during at least the invocation phase of the JSF lifecycle. Or split the backing bean in two beans, one for strictly request-scoped data and another for strictly session-scoped data.

Maybe you are looking for

  • Some album artwork won't display on iPad

    Hi guys, Some of the song's album artwork won't display on my iPad or iPhone but shows up against each song in the album on iTunes on my Mac. There are entire albums' artwork not showing, yet when I open and play the same song in iTunes on my mac, it

  • Zathura has padding around pages

    In any mode I see padding around pages whereby I want the full width and height of the zathura window used. I've already had issues with application windows having a transparent margin and using .window-frame { box-shadow: none; margin: 0; } in .conf

  • Get IP Address For  a user name from Terminal

    hi experts, Can any one help me in finding the IP address for a user id.I want to find the ids for multiple logons. I tried using TERMINAL_ID_GET but it returns the IP only based on the user id.So i am getting only one IP. I tried with CL_GUI_FRONTEN

  • Calling third party software from LabVIEW

    Hi All, In one of the requirement, I need to open the Debugger(AXD debugger) then needs to send some commands from it. Is it possible to invoke debugger from LabVIEW and work on specific text boxes in the debugger. Details : APIs or DLLs related to d

  • Is there any way to link playlists?

    I would like to have the ability to create multiple playlists that can shuffle songs within a single playlist and then move to the next specified playlist when all of the songs in he first playlist have been played once. For example, I might be havin