NVIDIA

virtual memory
threads
cache management

Given a page size and a number, align the number with the nearest page.
(Note: This was a phone interview question. The interviewer and I used an online document to share ideas about this problem.

Implement memcpy.

if there exists a sequence of integers in order, and you are at a receiver and you obtain these integers out of order, how can you know which integer is missing?

Write int max(int a, int b) function without using any comparisons (<, >, =, !=, etc), or conditional statements (if, while, for). The trick was to use bit shifting and create a algebraic expression to get the result.

interrupt handlers,
priority inversion to pipe-lining
reverse bits in an integer.

write a function to set a particular field of register to the desired value. ( For example, set bit 3 - 10 of a word to the given value)

Say the program you are running has stack overflow. You want to know when and where this happens, but you don't want to use debuggers, because they slow. How would you do this?

differentiate virtual address and physical address, TLB.

what is kernel mode vs. user mode.
why using printk()?

determine if a linked-list is circular.
find kth element from end in linked list

identify the number of 1s in an integer is odd or even
find a sub-string in a string

implementation of strstr & sprintf

memory management questions (deadlock, semaphores..)

Does virtual memory solve the problem of fragmentation? If yes how or if no then how?

Difference between pointer and reference.

How does removing page table entry from one processor affects the performance in a mulch-processor system?

What are read-write semaphores and how does it degrade performance in a mulch-processor environment.

In a below program statement
int x = 3;
will 3 be fetched into the cache after executing the above line of code?

implement the memalign() function

Add a node to a sorted linked list.

Implement a linked list structure and insert routine in C.Make it thread safe.

Implement a function for compare and swap in C. Use this function to implement linked list insertion. How could you take advantage of hardware caching to implement this.

Implement a reader-writer locking system.

Implement the function strstr which returns a pointer to the first occurrence of one string within another.

Implement a function that takes a list of signed integers and looks for the consecutive subset with the highest sum.

Find the words used in some text and report by word length and how often each word appears.

2 comments :

  1. how two threads one after another without effecting the scheduler
    How do you block the certain amount of code in one thread and after executing second thread also starting executing from the prefixed location in the code.

    ReplyDelete
  2. How to cross a symmetrical square canal of outer perimeter 42m x42m and an inner perimeter of 20m x 20m by using 2 planks of 10m length.

    ReplyDelete