3 interview questions

Can anybody help please? Can't find good answers in the web.

1) When would you want select() to timeout? When would you want select() to
block indefinitely?

2) Could come up as to under what conditions you might use semphaphores vs
mutex vs. condition variable?

3) Could come up as to under what conditions you might use shared memory vs.
pipe vs. message queue?
closed account (G309216C)
Hi,

Good luck on interview.
[1] select() to check multiple sockets for readability and The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.

[2] We would come under a condition to use these to compare if another duplicate program is running in back-ground and then you can use a conditions to see IF it running or not ,if running do something else if it is not do something else.

[3] We could use these when communicating with other processes locally or Remotely. We can inject a code into another process to for a networking activity or other unspecific reason either using Code Injection or DLL injection then use pipes to communicate and same thing for others. A simple explaination is a Inter-Process Communication.
GL

Unless I understood the question completely wrong. I may answered moree detail but could not break my principles of not spoonfeeding everything.

May I ask you a question, how is this Unix\Linux programming becuase all of these things can be done on Windows and Linux. I do acknowledge the Kernel to Ring3 will be different but they do that same thing so why did you put it here?
Last edited on
Thank you for the answer!
need little clarification...

1) I understand select checks multiple sockets for readability and writability.

select(int nfds, fd_set *readfds, fd_set *
writefds, fd_set *exceptfds, struct timeval *timeout)

When you call select you can specify NULL in timeout which will block the select call forever.
or you specify time (for example 1 sec.) which will cause select to timeout (after 1 sec).

Now, Question is

When would you choose to block the select call forever and when would you choose select call to timeout?

2) Question is When you use semaphore? When you would rather mutex not semaphore?

3) Question is not "why you use IPC?" but, why do you choose a particular
IPC?





Those are conversation-starter questions for I/O multiplexing, thread messaging/synchronization, and IPC, respectively. It's an interview, not an exam: they need to know your familiarity, personal experiences, and opinions to figure out how much they have to teach you before you can become productive. At least that's why I would ask questions like that.

The question says "When would you ...". if you, personally, don't have anything to answer, say "I am not familiar with this topic".
Last edited on
closed account (G309216C)
This is the dead end guys, I answered his question but seems like some of his experience is not enough.

Sorry, I am not going to answer anything more because personally I think you have much Experience in this field. As Cubbi mentioned just say you are not familiar with this topic.

It is best choice to step away from lack of Experience in a Topic rather than quickly grab some knowledge and run. The reason is because if you feed wrong information to the interviewee, they will know.

This is the problem is that giving wrong answers in this field will make them more alert and less likely to even pick you because they will assume you may have false information on other topics as well.

Just answer what you know, do not jump a ahead of your self.
GL
Yeah, let's stop it here :-)
Topic archived. No new replies allowed.