Microsoft Interview Question for Software Engineer / Developers






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

thread interference: you dont want two threads to interleave while accessing shared variables .. inconsistencies arise
deadlock: don't want to be stuck in a situation where each of the thread is waiting for the other thread to release a lock .. none of the thread can make any progress ..
starvation: don't want a thread to starve for resources being consumed by the other thread .. long and 'greedy' synchronized methods lead to this ..
livelovk: pretty much like deadlock but the threads are not blocked waiting for each other but they are continuously responding to each other requests ... but none of them is able to make any progress ...

- AV September 24, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Thread execute several tasks simultaneously. They share resources of the process they belong to. Most of the modern applications make use of threads to get the job done quickly. Sometimes, bad practices of multithreading may cause deadlock. To avoid that, one must be careful writing multi-threaded applications.

- Praveen September 23, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I think u should not use the term "simultaneously" until and unless there are multi-processors and threads are system level threads..."concurrently" is better!!

- Nitesh October 02, 2008 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

can u please explain still more clear

- balajee September 24, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Threads are sub-processes that execute independently but share the same memory of the parent process. Multithreading is useful to improve performance, by paralyzing tasks that are not dependent on each other and can run concurrently and your program will still work correctly. Problems that can arise are: data inconsistency if memory access by different threads is not handled properly: two threads writing to the same piece of memory or one writing and other reading at the same time with no lock protection. Another problem are deadlocks: no thread can proceed, because each thread is waiting for a resource that is being held by another thread, in a thread dependency cycle. Finally, if you use lock for everything the code will not take advantage of multi threading, the execution will seem sequential and the locks will add time to it.

- gdahis June 12, 2016 | 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