| US 7,558,889 B2 | ||
| Accessing a collection of data items in a multithreaded environment | ||
| Gail A. Alverson, Seattle, Wash. (US); Charles David Callahan, II, Seattle, Wash. (US); Simon H. Kahan, Seattle, Wash. (US); Brian D. Koblenz, Seattle, Wash. (US); Allan Porterfield, Bellevue, Wash. (US); and Burton J. Smith, Seattle, Wash. (US) | ||
| Assigned to Cray Inc., Seattle, Wash. (US) | ||
| Filed on Oct. 30, 2003, as Appl. No. 10/697,890. | ||
| Application 10/697890 is a continuation of application No. 09/361671, filed on Jul. 27, 1999, granted, now 6,862,635. | ||
| Application 09/361671 is a continuation of application No. 09/192207, filed on Nov. 13, 1998, abandoned. | ||
| Prior Publication US 2004/0093605 A1, May 13, 2004 | ||
| Int. Cl. G06F 13/14 (2006.01); G06F 12/00 (2006.01); G06F 3/00 (2006.01) | ||
| U.S. Cl. 710—52 [710/56; 710/57; 718/102] | 24 Claims |

| 1. A method in a computer system for accessing a collection of data items, the method comprising:
defining a pointer to indicate a location for a bucket;
defining a lower bound to indicate a number of items in the collection; and
determining based on the lower bound whether the collection has a data item; and
when it is determined that the collection has a data item,
adjusting the lower bound to indicate that the collection has one less data item;
reading from the bucket at the location defined by the pointer using a synchronization access mode of sync so that if the
bucket is currently marked empty, the reading is delayed until the bucket is marked full and so that the bucket is marked
empty upon reading to prevent subsequent reading from the bucket until the bucket is written to;
removing a data item from association with the bucket at the location defined by the pointer; and
writing to the bucket at the location defined by the pointer using a synchronization access mode of sync so that the bucket
is marked full allowing reading from the bucket;
when access to the location by a thread is blocked,
enabling an exception to be raised when the location is next accessed; and
blocking the thread; and
when an exception is raised as a result of access by another thread to that location,
completing the access by that other thread to that location; and
restarting execution of the blocked thread.
|