WriteLocks, Conditions, and signal() (to readers)

We are creating a simulation application where one thread periodically updates each object, and other threads read information from it. We had liveness problems when using a simple synchronization scheme, so we had hoped to use ReentrantReadWriteLocks (RRWL) instead.
If a reader got the read lock on an object, it could check if it was up-to-date, and, if not, await() on a Condition associated with the write lock. This would free up the object to allow the writer to acquire the write lock, update it, and, when finished, signalAll() on the Condition to allow the readers to continue.
However, the Condition and RRWL classes are currently not designed to allow this. Only objects that have the WriteLock may await on the associated Condition. It makes sense that only objects that have the write lock could signalAll(), since threads should not signal without updating the state first. However, I don't understand why having a write lock is required to await() on the associated Condition. The tryRelease() method of RRWL throws an exception if the calling thread is not the owner of the associated lock.
Since other implementations of RRWL (Colt, Apache commons) don't seem to support what we want in a RRWL either, we are left to implement what we want ourselves. Is there a good workaround to allow all of the readers to be signaled when the writer is finished? Otherwise, will subclassing RRWL and overriding the tryRelease() method cause other big problems?

We had thought about acquiring the write lock before
calling await(), but then only one thread would be
signaled.I don't understand why you think this would be the case. As many threads as were waiting when the signalAll was done would be signalled.
In the simulation, each object has its own thread.
We use a barrier to synchronize update steps, but
there is a data dependency between objects. The
dependencies between objects is variable (which one
depends on another). When an object is updating it
tries to get a write lock, but may be blocked
because a dependent object (or > 1) has a read lock.
We want the dependent object(s) to await() the
update from the writing thread (thus each giving up
their read lock), which means they should all be
signaled. I think I get the picture. At the barrier all objects that need to be updated are marked as out-of-date. The thread for a given object then attempts to update that object by getting the write-lock and then working out the next state by querying the dependent objects. However a dependent object may be in need of an update in which case you want to wait until that update is done.
It still seems to me that grabbing the write-lock of the dependent object and then waiting for its update to complete is the simplest immediate solution.
Our current thought is to try to subclass RRWL and
override tryRelease() to support the case where owner
== null. I don't think it is that simple. The ConditionObject code in AQS uses the fact that the associated exclusive lock is held to protect concurrent access to its own data structures. You simply can't call await() if only holding shared access.

Similar Messages

  • WriteLock, Conditions, and signal (to readers)

    We are creating a simulation application where one thread periodically updates each object, and other threads read information from it. We had liveness problems when using a simple synchronization scheme, so we had hoped to use ReentrantReadWriteLocks (RRWL) instead. If a reader got the read lock on an object, it could check if it was up-to-date, and, if not, await() on a Condition associated with the write lock. This would free up the object to allow the writer to acquire the write lock, update it, and, when finished, signalAll() on the Condition to allow the readers to continue. However, the Condition and RRWL classes are currently not designed to allow this. Only objects that have the WriteLock may await on the associated Condition. It makes sense that only objects that have the write lock could signalAll(), since threads should not signal without updating the state first. However, I don't understand why having a write lock is required to await() on the associated Condition. The tryRelease() method of RRWL throws an exception if the calling thread is not the owner of the associated lock. Since other implementations of RRWL (Colt, Apache commons) don't seem to support what we want in a RRWL either, we are left to implement what we want ourselves. Is there a good workaround to allow all of the readers to be signaled when the writer is finished? Otherwise, will subclassing RRWL and overriding the tryRelease() method cause other big problems?

    Just adding a link to the other thread:
    http://forum.java.sun.com/thread.jspa?threadID=5115026

  • I got four emails for the icloud and they are all terms and conditions and i cant find the agree button. where is it in the email?

    I got four emails for the icloud terms and conditions and i cant find the i agree button in the email . Where is it?

    It is not properly connected to the network.
    Make sure location is set correctly
    DNS should be on auto (settings - general - network)
    Try ethernet
    Signal strength on device won't account for issues, you would need a network report from istumbler, netstumbler or similar. This will show accurate signal strength along with noise and nearby networks

  • Z600 workstation missing pci data acquisition and signal processing controller driver

    I just installed Win7 Pro x86 on my Z600 workstation.  It was an upgrade from WinXP Pro.  In Device Manager I am missing the driver for the PCI Data Acquisition and Signal Processing Controller and Hardlock USB 1.02.  Can someone assist me in finding these drivers.  I looked on the Support/Drivers page for this  model but couldn't find anything.
    This question was solved.
    View Solution.

    Hi,
    You might get better assistance on the HP Enterprise Business Forum since you have a professional worktsation.
    HP DV9700, t9300, Nvidia 8600, 4GB, Crucial C300 128GB SSD
    HP Photosmart Premium C309G, HP Photosmart 6520
    HP Touchpad, HP Chromebook 11
    Custom i7-4770k,Z-87, 8GB, Vertex 3 SSD, Samsung EVO SSD, Corsair HX650,GTX 760
    Custom i7-4790k,Z-97, 16GB, Vertex 3 SSD, Plextor M.2 SSD, Samsung EVO SSD, Corsair HX650, GTX 660TI
    Windows 7/8 UEFI/Legacy mode, MBR/GPT

  • Driver missing - PCIe Data Acquisition and Signal .....

    Hello, i recently used Boot Camp to install Windows XP on my 2010 15" Macbook Pro.
    All the drivers are working (so far) and i haven't encountered many problems.
    However, there is one thing bugging me:
    When i go into Device Manager in Windows, and look down the list of installed/uninstalled devices, there is a device called "PCIe Data Acquisition and Signal Processing Controller" which has no driver installed.
    I'm PC savvy, but i have never seen this before. My guess is that one of the motherboard drivers is missing, and Boot Camp installer doesn't include that driver?
    Has anyone seen/resolved this, and if so, how?
    Thanks.
    Kaj.

    Okay, will do.
    Thanks.
    Also i wonder if you could help with another problem?
    http://discussions.apple.com/thread.jspa?threadID=2758766&tstart=0

  • PCI Data Acquisition and Signal Processing Controller driver

    I've installed win 8.1x64 on my HP Probook 450 G2 but I am missing the PCI Data Acquisition and Signal Processing Controller driver.
    Can you please help?
    Thanks,
    Leontina
    This question was solved.
    View Solution.

    Hi:
    Please see if installing the Intel Chipset driver installs that device.
    https://downloadcenter.intel.com/Detail_Desc.aspx?DwnldID=20775&lang=eng&ProdId=816

  • Pci data acquisition and signal processing controller -Device software not installed

    My pc shows me ,the driver software for pci data acquisition and signal processing controller is not installed  on my Device manager.
    Please suggest me a suitable solution.

    No its not working , Give me an alternate solution.

  • Possible to do conditional ands?

    I don't know if this is possible or not. so I thought I should ask the experts.
    I have a function and I need to create a query that has conditional ands.
    what I'm looking for is something like this:
    the function has a few in variables. one of them is p_view
    in my where clause I was hoping to do something like this:
    where a.course_id = b.course=id
    if p_view = 1 then
    and a.supervisor = p_super
    elseif view = 2 then
    and a.emplid = p_emplid
    else
    and a.emplid = b.emplid
    end if;
    and a.role = b.role;
    now this is not real code, I've tried a decode and that did not work, then tried case, that did not work. so I'm not sure if its possible or not.
    can this be done or is there some other way to do this I don't know about?

    Hi,
    I've tried a decode and that did not work, then tried case, that did not work.Why not? How did you try?
    When asking questions, be as specific, clear and concisive as possible, so we can help you as best as possible.
    'It didn't work' isn't adding anything to that.
    now this is not real codeDon't post unreal/syntactically wrong code, it only distracts and confuses, raises more questions.
    Post real code or a clear description of the requirement.
    can this be done or is there some other way to do this I don't know about?Hm...my guess is that it can be done, and I wouldn't rule out getting it done using case yet.
    If possible, please provide the real query and explain why 'it didn't work'.
    We need to know the requirement here.
    All I can think of with your given input is this wild shot in the dark, however it might give you an idea:
    where a.course_id = b.course_id
    and ( case
            when p_view = 1 and a.supervisor = p_super then 1
            when p_view = 2 and a.emplid = p_emplid then 1
          end
        )  = 1
    and a.emplid = b.emplid --not sure about this here at all
    and a.role = b.role;Remember to use the tag before and after your examples.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Find Tax conditions and amounts while creating a PO from reference.

    Hi friends,
    I am creating a PO from another reference PO. When I create the PO the Tax conditions and
    amounts come from Sabrix 3rd party system. This data gets saved into SAP internal memory and
    is visible when we follow PO item-> Invoice Tab->Taxes-->then we can see Tax
    conditions and there amounts as well. when we press SAVE button PO gets created and KNUMV
    (Condition Number) gets formed and then we can access this Condition types and Amounts data
    from KONV table by specifying the Condition number which is the Primary key of KONV table.
    But we need to access this data of Condition types and Amounts even before we press SAVe
    button on ME21N screen.
    Please help me on this.

    Hi,
    As mentioned that this error was one of the wierdest SAP issues I have faced, it was due to the silliest copy paste errors on my behalf. I completely overlooked the POITEMX naming.
    For 4 values of RFQ_NO, RFQ_ITEM, PREQ_NO, PREQ_ITEM, I didnt have the 'X' for POITEMX and kept on looking for errors for days.
    BAPI_PO_CREATE1 works with min. possible inputs successfully.
    Thanks to all!

  • Lenovo ideapad yoga 13 pci data acqusition and signal processing center for problem for windows 8

    Link to picture
    hi everyone, 
    find original w8 cd and then i installed, when i was installing
    i deleted all recovery and other partition, i did not think what can i do,
    but then i activated windows and installed all driver, but i taking 
    after all drivers it stayed
    2''unknown devices''
    and when i rebooted, it says, usb device not recognized'' and also
    ''pci data acquisition and signal processing center'' devices problem for windows 8. and touchscreen not working.
    i read related for w7 same problem, but what i will do now ?
      thanks.
    Moderator note; picture(s) totalling >50K converted to link(s) Forum Rules

    hi adilsefaersan,
    Welcome to Lenovo Community Forums!
    By opening your Device Manager right click on one unknown device and choose properties,
        >On the properties windows Click on the Details Tab, on the property drop down Choose hadware IDs
         > then copy the value and post back here whats on the Value pane
    Do it for all those unknown Device and Post here the Value of the hardware ids
    also can you share your Windows Version and bit type so we'll knwo the correct download page for you
    Thanks and Regards
    Solid Cruver
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Why can I only accept the new terms and conditions and keep getting sent back to agreeing (5 times and still going in circles)

    Seems that I can no longer install anything, as every time I get forced to a page to read and accept the new terms and conditions - and no matter if I accept them or not, I only get sent back to read them again.   Another reason my next smartphone will be android based!

    The iTunes and Mac App Store / iCloud problem spontaneously resolved for me as of 21:54 Pacific Standard Time on 9/30/2012.
    Someone at Apple was aware of and fixed the problem. Finally.
    Yeah!

  • In cursor i have two queries where put the condition and how to print the d

    hi i have 2 tables 1 is emp(empid,empname,dept,grade)
    2 is salary(grade,salary)
    in cursor when ever grade is increased salary automatically increased
    in 2 diffrent queries where i will put the if condition and how to print the output.
    any one can please suggest me.
    finally my required out put is
    empid,empname,grade,salary
    thanks

    It is always helpful to provide the following:
    1. Oracle version (SELECT * FROM V$VERSION)
    2. Sample data in the form of CREATE / INSERT statements.
    3. Expected output
    4. Explanation of expected output (A.K.A. "business logic")
    5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Receiver Determination Condition and XPATH

    Hi Everyone,
    I have a receiver determination with conditions and can not figure out why one thing is working, and the other isn't.
    As suggested in the following forum post, XPATH and RECEIVER DETERMINATION, I had to do the following to my XPATH expression to make it work.  The full xpath expression is this:
    (/p1:RenExtract_MT/Detail/CompanyCode = 9740)
    where
    p1 = http://company.com/xi/fin/
    but whenever I put in a condition it could not find a receiver.
    Hoewver, when I did this:
    //CompanyCode
    it worked.
    I did everything through the condition editor, many times, and didn't type anything in myself.  Is there a length limitation or something (I removed some data in here, the expression is really longer!).
    Any ideas?
    Peter

    Hi Peter,
    I do not have an explanation for this wired behaviour.
    But I can assure your, that your working solution, the //something expression is a good one and not inferior to a solution using an explicit, absolute path.
    Why is that: I can remember some benchmarks, where the //something expression always outperformed the other one.
    Regards
    Gregor

  • Shipment cost condition and purchasing conditions

    Hi Experts,
    I read OSS Note 427944 and I have configured few PO item conditions (relevant to ship. costing) . Each of them has different account keys assigned.
    I have created the same account keys in shipment cost pricing.
    I have created shipment cost document with one condition and when I post GR the system post it on the first condition in the purchasing schema and not on the condition with the same account key as supposed to be.
    In addition, when I have entered 2 conditions in shipment cost doc.
    and posted Goods Receipt the system sum and post the total amount on the first condition in the purchasing schema .
    How can I make a relationship between the "PO item conditions" and the "shipment conditions"?
    Thanks,
    Michal

    michallll wrote:
    Hi,
    >
    > First thanks for the reply.
    >
    > I did all that but still when I post GR the system does not linked the conditions correctly .
    > When I use one condition I expect the system to post the delivery costs to the exact condition in purchasing.
    > If I use condition zm00 in shipment cost than it is supposed to post the delivery costs on zm00 in purchasing pricing.
    > Instead , The delivery costs are posted on the first condition according to purchasing schema regardless of the account key of the condition.
    > When  I use 2 conditions in the same shipment item category, for example, conditions zm00 and zm02, The system sum them and post it on the first condition according to purchasing schema.
    >
    > Michal
    Hi,
    In your Po condition type in control2 tab please check on "Copy shp cost" and condition should be percentabe based and same condition should be in the shipement cost pricing procedure.
    hope this will solve your query

  • Difference in price in PO condition and invoice

    Hi,
    The situation is as follows:
    A PO was created, released and GR done. One item in the PO has quantity 200 KG, price Rs. 100 per KG. So the net price is Rs. 20,000. Now, the price of that item has increased to Rs. 110 per KG, so the total net price would be Rs. 22,000. IR needs to reflect this.
    I was going to reverse the GR for that material using MBST, change the price in the PO item condition and repost GR. But, the stock has all been consumed. Since there is no stock, reversal of GR cannot be done.
    What is the standard method of handling such a case? Should the amount be reflected in the invoice in MIR7 / MIRO? Quantity remains the same, amount has changed. When the PO doument reference is given in MIR7 / MIRO, the system proposes Rs. 20,000 as the amount. If this is changed to Rs. 22,000, the document can be posted, but the difference of Rs. 2000 is being posted to a different G/L. Is this ok? What is the impact on finance? Is there a better way of handling this? Help is appreciated, thanks.
    Regards

    The difference will get posted in Invoice in the Price difference account.
    This is the Standard Process for this kind of the case.

Maybe you are looking for