Results 1 to 3 of 3
  1. #1
    S8G Legend is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default Is a volatile ArrayList linearizable?

    I need to implement a wait free, non-blocking, linearizable queue. Can this be done with a volatile Arraylist?

  2. #2
    mrmatt1111's Avatar
    mrmatt1111 is offline Senior Member
    Join Date
    Aug 2009
    Location
    San Jose, CA, USA
    Posts
    320
    Rep Power
    6

    Default

    How about a ConcurrentLinkedQueue()?

    ConcurrentLinkedQueue (Java Platform SE 6)
    My Hobby Project: LegacyClone

  3. #3
    S8G Legend is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    while it seems that would work, i was just informed that the implementation needs to be done with primitive types

    so something to the effect of
    Java Code:
    T[] stuff;
    int var1, var2
    
    pop()
    {
     T temp = stuff[var1];
     (some operation with var2)
     return temp;
    }
    
    push(T val)
    {
     stuff[var2] = val;
     (some operation with var1)
    }

Similar Threads

  1. Keyword : volatile
    By peiceonly in forum Advanced Java
    Replies: 13
    Last Post: 11-17-2010, 12:47 PM
  2. Transient & Volatile
    By Deepa in forum New To Java
    Replies: 2
    Last Post: 12-05-2008, 09:30 AM
  3. use of volatile
    By venkatallu in forum New To Java
    Replies: 3
    Last Post: 09-23-2008, 09:59 PM
  4. volatile and synchornized
    By goldhouse in forum Threads and Synchronization
    Replies: 3
    Last Post: 04-23-2008, 08:38 PM
  5. volatile variable
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 10:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •