Tit Bits .NET General concepts

Startup:

What is .NET framework:
.NET framework comprises CLR and Class libraries. Code that targets CLR is managed code. CLR aka Common Language runtime is the execution environment for managed code. It provides Garbage collection, JIT Compilation, Code Execution, code access security, interop, diagnostics, type safety & many services. Base class library is the set of class libraries that expose many .net services for all clr compliant languages.

Cold Startup: This happens when .NET runtime as well as application code were not in memory.
Warm Startup: This is faster. This happens when application is re-launched.

Thread.Suspend vs Thread.Sleep
Sleep() immediately puts the thread to sleep. While suspend() clr takes care to suspend after finding a safepoint to do so. Suspend() is not safe deadlocks can happen if the thread suspends with access to a resource that another thread is waiting for. Suspend()/Resume() deprecated functions from 2.0

Lock is a language construct that wraps Monitor.Enter & Monitor.Exit Both of them are basic synchronization objects. But Monitor class offers Wait & Pulse methods. But these are unsafe because if an thread enters wait after a pulse was issued it will result in deadlock. So for synchronization & communication between threads AutoResetEvent is the good construct.
Locks, Monitors & Mutexes are mutually exclusive. Semaphore is not mutually exclusive. Both semaphores & Mutexes derive from WaitHandle OS construct. Mutexes & semaphores can work across processes.

No comments:

Post a Comment