Notes
Slide Show
Outline
1
Practical Foundations of Debugging
Chapter 9
  • Virtual Memory, Processes and Threads – Part 1
2
How to fit?
3
Processing Data (Non-buffered I/O)
4
Processing Data (Buffered I/O)
5
Virtual memory
6
Physical vs. Linear addresses
7
Executing Code (OS is involved)
8
“Flat model” abstraction
9
 
10
Application memory (simplified picture from memory and stacks presentation)
11
CreateProcess: Mapping
12
Notes
  • Virtual memory range is 4Gb (32-bit)
  • Addresses in a user dump are linear addresses from virtual memory
13
Process
  • Operating system structure describing regions of virtual memory and other allocated resources (files, synchronization primitives, USER and GDI objects, etc.)
  • Application and other components (DLLs, files) are mapped into linear virtual address space
  • Owns resources
14
Virtual-to-Physical Mapping: Processes
15
Why do we need threads?
  • To improve application and system performance by creating pseudo-parallelism
  • Application performance: internet browser - if we click on a link a thread is created to download a new page, but we can still browse the current page
  • System performance: parallel access to hardware inside OS
16
Virtual-to-Physical Mapping: Threads
17
Thread
  • Unit of execution (current EIP)
  • At least one thread in a process
  • All resources (owned by a process) are shared among all process threads – synchronization issues
18
Mapping: 2 threads in process
19
Pictures vs. Words
  • Better than a thousand words
  • Bad example: Flow of CreateProcess (pp. 304-317 Inside Windows 2000)
  • Diagramming notations


20
UML (Unified Modeling Language)
  • Standard diagramming notation used to describe and communicate application structure and behavior, software architecture and designs  (http://www.uml.org/)
  • Diagrams for modeling static structure are similar to ER (entity-relationship) and EER (enhanced ER)
  • We will use UML diagrams to depict OS structures and interactions
21
Classes and objects
  • Class (entity type in ER)




  • Object (entity occurrence, class instance)
22
Relationships
  • Binary association
  • Generalization (parent – child, class - subclass)



  • Containment (full ownership)
  • Aggregation (shared ownership)
23
Simplified class UML diagram
24
Relationship example
25
UML sequence diagram (2 threads)
26
What’s next?
  • Virtual memory and processes
  • Multithreading, memory and stacks
  • Calling Windows functions
  • (stdcall vs. cdecl)
  • Strings
  • Pointers to pointers (LPSTR *)
  • Structures in memory