I’m not going to use C (I haven’t done C programming in almost 5 years) – I’ll stick with C#. Write a C program which measures the speed of a context switch on a UNIX/Linux system.įinally, some code! I’ve never attempted something like this before, so I’m fairly confident I’m going to fail miserably – but that’s half the challenge in my opinion. If I had to venture a guess I would say that it’s similar to a sunk cost – something that is done and cannot be changed. I think there might be some cultural difference that makes this question more difficult to me than it should be – I’ve never heard of “dead beef”. Which one would I use to protect access to an increment operation? Well, if I’m using C# I would say neither – just use Interlocked.Increment – but in the general scenario I would use a mutex.Ī man pushed his car to a hotel and lost his fortune. Essentially a mutex is a semaphore where the limit is set to 1. A mutex is used when only one thread or process is allowed to access a resource and a semaphore is used when only a certain set limit of threads or processes can access the shared resource. What is the difference between a mutex and a semaphore? Which one would you use to protect access to an increment operation?īoth mutexes and semaphores are used to control access to a shared resource – most often in multithreading scenarios. Manhole covers are round for 2 reasons – so that the cover can’t actually fall into the manhole and so that they’re easier to move (roll them). In fact, this is such a common interview question that I’m pretty sure this never gets asked. You’ll notice that I only looked at the Software Engineer questions. I tried to do the questions without resorting to Google (no pun intended), so if my answers seem idiotic keep that in mind. While I don’t plan on working for Google (not saying I wouldn’t like to – I just don’t think I’ve got the kind of experience they’re after) I do enjoy challenging interview questions and I thought I would see how I fare with them. I came across a very interesting article this morning regarding common Google Interview questions.
0 Comments
Leave a Reply. |