NVIDIA Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

For a uniprocessor,
mov eax, 1
lock_loop:
xchg [myLock], eax
jnz lock_loop

For SMP, I guess the interviewer would expect discussion on the MESI protocol for cache coherence and formation of memory hot-spots due to spinlocks. An explanation of false writes could possibly add some value in the interview.

- Anonymous January 13, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I believe UP doesn't require spinlock.

- SIVA April 13, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its more about how spin locking work in terms of disabling and re-enabling interrupts..
On SMP, spin_lock_irqsave() and spin_unlock_irqrestore is used.. it disables and re-enables the LOCAL interrupts..i.e. interrupts on the same CPU on which lock is help...so
other CPUs can continue serving the interrupts on them..

- Anonymous January 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

On UP,
With preemption enabled, spinlock will disable preemption.
With preemption disabled, spinlock is no-op.

- Ben May 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

On Both UP and SMP, it works in the same way since it is global to All the CPUs.
Now we need to decide where to use: like
ISRs and how ur critical section code shared between kernel context code and interuupt context code . where and when to disable interrupts.
But if preemption is selected, it disables preemption.
:::::::::::::

BETTER GO WITH UNDERSTANDING LINUX KERNEL By Oreilly

- mlakshmanarao July 20, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

in UP spinlock tells only that the kernek code is non preemitable(CONFIG_PREEMITABLE). and in SMP it works as it is introduced for as mentioned in wiki

- Anonymous February 12, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

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.

Learn More

Resume Review

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.

Learn More

Mock Interviews

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.

Learn More