Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Dot Net Technologies Interviews:.Net Architecture.Net Database.Net Deployment.NET web servicesADO.NETADO.NET 2.0ASP ProgrammingASP.NetASP.NET 2.0ASP.NET CachingASP.Net MVCBizTalkC# (Sharp) Programming LanguageCOM+Crystal ReportsDataGrid (Grid view)Dot NetDot Net AssemblyDot Net Code SecurityDot NET crystal reportsDot Net FrameworkDot Net RemotingDot Net WindowsFormsEntity FrameworkMicrosoft .Net MobileMicrosoft BasicsMicrosoft.NETMicrosoft.NET 2.0Mixed MicrosoftMono FrameworkMOSSMSFMTSReporting ServicesSenior .Net DeveloperVB .NetVB .Net DeveloperVB.NET FrameworkWCF (Windows Communication Foundation)WCF Data ServicesWeb Forms
Copyright © 2018. All Rights Reserved
.Net Architecture Interview Question:
Explain the race around condition? How can it be overcome?
Submitted by: AdministratorRace conditions is a severe way crashing the server/ system at times. Generally this problem arises in priority less systems or the users who has eqal priority will be put to this problem. Race condition is a situation in which a resource D is to be serviced to a process A and the processB which holds the resoure C is to be given to the process A. So a cyclic chain occurs and no way the resources will be get shared and also the systems with equal prirority wont get the resoure so that the system wont come out of the blocked state due to race condition!
Race condition is a bug in your application, occurs when the result of your application depends on which one of two or more threads reaches a shared block of code first. In this case, the application output changes each time it is executed!
As an example; assume that we have a shared integer object called x, and we have two threads 1, and 2. Thread number 1 attempt to increment the x object by one, and during this increment process, its time slice has been finished. Thread 2 time slice just start and it attempt to increment the same x object too. Thread 2 incremented the x object successfully, and then its time slice finished. Thread 1 starts a new time slice and completing the increment process not knowing that the object x value is already changed. This is a race condition, and the output of such code is of course incorrect!
The above race condition problem can be solved by using an object like "InterLock", with its "Increment", and "Decrement" methods.
Race conditions can be avoided generally by considering each line of code you write, and asking yourself: What might happen if a thread finished before executing this line? or during executing this line? and another thread overtook it?
Submitted by: Administrator
Race condition is a bug in your application, occurs when the result of your application depends on which one of two or more threads reaches a shared block of code first. In this case, the application output changes each time it is executed!
As an example; assume that we have a shared integer object called x, and we have two threads 1, and 2. Thread number 1 attempt to increment the x object by one, and during this increment process, its time slice has been finished. Thread 2 time slice just start and it attempt to increment the same x object too. Thread 2 incremented the x object successfully, and then its time slice finished. Thread 1 starts a new time slice and completing the increment process not knowing that the object x value is already changed. This is a race condition, and the output of such code is of course incorrect!
The above race condition problem can be solved by using an object like "InterLock", with its "Increment", and "Decrement" methods.
Race conditions can be avoided generally by considering each line of code you write, and asking yourself: What might happen if a thread finished before executing this line? or during executing this line? and another thread overtook it?
Submitted by: Administrator
Copyright 2007-2025 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.