Synchronization with respect to the memory model

Hi
Can anyone give paste me a link (other than to the JLS itself) that describes the meaning of synchronization with respect to the memory model rather than simply as a means of mutual exclusion?
You read that without synchronization different threads can have inconsistent views of what should be the same data. The link below talks of this issue but says 'the causes of memory consistency errors are complex and beyond the scope of this tutorial.'
http://java.sun.com/docs/books/tutorial/essential/concurrency/memconsist.html
Many thanks
Bruce

There are many articles and a few book chapters or
parts thereof that deal with the new memory model,
and of course some key websites. The primary website
is:
http://www.cs.umd.edu/~pugh/java/memoryModel/
Brian Goetz has written a number of articles on IBM's
DeveloperWorks, and of course this is covered in
great depth in "Java Concurrency in Practice" by
Goetz et al.
I also covered it in the threading chapter of "The
Java Programming Language, 4th edition". :)
A few key points:
- access to volatile long/double has always been
atomic (old JMM and Java 5 JMM), but remeber that
access means a simple read, or a simple write,
something like ++ is not atomic because it is a read
followed by a write
- don't think of this in terms of "caches" - that
will lead to the wrong reasoning. It isn't about
flushing caches or writing to main memory (that was
the old conceptual model that just gets people into
trouble because they keep trying to reconcile it with
how the hardware chaching works). The new memory
model is all about establishing happens-before
relations ships between writes and reads of a
variable, so that the value allowed to be returned
from a read is the most recent value that was
written.
I was under the belief that the previous MM was writen in the way that it was in order to allow flexibility in terms of instuction/read/write reordering, caching, synch block merging and any number of other things that may occur, such that vm's on various architectures could be written efficently.
Of course it could have been that vm writers on those various architectures took advantage of the slack nature of the spec to implement all of those non-standard interpretations of the spec :). Its definately a good thing that the spec has been redefined to make it clearer exactly what a java develper should expect.
- the definitive source for this is actuall the
JSR-133 specification. Chapter 17 of the JLS 3e is
based on that spec but doesn't contain the full
details. (But you are better off reading Ch17 than
the proper spec :) )matfud

Similar Messages

  • Relative path for Download directory folder.I created a firefox profile and i wanted to use this profile in multiple machines.I wanted to use a relative path for download directory with respect to the profile folder.I need this on Linux machines

    I have a use case where I need to use different download directories with different firefox profiles.I need to use this profiles in multiple linux machines.
    I need to have a relative path to my download directory with respect to the profile folder.
    Ex: I have a selenium test which opens a website and downloads it to my machine.I want this downloaded file to go into some specific folder relative to this profile folder.How do I do this??

    That is not a practically empty xinitrc - that file only needs one line: exec WM.  Other things are entirely optional, and some of them very useful, but I'd encourage you to stick with the simplest xinitrc that will do what you require.
    Is slim involved?  Probably.  That is the source of many problems.  But to start narrowing this down, I have 3 suggestions:
    1) temporarily (at least) change your inittab to default to runlevel 3 ... actually, is it currently set to 5 or 3? if it is currently 3 that would explain why slim doesn't start.
    2) at a tty in runlevel 3 use "xinit" instead of "startx".  Startx is fine most of the time, but it is essentially just a complex wrapper for xinit.  That complexity can often iadd useful functionality, but it *always* makes troubleshooting more difficult.  So for now just use a vanilla 'xinit'.
    3) remove dbus-launch from your exec line in xinitrc.  This is done by console-kit so it is redundant and potentially problematic.  Further BOTH of these are taken care of by slim, so I'd even suggest getting both a jump start on being ready for slim and simplifying troubleshooting by removing both of them.  Just make that line "exec openbox-session"
    Edit: adding one more:
    4) temporarily switch out openbox-session for openbox.  I suspect the reason feh's setting of the background is getting overridden is due to a script or setting in openbox's autostart settings - many of these are only invoked when "openbox-session" is called, while "openbox" starts *just* the window manager itself.
    Last edited by Trilby (2012-10-03 17:30:36)

  • How to populate the data or details of only the present year and the previous year with respect to the given RATNG?

    Hi All,
    I have created a form with 5 blocks (namely ENQACMHDR, ENQACMDTL, ENQACEHDR, ENQACEDTL, ENQACSPEC), where i have 8 push buttons (namely ENTER_QUERY, EXEC_QUERY, CLEAR, FIRST, NEXT, PREVIOUS, LAST & EXIT).
    This form is created just for viewing purpose only. So after I execute, all the blocks have been blocked against insert & update.
    I query on 2 fields that is 'ENQNO' and 'RATNG' (Both the fields belong to the block ENQACMDTL).
    When I click on 'EXEC_QUERY' directly, all the data of all the years populates.
    But the user wanted the data to be populated from only the present year and the previous year.
    So , on 'WHERE Clause' of the property_palette of 'ENQACMDTL' block , I put in the following condition:
    SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
    PROPERTY PALETTE (ENQACMDTL block)
    WHERE Clause
    SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR( ADD_MONTHS(SYSDATE,-12) , 'YYYY') OR SUBSTR(ENQACMDTL.ENQNO, 1,4)=TO_CHAR(SYSDATE, 'YYYY')
    Now the data of only the present year and the previous year is being populated. Its ok with the field of 'ENQNO'.
    The problem is when i query on field 'RATNG' . 'RATNG' is a Text_item with Number of Items displayed=5. (5 rows)
    The following are 2 columns of a Table (Name=ENQACMDTL) in Database.
    ENQNO
    RATNG
    2013900054
    500KC2
    2013900047
    800KC4
    2013520018
    750KC6
    2012900037
    1000KC2
    2012520109
    500KC2
    2012140019
    750KC6
    2011540036
    500KC2
    2011100030
    1000KC2
    2006100007
    90KD8
    2006750014
    750KC6
    2006900072
    500KC2
    The first 4 numbers of 'ENQNO' denotes the year. There are more than a lakhs of records.
    So when i query on the field 'RATNG',
    Example:For RATNG=500KC2;
    I click on ENTER_QUERY, On the field of 'RATNG' , i put in the value 500KC2 and click on  EXEC_QUERY; Details with respect to 500KC2 is displayed as well as all the other unwanted RATNG like 750KC6, 1000KC2 (which belongs to the ENQNO of the present year and the previous year) also gets displayed.
    I want details of only RATNG (500KC2) to be displayed, but only of the present year and the previous year, that is 2013900054, 2012520109 (ENQNO).
    Other than 500KC2 RATNG, no other RATNG must be displayed.
    The RATNG=500KC2 is also present for ENQNO=2011540036 , 2006900072. But I dont want these to be displayed.
    I want only the data or details of the present year and the previous year to be displayed or populated with respect to the given RATNG.
    Can You Help me or tell me what do i do for this?
    Hope I'm clear with my question!!
    If my question is not clear, let me know plz.
    Thank You.
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    Oracle forms 6i.

    On key-exeqry you have to program.  Delete all other trigger codings for checking your condition.
    It dint work on key-exeqry.
    I tried key-exeqry on form trigger, block (enqacmdtl) and also on field(:enqacmdtl.enqno) , but none of them worked.
    It did not display the message.
    I have a 'PUSH-BUTTON:EXEC_QUERY.
    For EXEC_QUERY, Trigger : WHEN_BUTTON_PRESSED;
    I added the following code:
    if to_number(substr(:enqacmdtl.enqno,1,4))<to_number(to_char(add_months(sysdate,-12),'YYYY')) then
         message('The Rating is not present for the present year and the previous year');message(' ',no_acknowledge);
         raise form_trigger_failure;
    else
         execute_query;
    end if;
    It is working fine and the message is being displayed.
    But again I have a new problem and that is;
    On the field :enqacmdtl.enqno, when i enter the '2013%' and press 'EXEC_QUERY', it works fine.
    but when i enter '2006%' and press 'EXEC_QUERY', it shows the following error
    FRM-50016: Legal characters are 0-9 - +E. It does not display the message also.
    but when i enter the complete number, '2006580002', then it works fine , that is it displays the message (The Rating is not present for the present year and the previous year).
    The problem is because of '%', only when i put in the restricted data (which does not satisfy where condition).
    How do i solve this?
    Thank You Priyasagi.

  • My waveform chart is suppose to be with respect to time but I've noticed it is plotted with respect to the number of times through my VI

    I was under the assumption that waveform charts in LabVIEW 6i atomaticly displayed wired data with respect to time in seconds. However, I noticed that my chart plots data with respect to the number of data points my VI has generated. Is there anyway to fix this so that the chart actually plots vs. time. I've attached VI. The CIN is to a Computerboards Inc, thermocouple. Any help would be appreciated.
    Attachments:
    tepTInScan.VI ‏73 KB

    It appears that the chart is set to display relative time but since you don't have the acquisition in any kind of a loop, your relative time is pretty meaningless. You've got the dX of the chart set to be one, so yeah, at the beginning, the x scale numbers are going to be the same as the number of aquisitions until you've run it more than 60 times. At this point, you'll see the x scale show minutes and seconds. If you want absolute time for the x scale, look at the examples Real-Time Chart.vi or Variable-Time Chart XY.vi.

  • Metagen is skipped sometimes complaining because all output files are up-to-date with respect to the input files

    Hi,
    In one of my dll (VS2010), the process Skipping target "MetaGen" because all output files are up-to-date with respect to the input files.
    it is at  random.  I have checked the time stamps of the dll and metagen.write.1.tlog both having the time stamp on the failed build.  But all files in release folder did not have the same time.  They are one hour earlier than the dll
    and the  metagen.write.1.tlog.
    On the good build  it said the input file is is newer than output file ".\Release\\metagen.write.1.tlog" and allfiles in the release folder have same time stamp.
    Any clue to solve this ?
    Regards,

    Hi,
    Based on your post, I am not very clear about your issue. I feel your issue is out of support range of VS General Question forum which mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
     Could you please provide us more information so that we resolve your issue better?
    What type of project are you working with? C++ MFC project?
    How was the
    metagen.write.1.tlog file generated in your project?
    What error messages did you get?
    What is the 'input file'?
    If possible, please provide us a sample project to reproduce your issue.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I have two IPODs and I want to synchronize with ITUNES in the same computer. How can I do it?

    I have two IPODs and I want to synchronize with ITUNES in the same computer. How can I do it?

    See:
    How to use multiple iPods, iPads, or iPhones with one computer
    What is the best way to manage multiple...: Apple Support Communities

  • Can my charger, which originally shipped with my iPod A1040 be used with any of the following models without damaging the battery?

    I know this is a complicated question, but any detailed explanation as to why or how I appreciate it as I have tested and it does actually charge the 1136, 1051 and 1236, but I have been reluctant to try it on the A1288.
    Question:
    Can my charger, which originally shipped for the iPod A1040 be used with any of the following without shortening the battery life or damaging it?
    iPod A1136 (tested, does charge)
    iPod A1051 (tested, does charge)
    iPod A1236 (tested, does charge)
    iPod A1288
    Thanks,
    Josh

    Yes, you can use the iPod Mini charger with the new 5th Gen iPod.

  • Query to find the latest record with respect to the current status

    Dear gurus
    I have the following data in a table
    Customernum
    bkcode
    reqtdate
    Prevstat
    currstat
    The data will be like this
    CustomerNum bkcode reqdate prevstat currstat
    5900 1 03-Aug-12 0 1
    5900 1 06-Aug-12 1 0
    5900 5 22-Jun-12 0 1
    If a customer has an issue to solved, a record is added with bkcode , register date and currstat will be 1
    If the issue is resolved for the bookingcode,a new record is added, the currentstatus will become 0. and prev stat will show 1. Row no 1 and 2 reflects this case
    If this table is queried for finding the unresolved issues. the output should be only the Last row of the above example. since issue with bookingcode 1 has been resolved
    I have trying hard to get this thing confused what to use Lead or Max
    Kindly guide me

    Hi,
    one way here:
    WITH mytable(CustomerNum, bkcode, reqdate, prevstat, currstat)
    AS
       SELECT 5900, 1, TO_DATE('03-Aug-12', 'DD-Mon-YY'), 0, 1 FROM DUAL UNION ALL
       SELECT 5900, 1, TO_DATE('06-Aug-12', 'DD-Mon-YY'), 1, 0 FROM DUAL UNION ALL
       SELECT 5900, 5, TO_DATE('22-Jun-12', 'DD-Mon-YY'), 0, 1 FROM DUAL
    SELECT CustomerNum, bkcode, reqdate, prevstat, currstat
      FROM (SELECT a.*
                 , ROW_NUMBER() OVER (PARTITION BY CustomerNum, bkcode
                                           ORDER BY reqdate DESC) AS rn
              FROM mytable a
    WHERE rn=1
       AND currstat=1;
    CUSTOMERNUM     BKCODE REQDATE     PREVSTAT   CURRSTAT
           5900          5 22-JUN-12          0          1Regards.
    Al
    Edited by: Alberto Faenza on Dec 18, 2012 5:23 PM
    Changed again!! Previous logic was wrong

  • Any recommendations with respect to the best ipad 2 cover

    What is the best ipad 2 cover? Looking for maximum protection front and back

    I'd suggest looking for a portfolio cover. One that the iPad can slide into with a heavier front cover. I got mine from anazon, a nice pretty purple leather which I'm sure won't be to your tastes
    However portfolio cases do seem to provide the most functionality and protection.
    Now none of them really provide muchh protection against accidental drops. There are ones like Otterbox that do have more chunky looking cushioning, but none of them are perfect either.

  • Getting corresponding report with respect to the specific uitlity

    Hi
    I have 7-reports with same columns but for different 7-utilities(seawater,portable water, gas consumption ...etc). If suppose user enters one utility(seawater) in the selection screen then he/she needs to get corresponding "SEAWATER" report .
    Samiliary for other utilities also.
    so how can user gets corresponding report with corresponding with specific uility.
    pls let me knw
    regards
    kumar

    Hi Kumar
    Do you mean that
    1. You want 7 reports for 7 utilities with the same column Structure and how can user get these?
    If this is the case, create 7 Queries and use the same re-usable structure in the Columns. Then go ahead and rsestrict the Utilities with the specific utilities in Free Char. Give the name as per the Utilities, so that the user can distinguish between these queries.
    OR
    2. You want one report and user has the choice which utility he wants to run the report for, then....
    Create on report with the rows/columsn that you want. Create a variable on the Utilities Info-Object and restrict the Utilities Info-Object with this variable. So user will be prompted to enter this variable for utility and corresponding report will be generated.
    Does this answer your question?
    Cheers
    Abhishek

  • My dad has an imac G5 from 2005, and I'm wondering if we can bring it to the Apple store and replace it with one of the newer models. How much would the G5 be worth and how much money would we have to put on top of it to buy the newer model?

    How much is the G5 worth? The one from 2005.

    The Apple Store will offer to recycle it for free, you are better off selling it on ebay or elsewhere, I have seen decent looking ones go from $80-$250 here in Australia.
    You are looking at $1000 + to get a new one

  • Adobe Media Server pro 5 Scalabiltiy Requirements with respect to the number of clients connected

    what are the hardware requirements mapped to the number of clients connected to a vritual server running on a Windows 2008 R2 Server? At what point should the scaling be done, what are the best practices? The encoding rate used is 360 Kbps.

    Hi Simon
    The HTTP (HDS and HLS) streaming and recording limit in Adobe Media Server 5 Starter is 10 min. You'll need to buy a serial key if you want to record/stream for longer. Also there are no limit on number of clients for HTTP.
    Hope this helps.
    Thanks,
    Apurva

  • JDK errors in Multiprocessor with weak memory model

    When reading this article to understand some of the Double-check locking problems :
    I got surprised by point 4. Appart the String example, it means that any build immutable object like build during a single-thread phase have no garanty later in multi-thread phase to be read a in fully initialized state.
    So I checked implentation of some JDK classes to how is managed some static field. The first I checked (in JDK 1.4.1) is Locale.getDefaultLocale().
    LOL in fact it's a case of double-check locking.
    The internal comment is:
    // do not synchronize this method - see 4071298
    // it's OK if more than one default locale happens to be created
    What is 4071298?
    Secondly, setting two times the default locale isn't the problem with Double-check locking.
    So any explanation this is ok? Or it's just a JDK example of wrong Double-check locking?

    When talking about languages that run in a virtual machine, concern yourself only with the virtual machine, because that is where your code will be executed.
    When talking about code that runs in a physical machine, concern yourself with the physical machine (CPU/RAM/etc.) because that is where your code will be executed.
    In summary, concern yourself with the memory model of the machine that will run your code. Which is the Java VM in this case.

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • Any option to get the list of Invoice with respect to Sales Area

    Dear All,
    Is there any option to check the list of Invoices with respect to the Sales area.
    Because, in VF05, we are getting the list either for a Payer or a Material.
    I want to see the list of Invoices for a Sales area. I mean, it should be similar to VA05, where we can get the list of Sales Orders even without providing the Customer and Material information.
    Reagrds,
    Mullairaja

    HI
    Use the T code VF05N and select the option Bill documents in Fi
    Here you can get the list of invoices
    Try with MC+2
    regards
    Prashanth
    Edited by: Prashanth@SD on Nov 11, 2010 9:44 AM

Maybe you are looking for

  • Liquify & poor performance (scratch drive use)

    Hi, (Firstly, I'm an ex programmer, so fairly technical...) I've recently been looking into the performance of the liquify filter in Photoshop CS4 11.0.1 on my i7-950, Vista64, 64 bit photoshop, 12Gb RAM. It seems to "stall" for a second or two after

  • Decision Report from siebel-determinations-server missing name substitution

    In the debugger decision report, I get the name substitution - ie "Bubba Gump is eligible". But in the decision report that gets saved in Siebel, I am getting "the person is eligible" the inbound XML also shows "the person" What do I need to be doing

  • Event alert is not working in HRMS

    Dear All, I have created an event alert for New Joinee. I am joining two table PER_PEOPLE_F & Per_assignment_f. I need alert to fine after insert but it is not firing it is firing if i will click on Update button in Define alert form Can anybody help

  • My SQL and PHP Web Board Quits working after 10.4.4 Server Update

    Okay.. So I did the update to server 10.4.4 and not only did it kill my DNS, now it also killed my PHP web board.. thank you very much! Does anyone know what the update changes and how I can correct these errors: Or is it related to the DNS issue? Th

  • Font Issue With CS5 Running on Yosemite

    Hey all, I had upgraded to Yosemite (hoping it would fix my problems with Photoshop in Mavericks). Upgraded, and didn't seem to have any issues. But as I've tried creating new documents, my font library isn't being recognized by the Adobe application