Facebook 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

1. If dictionary is read only then no protection is needed. It is adding starvation for no good.

2. If read write operation are happening then reader writer will perform better, but still can cause some starvation, but it is better than one mutex.

3. You can have multiple mutex, each protecting subset of hash buckets. 1 mutex protects n buckets. Bucket%n is the mutex you need to grab. 1 mutex for each bucket would cost too much and would become unreasonable.

4. 1 reader writer lock for n buckets. Seems like over engineering to me.

- Anonymous October 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

The question is for identifying problems in this setup. If having 1 mutex only is causing problem, we should address the issue and change the design.

- PC September 17, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@steve: "totally10 Million个entry" ---> what do you mean by this? is the dictionary sorted in increasing order of keys?
As the data is huge(~ 10 GB),I guess, the interviewer is looking for some reader-writer sort of solution(assuming he wants to edit the entries too...)

- Dharam October 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I guess `个' is a chinese char.
10 Million个entry is actually chinglish which means 10 million entries . .......

- CStick October 28, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

It is chinese char.
It means "10 Million entries"

- gaoxinbo1984 November 01, 2012 | 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