... continued

This lesson clarifies the difference between managed and unmanaged threads and quizzes the reader on working with threads.

Managed vs Unmanaged Threads

As a refresher, unmanaged code is directly compiled to machine code and executed by the OS, whereas managed code is compiled to intermediate language IL and then executed by the Common Language Runtime (CLR). Threads created under the CLR are managed threads and represented by the class Thread. We can have a situation where threads created in unmanaged code execute managed code. The runtime monitors all the threads in its process that have ever executed code within the managed execution environment. It does not track any other threads. In this course, we'll be exclusively focusing on managed threads but it is important to be cognizant of the existence of unmanaged threads that can execute managed code.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.