Synchronisation, Thread Safety, Race Condition, Shared Variables, Atomic Operations, Critical Section, Semaphores, Starvation, Fairness, Deadlock are some of the concepts you might have gone through while studying concurrency. Here is an attempt to introduce these concepts using a few interesting examples.
Concurrency is more than one task running simultaneously on the system.
Critical section has the Shared Resource that should be accessed by only one task at a time.
Race Condition is when multiple tasks try to access the Shared Resource.
Synchronisation is needed to handle Race Condition and bring about co-ordination of tasks to achieve desired result.
Let’s take the readers-writer problem as an example. The problem statement will simply state. Implement reader and writer threads working on the same file concurrently. …
As I went through a stack of resume looking for a candidate, fit for the opening in my team, I couldn’t help but notice the plethora of un-important information that cluttered each and every resume. Although passion for travelling and reading are important, the things we look for in resume are focused around the technical work. Barring a few exceptions, a resume is filled with so many redundant details, one would need a search light to find something relevant.
They usually begin with a redundant objective section where the candidate describes the ideal company he wants to work for filled with generic terms or a summary section where he gives himself room to gloat about the noble deeds he has done. …
In my current stint at Amazon, I have the opportunity of taking interviews for the SDE 2 position. SDE 2 are supposed to have 3–5 years of experience and well versed in the concepts of design and programming. So one would assume writing the power function should be a walk in the park for an aspiring SDE2 candidate. But after taking a good number of interviews I realise that the assumption is so not true.
So let me break it down here for the fellow aspirants.
Question: Implement the power function so that
pow(2,3) = 8 and pow(3,2) = 9
The default response has been, “Hey, we can write a for loop to do this”. …
Here we have someone who has been talking to people for 17 long years, helping them achieve what they want. Pretty generic, right?
The message she is trying to give is pretty simple.
I never thought addiction to drugs or alcohol would be classified as a disease but watching this Ted talk made me wonder as to what other people think about this issue.
Here, the speaker starts by mentioning his family history of addiction. He was also isolated and insecure because of his sexuality and drinking helped him get away/forget his problems. He started drinking at an early age and it remained the solution to all adversities of life. At this point, he refers to it as a disease which remained undiagnosed.
Plenty of years later, after losing countless members of family and friends, he realised something was wrong and tried to give up the addiction. The path to recovery wasn’t simple as the society looked down upon addicts which doesn’t really help. Relapsing after quitting for some time is seen as falling off the wagon and is expected of addicts. …
On a warm summer Thursday we decided to visit Heidelberg, a town not too far from Frankfurt where we were on a business trip for a few weeks. Heidelberg is famous for its castle, the philosopher’s walk and the baroque style Old Town. It was only a short train ride away, about hour and a half worth of time. It has been recommended far too many times by our friends so we picked an evening to finally visit it.
Our journey started at Frankfurt Hauptbahnhof, a place always bustling with plenty of tourists in the summer season. As it was a long journey we took some delicious country burgers at Burger King. The thought of munching them while watching the country side pass by made me restless. …
I have written about my experience of interviewing for the SDE position of Amazon previously with focus on cracking the programming interview. Apart from the programming interview they give a lot of stress on designing systems.
I had little practice with designing systems so I followed a few basic principles to attempt the problems. Before talking about the principles let me start with a simple example on designing the game of chess.
If you start thinking about how you are going to model the movement of pieces on the board using some matrix then you are already on the wrong track. Forget about how you need to implement it, forget about the minor details and problems you might face in implementation. Design begins with getting the exact set of requirements. …
While planning for travelling on a long weekend in August, I heard about a group called Mystic Wild from a friend. She told me they organise kickass trips around Bangalore and the next trip is for Agumbe. I haven’t heard about Agumbe either, turned out its a small village known for heavy rainfalls and evergreen forests, nicknamed “Cherrapunji of the South”. Its also famous for waterfalls and King Cobra. The trip was supposed to last 2 days and various waterfalls, trekking and rafting were on the itinerary. This was enough to get me hooked.
Since we were going for trekking in the leech and snake infested regions I had to plan extensively. I borrowed a raincoat, bought travel bag and trekking shoes, packed couple of full shirts but couldn’t arrange leech socks. Yes, it is a thing! they are socks made with raincoat material except for the bottom part that goes inside the shoes which is made of cotton. Occasionally I have seen snakes and huge spiders on my past treks but no leeches. …
A recruiter found my profile on linkedin and informed me about an opening in Amazon for SDE 2 position. Just to provide a brief background on my profile, I am a graduate in computer science from IIT Bombay (India) and I had 4 years of experience in software development when I was given this opportunity.
Over the course of next 2 months I went through a telephonic screening round on programming, 3 on-site interviews with emphasis on design, one bar raiser round on people skills and software design followed by another round of programming interview. …