Apple Interview Question for Developer Program Engineers


Country: United States




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

This question has not been posted clearly. What kind of scheduling policy is used? How is priority computed - statically or dynamically? What are the functions of T1,T2? Are they io bound or cpu bound?
In case of non preemptive scheduler with static priority scheme this should not e too difficult to achieve. the starting priority is assigned such that T2 > T1. All is well.
But in other case it can only be fixed by avoiding all scenarios that can cause such a condition. For example if the scheduler calculates priority dynamically, after T2 uses the CPU it will be penalised and its priority will go down. Other condition is that if T1 is starving the scheduler will raise T1;s priority such that it gets a chance. At this point priority will be T1 > T2.

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

they want to hear Priority inversion. check priority inheritance and priority ceiling

- Anonymous December 25, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Poll after some constant time
If T1 has priority p always set T2 priority lesser then T1 that is p+1

- Kim October 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Follow up question: How will you make sure that T2 priority is not decreased?

- snehaldesh1 October 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I guess they are talking about priority inversion issue.

- Anonymous February 20, 2013 | 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