Skip to content

Commit

Permalink
Fix accessPage address translation algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
jpr98 committed Feb 8, 2020
1 parent 21c1bc8 commit df0ac5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mem/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func (m *memory) AccessPage(pid string, address int) (int, bool) {
displacement = m.PageSize
}

for _, page := range m.pages {
for pageFrame, page := range m.pages {
if page.pid == pid && page.virtualAddress == pageNumber {
if m.policy.LRU {
// incrementar
}
realAddress := page.virtualAddress*m.PageSize + displacement
realAddress := pageFrame*m.PageSize + displacement
return realAddress, true
}
}
Expand Down

0 comments on commit df0ac5a

Please sign in to comment.