is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
Basically this is an implementation for kernel's version of malloc called kmalloc ...
- Vikas May 23, 2012phys_mem_t phys_mem_get_pages (uint32_t pages, uint32_t align)
{
static uint32_t current=0;
uint32_t stride = (1<<(align-1));
uint32_t mask = ~(stride-1);
uint32_t first;
int wrapped=0;
int found=0;
int i;
current &= mask; /* adjust for alignment */
first = current; /* keep track of where we started */
do
{
/* find a properly aligned bit */
found = get_bit (bitmap,current); // bitmap is an array representing 1 bit for a page in phy memory ... and a 1 represnts it is used and a 0 unused ...
while(!wrapped && !found)
{
current += stride;
if((current+pages) > ARCH_NUM_PAGES) // ARCH_NUM_PAGES is the no. of free pages in the memory ...
current=0;
if(current==first)
wrapped=1;
else
found = get_bit(bitmap,current);
}
/* now see if there are enough contiguous bits */
for(i=current+1;i<(current+pages);i++)
found &= get_bit(bitmap,i);
}
while(!wrapped && !found);
/* if(found) */
/* kprintf("found a bit at %08X\n\r",current); */
/* else */
/* kprintf("nothing found at %08X\n\r",current); */
/* if there is no set of bits to satisfy the request, then return
error code */
if(wrapped)
return PHYS_MEM_NONE;
/* otherwise, clear the bits and return the address */
num_free -= pages;
for(i=current;i<(current+pages);i++)
clear_bit(bitmap,i);
#ifdef DEBUG
kprintf("phys_mem_get_pages returning %08X\n\r",current<<PAGE_BITS);
#endif
return current<<PAGE_BITS;
}