Results 1 to 4 of 4

Thread: which one is best volatile or Atomic?

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    which one is best volatile or Atomic?

    I use a shared flag between threads. I am really worry about the performance of updating/getting a boolean flag, whether it is volatile or Atomic?

    Tell me which one is best volatile or Atomic?

    -----------------------
    suresh


  2. #2
    Expert Member
    Join Date
    Sep 2006
    Answers
    477

    Re: which one is best volatile or Atomic?

    Usually for synchronization atomic access is used. And variable declared as volatile, will have atomic access by default.

    If you just need the values between threads, you might want consider using a static variable.

    In any case, Official JAVA page for your atomic doubts.
    http://java.sun.com/docs/books/tutor...cy/atomic.html

    Cheers!
    Kalayama

    Last edited by kalayama; 05-11-2007 at 08:14 AM. Reason: typo
    [COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]

    Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"

  3. #3
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Re: which one is best volatile or Atomic?

    Thanks Kalayama...

    --------------------
    suresh


  4. #4
    Expert Member
    Join Date
    Sep 2006
    Answers
    477

    Re: which one is best volatile or Atomic?

    Hey Suresh! If you need to say Just "Thanks" press the button next to my post There is no poing in just posting "Thank You" anyway...

    Cheers!
    Kalayama

    [COLOR="Blue"][SIZE="2"]"If you are not living on the edge of your life, you are wasting space"[/SIZE][/COLOR]

    Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact