Bloomberg LP Interview Question for Financial Software Developers


Country: United States
Interview Type: Phone Interview




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

use mutex

- Rocky March 04, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 vote

Well I can answer this in terms of Software Lock.

1> Use some map or even 2 dimensional array / vector will do.
2> First index use to determine whether we can do the operation on the second index value.
3> Second index use the memory location where the object in context resides.
4> Once the process gets the access change the value of first index to "NOT OPERATABLE" State and release back once it stops its execution.


Disadvantage :-
The Scheduler itself is not thread safe.

- hprem991 February 06, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is not safe.
What if you get swapped out after testing that you can access the shared resource, but before changing the "first index" to "Not Operatable". Then the swapped in process does the same and sees the "first index" is not set to "Not Operatable" so it sets it and starts to modify the shared resource. During this time there may then be a swap back to the first process which then sets the "first index" to "Not Operatable" and also starts modifying the shared resource.

To do this properly you need something similar to an atomic "test and set (TAS)" operation. This tests and sets a flag in an uninterruptable single instruction. Most operating systems will provide some form of mutex for this.

- Sie March 26, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

phread_mutex_t
init it, lock it, unlock it then destroy it.

- hf6440 March 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@hf6440 might mean 'pthread_mutex_t'

- orangetime23 May 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Mutual exclusion is performed at the OS layer using either : semaphores, mutex, criticalsection, or in limited cases Interlocked* functions. Unless they want you to use a class wrapper around one of these options.

- ntf January 09, 2015 | Flag Reply


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