Pergunta de entrevista da empresa NVIDIA

Memory mapping in registers. Based on paging, where page size was fixed. Basically you know the memory size and the start address, you have to return the pages coming in that range. This is what I understood after a lot of thinking. The interviewer was not very clear about it

Respostas da entrevista

Sigiloso

9 de mai. de 2012

Basically, what I told was, since you know where to start and the length of the memory to be mapped, you basically need to know on which page it starts (0,1,2) and which page the mapping ends(depending on the length) and then when you know that you can return those pages. I could answer only through a pseudo code, where I used the idea of using the page size as the divisor and use the addresses to find the on which page they lied. The interviewer didn't approve of that (as they were pseudo codes) and that the division operations were not efficient (Agreed). I asked him what the correct answer was, he wrote something hurriedly, related to bit-shifting (which is division done efficiently). If somebody knows the standard question and answer please post it.

Sigiloso

17 de fev. de 2017

When a page size is fixed (usually a power of 2) you can take that many bits out of the lower order bits in the memory to be mapped to figure out what the offset within a page is. And the remaining bits would tell you the page number.