Commit 8b57dafd by POTTIER Francois

### Some English fixes, plus comments.

parent 5b9bc76a
 ... ... @@ -22,7 +22,7 @@ since its creation. The item of rank~\idx\ is stored at offset $\idx \mmod \capacity$'' of the buffer, which we denote as $\modcap\idx$. % FP quand tu écris "the head", cela signifie "le contenu de la référence \refhead"? % préciser; idem pour tail % préciser (plus loin, il s'appelle $\head$); idem pour tail The \emph{head} is the number of items that have been enqueued since the creation of the queue, including those that have since been dequeued. In other words, it is the rank of the next item that will be enqueued. ... ... @@ -84,24 +84,28 @@ happens-before relationship from a dequeuer to an enqueuer. \subsubsection{Explanation of \tryenqueue and \trydequeue} Function~\tryenqueue first reads the current value of field~\refhead, getting The function~\tryenqueue first reads the current value of the field~\refhead, getting a value~\head. We have seen that the new item should have rank~\head. To check that offset~$\modcap\head$ is indeed available for rank~\head, the function reads its status: it should be equal to~$2\head$. % If it is not, we fail (a status less than~$2\head$ indicates that the cell is still used for an earlier rank, in other words the buffer is full; a status more than~$2\head$ indicates that the offset has been filled, possibly emptied, possibly several times, since we read \refhead, in other words we have lost still used for an earlier rank: that is, the buffer is full; a status greater than~$2\head$ indicates that the offset has been filled and possibly emptied, possibly several times, since we read \refhead: that is, we have lost a race against other enqueuers). if it is $2\head$, then we try to acquire rank~\head. If the status is $2\head$, then we try to acquire rank~\head. % Acquiring'' rank~\head\ means being the thread that succeeds in incrementing the atomic counter~\refhead from value~\head\ to $\head+1$, using a compare-and-set operation. If it fails, then again we have lost a race against Acquiring'' rank~\head\ means successfully incrementing the atomic counter~\refhead from~\head\ to $\head+1$, using a compare-and-set operation. If this operation fails, then again we have lost a race against other enqueuers, so the function fails. If it succeeds, we now have unique control of offset~$\modcap\head$, and we know that its status has not changed. % FP: au début tu parles d'acquérir un rang, % mais ensuite tu parles de contrôle unique d'un offset. % il faudrait sans doute clarifier le lien entre posséder un rang % et posséder un offset. Les deux vont ensemble je suppose? % % TODO: vague: Indeed, enqueueing an item with rank~\head\ is the only way to change it. ... ... @@ -109,7 +113,9 @@ Indeed, enqueueing an item with rank~\head\ is the only way to change it. Hence the offset is still available, and we can fill it with the new item, and update the status accordingly. Notice that, under weak memory, the order of these two writes matters: the atomic write to \refstatuses must propagate the nonatomic write to \refelements, so that the thread which will dequeue the item will see it after having read its status. information that the nonatomic write to \refelements has taken place. Thus, a thread which dequeues this item (after reading its status) is certain to read a correct value from the array \refelements. % FP indicate that this is a typical release/acquire idiom? Function~\trydequeue works analogously.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!