NVIDIA Interview Question for Software Engineer / Developers






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

By making a call to function :
thread_switch(S_SLEEP /*State*/, wchan *wc /*wait channel*/)

This would put curthread inside the kernel to sleep by putting it on sleep queue and changing its state from runnable to sleep.

- Varun Anand June 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

wait_queue_timeout are best way to to sleep inside kernel

- isuzu December 15, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

why do we need sleep in the kernel?
Kernel is like a machine which run everything , if kernel sleep , other thread won't get a chance to run , so the whole system will stop , unless you want to process interrupt.

I guess if in kernel you want this thread to sleep, you can do a context switch to let the current thread sleep, then you can let other thread run.

if you really want to sleep in kernel, you can disable interrupt, so that the scheduler won't have a chance to work , you will be able to sleep as long as you want with a while loop.

- Charles December 31, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

why not use schedule with a timer

- Manish May 05, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In atomic context use udelay/mdelay/ndelay(unsigned long val) functions
in non atomic context use waitque or usleep_range(), msleep() functions

- fadil muhammed June 14, 2021 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Through jiffies
for e.g :- n*HZ where n may be 1,2,3,... as per requirement.

- Dinesh September 28, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i will use
msleep(x);
where x is in milli seconds.

- rahul gupta May 14, 2013 | Flag


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