Jump to content

Is a volatile ArrayList linearizable?

Featured Replies

I need to implement a non-blocking wait free Queue which needs to be linearizable. is this possible with an ArrayList if that ArrayList is declared to be volatile?

I need to implement a non-blocking wait free Queue which needs to be linearizable.

 

That's quite the sentence there. I'm having a bit of trouble wading through your jargon.

 

You want a queue to communicate between threads (I assume?) and want for it to be atomic in some manner? Do you mean thread-safe?

 

Non-blocking is a term I'm most familiar with in the context of I/O. Do you mean you want it to be lock-free?

 

If I'm reading this right, you want a lock-free queue which is thread safe. If that's the case, what you're asking for is pretty much impossible. A queue used for interthread communication will generally need a combination of a lock and a condition.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.