Symantec Interview Question for Senior Software Development Engineers


Country: India




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

The .wait() method waits on the object it's being called on, until the .notify() method is called on that object at which point the waiting thread is woken. Notify only wakes one thread waiting on the object, whereas notifyAll wakes all of them.

Wait/Notify is useful when a thread needs access to a resource or data which is not yet available. One option would be to have a busy loop which keeps polling the data or resource until it's available, but that would just be wasting CPU cycles. With notify the thread can be suspended until the data or resource is available.

- Anonymous April 05, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am not aware of these methods in Java. but as far as my understanding of POSIX pthread API, these are same as pthread_cond_wait, pthread_cond_signal and pthread_cond_broadcast respectively. In case we consider POSIX semaphores, then these are equivalent to sem_wait and sem_post (there is no sem_broadcast operation).

- Jitendra Singh September 26, 2013 | 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