cs1 Flashcards
What <b>CLR</b> stands for?
Common Language Runtime
Core features of the CLR are…
- Memory management
- Assembly loading
- Security
- Exception handling
- Thread synchronization
What DEP and ASLR stand for?
DEP - Data Execution Prevention
ASLR - Address Space Layout Randomization
Uses of Metadata are…
- Removes need for native C/C++ header and lib files
- IntelliSense parses metadata to offer help within VS
- CLR’s code verification process uses metadata to ensure code performs type-safe operations
- Allows object’s fields to be serialized/deserialized
- Allows garbage collector to track lifetime of objects - knows which fields refer to other objects
What is an assembly?
- Logical grouping of 1 or more modules or resource files.
- Smallest unit of reuse, security and versioning
How to check if .NET is installed and what version?
- %SystemRoot%\System32\MSCorEE.dll
- %SystemRoot%\Microsoft.NET\Framework
- .NET Framework SDK -> CLRVer.exe - lists all installed CLR versions
What is a unit of work for CLR’s JIT?
Method
When a method get’s JITted? How does it proceed?
On first occurence.
- Look up method in the assembly’s metadata
- Get IL for the method
- Allocate block of memory
- Compile the IL into native CPU instructions and save in the allocated memory
- Modify the method’s entry in the Type’s table to point to the allocated memory block
- Jump to the native code in the allocated block
Two IL characteristic features
- stack-based - all instructions push operands onto an execution stack. No register manipulation. Easy to create new languages.
- Typeless - e.g. single add instruction - determines the types of operands on execution
What is IL verification process?
During compilation of IL into native CPU instructions CLR performs verification, it checks:
- correctness of method calls (proper number of parameters etc.)
- for improper accesses to memory
Pros and cons of NGen
Pros:
1. Improving startup time
2. Reducing working set - if the assembly is loaded by multiple processes simultaneously
Cons:
1. Can get out of sync (CLR version changes, CPU changes, OS ver. changes, etc.)
2. Inferior execution-time performance
What FCL stands for?
Framework Class Library
What PCL stands for?
Portable Class Library
What is a Type by CTS’s definition?
CTS - Common Type System Type contains zero or more members such as: Field Method Property Event with optional modifiers: Private Family - derived only (C#: protected) Family and assembly - derived in same assembly (C#: not available) Assembly - only assembly (C#: internal) Family or assembly - derived or same assembly (C#: protected internal) Public
Type can only derive from one base class Every type inherit from System.Object
System.Object - what it allows for?
- Compare two instances for equality
- Obtain a hash code for the instance
- Query the true type of an instance
- Perform bitwise copy of the instance
- Obtain a string representation