The Royal Bank of Scotland Chennai Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

Just take the example of msword . it uses two threads: one for handling rendering and another for managing the UI. The rendering thread effectively runs hidden in the background for spell check etc while the UI thread receives input, handles events, and runs application code.
considering the advantages of using threads like they are light weight , inter thread communication is easy and a thread context switch is cheap , its better to use multithreaded solution.

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

One thread can wait for input while the other does background work. Without threads, you would not be fully utilizing the system because no background work would be getting done while you're waiting for input, blocked on disk I/O, etc.

- eugene.yarovoi December 30, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Untrue. You can use select(3) (on UNIX and Windows for sockets) or specify the OVERLAPPED flag in CreateFile (on Windows) to do both. For just one example you can check out the mainloop mechanism of the glib library (which runs both on Windows and UNIX (Linux and Mac at the very least)). I don't believe there is any real difference between the two - other than the convenience of not having to specify timeouts by hand. If there was a real difference, I believe threads would have gone into wide use in the 90s.

- T M December 30, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

To be completely honest, I'm not exactly sure what you're talking about, but in any case, I certainly did not mean to imply that there aren't other ways of doing I/O and the like. I'm just saying that this is one way you could decide to use threads.

I think the question is significantly more basic than you take it to be. I think it's asking why you would use threads in a typical program, not what advantages threads have over special non-blocking I/O, etc.

- eugene.yarovoi December 30, 2011 | 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