Difference between volatile and atomic variables (util.concurrent.atomic)

All,
Can some one explain to me the difference between using
volatile variables and atomic variables as incremental/decremental counters
that is shared by multiple threads.
when should I use volatile and when should I use atomic variables.

angeshwar wrote:
All,
Can some one explain to me the difference between using
volatile variables and atomic variables as incremental/decremental counters
that is shared by multiple threads.
when should I use volatile and when should I use atomic variables.
x++ is not atomic for a volatile variable. You can have ten threads executing that concurrently and only get a increment of one when it should have been ten. This problem won't happen with AtomicWhatever.

Similar Messages

  • What's the difference between RSS and Atom feeds?

    I just figured out the RSS thing, which is great. However, when I go to sign up for a RSS feed, I am often given a choice between RSS, Atom, sometimes different versions of RSS. What's the difference between all these? (I tried searching, but was unsuccessful.) How do I make a choice?
    Another question, can someone see that I have signed up for RSS feed from their site?

    Hi again,
    but how do people decide which one to use for subscribing?
    People can choose whichever one they want - Safari supports both RSS and Atom, other applications on OS X (and Microsoft Windows, Linux, etc) may only work with RSS or Atom so by publishing in multiple formats they can be fairly sure that everyone can read the content.
    And how can you see who has subscribed to an RSS feed from your site?
    They will be able to see the IP address of the requester in just the same way as they can when you load a webpage - there's no difference in how the RSS/Atom data is requested sent over the internet compared to HTML webpages.

  • What is the differences between object and other variables?

    For example:
    Object[ ] mm=new Object[10];
    int[ ] mm=new int[10];
    what are their differences??? How to use them correctly??
    Thank you very much!!

    Would you please explain deep about it ?????
    the most important is when to use object and when to
    use other primitive data type
    (int,float,long,double)??
    Thank you very much!!!Each type, whether primitive or object, models some idea or thing or abstraction.
    Use primtives when you just need raw values with no behavior. If you need an integer number, you'll generally use int, sometimes long, rarely short.
    Use objects when you need the concepts they model--String when you want a string of text, Date when you want to represent a date, whatever class you create (Person, Student, Car, Whatever) when you need to use or manipulate the concepts they model.
    Use the object wrappers for the primitives--Integer, Double, etc.--when you want to represent the number but you're using it in a context where objects are required--e.g. when adding them to a collection.

  • What are the differences between attributes and variables?

    I am trying to develop a firmer understanding of the difference between attributes and variables. I understand attributes are lexically scoped to a class and variables are lexically scoped to the enclosing block. The lifetime of an attribute is linked to a class' instance. What is the lifetime of a variable? What is the lifetime of variables declared in a script file's top-level?

    It depend on whether the script is running in standalone mode or been called by others (library mode).
    If running as standalone, the variable of the script in the top level exists until the the script exit. If run as library mode, the variable in the top level of the script will never get to execute. Only the function and class available for call.
    Try calling another script with top level variable (place print statement to verify), you realize in library mode, it will never been called. That's why the main method as in Java is never needed because of this reason.

  • Difference between Filter and Variables

    Hi Experts,
    What is the difference between Filter and Variables except user can give input dianamically in the case of Variables??
    Thanks in Advance!
    Sapna

    HI,
    Both works similarly ....but if the requirement is fixed means u know what data should be displayed in the query then u can use the filters....if u want to give that option to the Users then we create a variable and user can enter the required data which he wants to view.....once u define filters then only that particular restricted data will be displayed in the query out put....but incase of variables we are having the flexibility to view the data....
    Thanks/Tarak

  • What is the difference between tkprof and explainplan

    Hi,
    what is the difference between tkprof and explainplan.

    Execution Plans and the EXPLAIN PLAN Statement
    Before the database server can execute a SQL statement, Oracle must first parse the statement and develop an execution plan. The execution plan is a task list of sorts that decomposes a potentially complex SQL operation into a series of basic data access operations. For example, a query against the dept table might have an execution plan that consists of an index lookup on the deptno index, followed by a table access by ROWID.
    The EXPLAIN PLAN statement allows you to submit a SQL statement to Oracle and have the database prepare the execution plan for the statement without actually executing it. The execution plan is made available to you in the form of rows inserted into a special table called a plan table. You may query the rows in the plan table using ordinary SELECT statements in order to see the steps of the execution plan for the statement you explained. You may keep multiple execution plans in the plan table by assigning each a unique statement_id. Or you may choose to delete the rows from the plan table after you are finished looking at the execution plan. You can also roll back an EXPLAIN PLAN statement in order to remove the execution plan from the plan table.
    The EXPLAIN PLAN statement runs very quickly, even if the statement being explained is a query that might run for hours. This is because the statement is simply parsed and its execution plan saved into the plan table. The actual statement is never executed by EXPLAIN PLAN. Along these same lines, if the statement being explained includes bind variables, the variables never need to actually be bound. The values that would be bound are not relevant since the statement is not actually executed.
    You don’t need any special system privileges in order to use the EXPLAIN PLAN statement. However, you do need to have INSERT privileges on the plan table, and you must have sufficient privileges to execute the statement you are trying to explain. The one difference is that in order to explain a statement that involves views, you must have privileges on all of the tables that make up the view. If you don’t, you’ll get an “ORA-01039: insufficient privileges on underlying objects of the view” error.
    The columns that make up the plan table are as follows:
    Name Null? Type
    STATEMENT_ID VARCHAR2(30)
    TIMESTAMP DATE
    REMARKS VARCHAR2(80)
    OPERATION VARCHAR2(30)
    OPTIONS VARCHAR2(30)
    OBJECT_NODE VARCHAR2(128)
    OBJECT_OWNER VARCHAR2(30)
    OBJECT_NAME VARCHAR2(30)
    OBJECT_INSTANCE NUMBER(38)
    OBJECT_TYPE VARCHAR2(30)
    OPTIMIZER VARCHAR2(255)
    SEARCH_COLUMNS NUMBER
    ID NUMBER(38)
    PARENT_ID NUMBER(38)
    POSITION NUMBER(38)
    COST NUMBER(38)
    CARDINALITY NUMBER(38)
    BYTES NUMBER(38)
    OTHER_TAG VARCHAR2(255)
    PARTITION_START VARCHAR2(255)
    PARTITION_STOP VARCHAR2(255)
    PARTITION_ID NUMBER(38)
    OTHER LONG
    DISTRIBUTION VARCHAR2(30)
    There are other ways to view execution plans besides issuing the EXPLAIN PLAN statement and querying the plan table. SQL*Plus can automatically display an execution plan after each statement is executed. Also, there are many GUI tools available that allow you to click on a SQL statement in the shared pool and view its execution plan. In addition, TKPROF can optionally include execution plans in its reports as well.
    Trace Files and the TKPROF Utility
    TKPROF is a utility that you invoke at the operating system level in order to analyze SQL trace files and generate reports that present the trace information in a readable form. Although the details of how you invoke TKPROF vary from one platform to the next, Oracle Corporation provides TKPROF with all releases of the database and the basic functionality is the same on all platforms.
    The term trace file may be a bit confusing. More recent releases of the database offer a product called Oracle Trace Collection Services. Also, Net8 is capable of generating trace files. SQL trace files are entirely different. SQL trace is a facility that you enable or disable for individual database sessions or for the entire instance as a whole. When SQL trace is enabled for a database session, the Oracle server process handling that session writes detailed information about all database calls and operations to a trace file. Special database events may be set in order to cause Oracle to write even more specific information—such as the values of bind variables—into the trace file.
    SQL trace files are text files that, strictly speaking, are human readable. However, they are extremely verbose, repetitive, and cryptic. For example, if an application opens a cursor and fetches 1000 rows from the cursor one row at a time, there will be over 1000 separate entries in the trace file.
    TKPROF is a program that you invoke at the operating system command prompt in order to reformat the trace file into a format that is much easier to comprehend. Each SQL statement is displayed in the report, along with counts of how many times it was parsed, executed, and fetched. CPU time, elapsed time, logical reads, physical reads, and rows processed are also reported, along with information about recursion level and misses in the library cache. TKPROF can also optionally include the execution plan for each SQL statement in the report, along with counts of how many rows were processed at each step of the execution plan.
    The SQL statements can be listed in a TKPROF report in the order of how much resource they used, if desired. Also, recursive SQL statements issued by the SYS user to manage the data dictionary can be included or excluded, and TKPROF can write SQL statements from the traced session into a spool file.
    How EXPLAIN PLAN and TKPROF Aid in the Application Tuning Process
    EXPLAIN PLAN and TKPROF are valuable tools in the tuning process. Tuning at the application level typically yields the most dramatic results, and these two tools can help with the tuning in many different ways.
    EXPLAIN PLAN and TKPROF allow you to proactively tune an application while it is in development. It is relatively easy to enable SQL trace, run an application in a test environment, run TKPROF on the trace file, and review the output to determine if application or schema changes are called for. EXPLAIN PLAN is handy for evaluating individual SQL statements.
    By reviewing execution plans, you can also validate the scalability of an application. If the database operations are dependent upon full table scans of tables that could grow quite large, then there may be scalability problems ahead. On the other hand, if large tables are accessed via selective indexes, then scalability may not be a problem.
    EXPLAIN PLAN and TKPROF may also be used in an existing production environment in order to zero in on resource intensive operations and get insights into how the code may be optimized. TKPROF can further be used to quantify the resources required by specific database operations or application functions.
    EXPLAIN PLAN is also handy for estimating resource requirements in advance. Suppose you have an ad hoc reporting request against a very large database. Running queries through EXPLAIN PLAN will let you determine in advance if the queries are feasible or if they will be resource intensive and will take unacceptably long to run.

  • What's the difference between $APPLTMP and $APPLPTMP

    Hi All,
    I know we can set $APPLTMP and $APPLPTMP as per requirement.
    But I really want to know what is the exact difference between $APPLTMP and $APPLPTMP? Why there are those two variables? What is expected to be set for each?
    And are there any relationship between those two variables and concurrent log&output file path?
    Thanks,
    Xiaofeng

    I know we can set $APPLTMP and $APPLPTMP as per requirement.
    But I really want to know what is the exact difference between $APPLTMP and $APPLPTMP? Why there are those two variables? What is expected to be set for each?
    And are there any relationship between those two variables and concurrent log&output file path?Please see old threads which should answer your question.
    Re: apps 11.5.10 Report conc Request ending with error
    http://forums.oracle.com/forums/search.jspa?threadID=&q=%24APPLTMP+AND+%24APPLPTMP&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Difference between char and varchar, also the difference between varchar2

    Hi,
    Can anyone explain me the difference between char and varchar, and also the difference between varchar and varchar2...

    Varchar2 is variable width character data type, so if you define column with width 20 and insert only one character to tis column only, one character will be stored in database. Char is not variable width so when you define column with width 20 and insert one character to this column it will be right padded with 19 spaces to desired length, so you will store 20 characters in the dattabase (follow the example 1). Varchar data type from Oracle 9i is automaticlly promoted to varchar2 (follow example 2)
    Example 1:
    SQL> create table tchar(text1 char(10), text2 varchar2(10))
    2 /
    Table created.
    SQL> insert into tchar values('krystian','krystian')
    2 /
    1 row created.
    SQL> select text1, length(text1), text2, length(text2)
    2 from tchar
    3 /
    TEXT1 LENGTH(TEXT1) TEXT2 LENGTH(TEXT2)
    krystian 10 krystian 8
    Example 2:
    create table tvarchar(text varchar(10))
    SQL> select table_name,column_name,data_type
    2 from user_tab_columns
    3 where table_name = 'TVARCHAR'
    4 /
    TABLE_NAME COLUMN_NAME DATA_TYPE
    TVARCHAR TEXT VARCHAR2
    Best Regards
    Krystian Zieja / mob

  • What is the difference between #variable_name and :variable_name?

    Hi!
    What is the difference between #variable_name and :variable_name?
    I have found that if we use alphanumeric variable then :variable_name return value in quotes but #variable_name without quotes.
    Why it does not work in the same way for variable default values when variable is used in filter? (It works in mapping)
    I use variable in filter like T.OUT_DATE>convert(datetime,:LAST_UPDATE_DATE,121)
    When I use my variable in package and do refresh it works fine. But when I try to execute the same interface with variable default value I get error. Seems that variable name has been not changed to the value. It does not work with default value in quotes neither without quotes.
    Any ideas how to solve that?
    Thank you in advance!
    Edited by: user13278245 on Sep 15, 2010 4:34 AM

    Question is how to make it work with default value, when I execute interface standalone, not in package? And why it works in mapping but not in filter?
    + I have found that it works if source is Oracle. It doesn't work only for MS SQL source.
    Edited by: user13278245 on Sep 15, 2010 6:43 AM

  • Difference between Implicit and Explicit Cursors

    Hi All,
    Can you just tell me what is the difference between implicit and explicit cursor?
    Thanks,
    Padma

    Hi ,
    Implicit Cursor means ,the cursors which are defined impplicitly.Here we use curosr variables as "SQL%found,sql%not found,sql%is open.."
    but explicit cursors defined by us like if u create a cursor C1 then
    c1%found,c1% not found ,c1%open
    Thank you.

  • Difference between CHAR and VARCHAR2 datatype

    Difference between CHAR and VARCHAR2 datatype
    CHAR datatype
    If you have an employee name column with size 10; ename CHAR(10) and If a column value 'JOHN' is inserted, 6 empty spaces will be inserted to the right of the value. If this was a VARCHAR column; ename VARCHAR2(10). How would it handle the column value 'JOHN' ?

    The CHAR datatype stores fixed-length character strings, and Oracle compares CHAR values using blank-padded comparison semantics.
    Where as the VARCHAR2 datatype stores variable-length character strings, and Oracle compares VARCHAR2 values using nonpadded comparison semantics.
    This is important when comparing or joining on the columns having these datatypes;
    SQL*Plus: Release 10.2.0.1.0 - Production on Pzt Au 6 09:16:45 2007
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> conn hr/hr
    Connected.
    SQL> set serveroutput on
    SQL> DECLARE
    2 last_name1 VARCHAR2(10) := 'TONGUC';
    3 last_name2 CHAR(10) := 'TONGUC';
    4 BEGIN
    5 IF last_name1 = last_name2 THEN
    6 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is equal to -' || last_name2
    || '-');
    7 ELSE
    8 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is NOT equal to -' || last_n
    ame2 || '-');
    9 END IF;
    10 END;
    11 /
    -TONGUC- is NOT equal to -TONGUC -
    PL/SQL procedure successfully completed.
    SQL> DECLARE
    2 last_name1 CHAR(6) := 'TONGUC';
    3 last_name2 CHAR(10) := 'TONGUC';
    4 BEGIN
    5 IF last_name1 = last_name2 THEN
    6 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is equal to -' || last_name2
    || '-');
    7 ELSE
    8 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is NOT equal to -' || last_n
    ame2 || '-');
    9 END IF;
    10 END;
    11 /
    -TONGUC- is equal to -TONGUC -
    PL/SQL procedure successfully completed.
    Also you may want to read related asktom thread - "Char Vs Varchar" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1542606219593
    and http://tahitiviews.blogspot.com/2007/05/less-is-more-more-or-less.html
    Best regards.

  • Credit Management: Difference Between Static and Dynamic Credit Check

    Hi,
    Could anyone tell the difference Between Static and Dynamic Credit Check?
    According to website: http://www.sap-basis-abap.com/sd/difference-between-static-and-dynamic-credit-check.htm ... this is the answer:
    ====================
    Simple Credit Check : Tr.Code - FD32
    It Considers the Doc.Value + Open Items.
    Doc.Value : Sales Order Has been saved but not delivered
    Open Item : Sales Order has been saved , Delivered, Billed & Transfered to FI, but not received the payment from the customer.
    Static Credit Check it checks all these doc value & check with the credit limit
    1) Open Doc.Value / Sales Order Value : Which is save but not delievered
    2) Open Delivery Doc.Value : Which is delivered but not billed
    3) Open Billing Doc.Value : Which is billed but not posted to FI
    4) Open Item : Which is transfered to FI but not received from the customer.
    Dynamic Credit Check         1) Open Doc
                                                2) Open Delivery
                                                3) Open Billing
                                                4) Open Items
                                                5) Horizon Period = Eg.3Months
    Here the System will not consider the above 1, 2, 3 & 4 values for the lost 3 months.    
    ====================
    Question 1: Could you further explain the above information, if there is any?
    Question 2:: What is the Tcode to customize settings of:
    a) Simple Credit Check (isn't this same with b) below?)
    b) Static Credit Check
    c) Dynamic Credit Check

    Hi Tanish,
    Diff between Static and Dynamic Filters.
    Example One at report Level.
    Create a variable for a Infoobject say ,Material .
    1)In the Query Designer and if u restrict it to some 10 materials at query level, the report will display for only those 10 materials only.This is Static Filter.UR AHrdcoding it to those materials.You cant change them at Query Run time.i.e not changeable by user.
    2)If u give the variable as input ,and when u run the query ,u can can choose the material,may 10 may be 1 or may 20 .It is dynamic.Changeable by user at run time
    Example Two at DTP and Start Routine Level,say Document Type.
    1)If u give filters in Start routine it is Static as u cannot change it in Production,not changeable by user.
    2)f u give filters in DTP it is Dyanamic as u can change it in Production.U can give any doc type,Changeable by user at run time.
    Hope it is Understood.
    Rgds
    SVU

  • Difference between invoice and debit note

    Hi,
    what is the difference between invoice and a debit note.
    If I underinvoice a customer, should I raise a additional invoice for the difference or shud i raise a debit note. if  i need to raise debit note, then why not invoice or if i need to raise an invoice, then why not a debit note
    regards
    sachin

    Debit note is generally used to issue an invoice for already sold goods w/o physical goods movement involved.
    If raw material prices increases which are utilized in production of Finished goods. then the business will submit the relevant documents as proof at customer.
                  Once Customer is accepted, then price increase effective date will be finalized , Then business issues debit note request for the required material & its converted into debit note. ( all this will be done, based on agreement with the Customer). Generally this scenario is most widely used in Manufacturing / Automobile industry.
    where as, If invoice is created with less price than actual, you dont need to create debit note, instead you can either Cancel this invoice or create Invoice Correction request.
    hope it adds info

  • What's the difference between "overloading" and "overriding" in Java

    What's the difference between "overloading" and "overriding" in Java

    hashdata wrote:
    What is the real-time usage of these concepts...?Overriding is used when two classes react differently to the same method call. A good example is toString(). For Object it just returns the class name and the identityHashCode, for String it returns the String itself and for a List it (usually) returns a String representation of the content of the list.
    Overloading is used when similar functionality is provided for different arguments. A good example is [Arrays.sort()|http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#sort(byte%5B%5D)]: all the sort() methods do the same thing (they sort arrays), but one sorts byte-arrays, another one sorts int-arrays, yet another one sorts Object-arrays.
    By the way, you almost certainly mean "real-world" usage. "real-time" (and thus "real-time usage) means something entirely unrelated to your question.

  • Differences between sapr3 and isu

    Hi All,
    Can anybody explain differences  between isu and sapr3
    Thanks,
    Satya

    Hi Satya ,
    SAP R3 is for the General industry/Organization.SAP after studying and Analyzing the Fortune 500 Companies came up with the Best Process that suits most of the Industries however For few of the Industry Segments SAP came up with its VERTICALS like IS-Retail,IS-Utilities,Etc which will suit the industry requirement.
    Few of the Process and Configurations in IS-Utility will differ from that of the SAP-R3
    Rgds
    SVU123

Maybe you are looking for

  • "Epson Utility 4 Cannot be executed"

    Hi, I am using a Macbook Pro running Mac OS X Version 10.6.6, using an EPSON DX7450 Printer/scanner. I recently had to change the ink cartridges and followed the online instructions. All seemed to have gone well, but upon printing documents I have no

  • Not able to add artwork to new movies added to libairy

    i updated to 11.1.1 and after adding a new movie to my libairy i am not able to add artwork like i used to its a MPEG 4

  • Adobe Reader - Language

    How do I change the language in Adobe Reader from Danish to English.

  • Few sales group monthly statement are not printing

    Client is trying to print a statement for the sales group id xx1,xx2,xx3,xx4 while these come out blank. Actually there have been sales taken place but still it turns out to be blank. Where and how should i check and deal this issue?

  • Problems opening .ics files in Apple Calendar

    When I open an event invitation  that arrives as a .ics file, Apple Calendar opens but on the wrong day, at the wrong time, and with the wrong information. Is there anyway of fixing this? Im running OS 10.8.5 on a MacBook Air. Many thanks JohnC