Interview questions

Concepts of Monitor class, the interlocked class and the ReaderWriterLock class

<<Previous   Next>>

.NET threading - Concepts of Monitor class, the interlocked class and the ReaderWriterLock class - March 13, 2009 at 15:20 PM by Amit Satpute

Describe the concepts of Monitor class, the interlocked class and the ReaderWriterLock class. 

Access to objects by is controlled by the Monitor class. It grants a lock for an object to a single thread.
Critical sections can be access restricted by using object locks.
While a thread owns the lock for an object, no other thread can acquire that lock.
Interlocked class provides atomic operations for variables that are shared by multiple threads.
When two threads are executing concurrently on separate processors error protection is done.
The methods of this class help protect against errors that can occur when the scheduler switches contexts while a thread is updating a variable that can be accessed by other threads.
ReaderWriterLock synchronizes access to a resource. It allows either concurrent read access for multiple threads, or write access for a single thread.
A ReaderWriterLock provides better throughput than a simple one lock a time like Monitor. 

<<Previous   Next>>
 



Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring