This preview shows page 1-2-3-4-29-30-31-32-59-60-61-62 out of 62 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 62 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8 &&&&tail.compareAndSet(oldTail,&oldHeadNext);&//&tail&updaVng&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&No&need&to&deal&with&tail&9 &if&(head.compareAndSet(oldHead,&oldHeadNext))&{&10 &return&oldHeadNext.item;&}&}&}&}&}&Var&T1&T2&oldHead&oldTail&oldHeadNext&&head&tail&0& 1& 2& λ&Trace&1:&T1&wins,&CAS&succeeds&&&&&&&&public&E&take()&{&&&&&&&&&&&&for&(;;)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&Keep&trying&&1 &Node<E>&oldHead&=&head.get();&&&&&&&&&&&&&&&&&&&&&&&&//&current&head&2 &Node<E>&oldTail&=&tail.get();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&//&current&tail&3 &Node<E>&oldHeadNext&=&oldHead.next.get();&//&curr&head.next&4 &if&(oldHead&==&head.get())&{&&&&&//head,&tail,&and&next&changed?&5 &&&&&if&(oldHead&==&oldTail)&{&&&&&&//Queue&empty&or&tail&updated?&6 &&&&&&&&&if&(oldHeadNext&==&null)&{&&&&&&&&&&&&&&&&&&&&&&//&Is&queue&empty?&7 & &return&null;&&&&&&&&&&&&&&&&&&&&&&&&&&&//Queue&is&empty,&can't&take&&&&&&&&&&}&8


View Full Document

UMD CMSC 433 - Trace 1

Documents in this Course
Reflection

Reflection

137 pages

Testing

Testing

25 pages

Paradigms

Paradigms

10 pages

Testing

Testing

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Trace 1

Trace 1

46 pages

Jini

Jini

4 pages

Final

Final

15 pages

Java RMI

Java RMI

13 pages

Testing

Testing

16 pages

Load more
Download Trace 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Trace 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Trace 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?