Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefinition of operations on method for sequential extraction #2

Open
648trindade opened this issue Apr 20, 2020 · 0 comments
Open
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@648trindade
Copy link
Owner

Some atomic read/writes can be avoided since chunk_end has the same value of first during all the scheduling

function EXTRACT_SEQ
  old_first <- first
  chunk_begin <- MIN(chunk_end + chunk_size, last)
  if chunk_begin > chunk_end then
    first <- chunk_begin
    if chunk_begin < last then ! Confirma se a extração é válida
      tmp <- chunk_end
      chunk_end <- chunk_first
      chunk_first <- tmp
      return TRUE
    end if
    first <- chunk_end ! Conflito: desfaz e trava a si próprio
  end if
  LOCK(self)
  chunk_begin <- first
  if chunk_begin < last then
    first <- chunk_end <- last
  end if
  UNLOCK(self)
  return chunk_begin < first
end function
@648trindade 648trindade added the enhancement New feature or request label Apr 20, 2020
@648trindade 648trindade added this to the 1.1 milestone Apr 20, 2020
@648trindade 648trindade self-assigned this Apr 20, 2020
648trindade added a commit that referenced this issue Apr 26, 2020
648trindade added a commit that referenced this issue Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant