1 / 35

Lecture 4 System Mechanisms (2)

Lecture 4 System Mechanisms (2). xlanchen@03/18/2005. Contents. Trap dispatching The executive object manager Synchronization System worker threads Local procedure calls (LPCs). Object manager. EXPERIMENT Exploring the Object Manager. Uniform approach towards:

gavivi
Télécharger la présentation

Lecture 4 System Mechanisms (2)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 4 System Mechanisms (2) xlanchen@03/18/2005

  2. Contents • Trap dispatching • The executive object manager • Synchronization • System worker threads • Local procedure calls (LPCs) Understanding the Inside of Windows2000

  3. Object manager • EXPERIMENT • Exploring the Object Manager Understanding the Inside of Windows2000

  4. Uniform approach towards: • Object protection (C2 security) • Charging • Object naming • Object retention and garbage collection • Object access (via handles) • Standard object attributes • Standard object methods Understanding the Inside of Windows2000

  5. Process Memory Section Event Timer Object directory Queues Thread File Semaphore Symbolic link Port (registry) key Executive Objects Understanding the Inside of Windows2000

  6. Executive objects that contain kernel objects Understanding the Inside of Windows2000

  7. Object Structure Understanding the Inside of Windows2000

  8. Object properties • OM deletes object when: • #open handles drops to zero • #knl refs drops to zero • Obj names • Support identification, finding, sharing • Hierarchic (per machine) name space • Symbolic links, e.g. “C:” Understanding the Inside of Windows2000

  9. Type Objects • Process objects and the process type object Understanding the Inside of Windows2000

  10. EXPERIMENT • Viewing the Type Objects Understanding the Inside of Windows2000

  11. Type Object Attributes • Type name • Pool type • Default quota • Access types • Generic access rights mapping • Synchronization • Methods Understanding the Inside of Windows2000

  12. Object Methods • Open--When an object handle is opened • Close--When an object handle is closed • Delete--Before the object manager deletes an object • Query--name When a thread requests the name of an object, such as a file, that exists in a secondary object domain • Parse--When the object manager is searching for an object name that exists in a secondary object domain • Security--When a process reads or changes the protection of an object, such as a file, that exists in a secondary object domain Understanding the Inside of Windows2000

  13. Object Handles & Process Handle Table Understanding the Inside of Windows2000

  14. EXPERIMENT • Viewing Open Handles with Nthandle Understanding the Inside of Windows2000

  15. Structure of a handle table entry Understanding the Inside of Windows2000

  16. EXPERIMENT • Viewing the Handle Table with the Kernel Debugger Understanding the Inside of Windows2000

  17. Handles and reference counts Understanding the Inside of Windows2000

  18. Synchronization • Mutual exclusion • one, and only one, thread can access a particular resource at a time • Critical sections Understanding the Inside of Windows2000

  19. Kernel Synchronization • Kernel critical sections • For single-processor • Simple operating systems: disable all interrupts • 2K: raising the processor's IRQL • For a multiprocessor • spinlock Understanding the Inside of Windows2000

  20. Using a spinlock Understanding the Inside of Windows2000

  21. Executive Synchronization • Dispatcher objects • WaitForSingleObject • WaitForMultipleObjects • A thread in a Win32 application can synchronize with a Win32 process, thread, event, semaphore, mutex, waitable timer, I/O completion port, or file object • Executive resources • available only to kernel-mode code • aren't accessible from the Win32 API Understanding the Inside of Windows2000

  22. Waiting on a dispatcher object • A thread can synchronize with a dispatcher object by waiting on the object's handle Understanding the Inside of Windows2000

  23. Selected kernel dispatcher objects Understanding the Inside of Windows2000

  24. Understanding the Inside of Windows2000

  25. Wait data structures Understanding the Inside of Windows2000

  26. EXPERIMENT • Looking at Wait Queues Understanding the Inside of Windows2000

  27. System worker threads • Three types • Delayed worker threads • Critical worker threads • hypercritical worker threads Understanding the Inside of Windows2000

  28. EXPERIMENT • Listing System Worker Threads Understanding the Inside of Windows2000

  29. Windows 2000 Global Flags • NtGlobalFlag • Initialize • Gflags.exe • allows you to view and change the system global flags Understanding the Inside of Windows2000

  30. Local procedure calls (LPCs) • An interprocess communication facility • For high-speed message passing • An internal mechanism available only to Windows 2000 operating system components Understanding the Inside of Windows2000

  31. EXPERIMENT • Viewing LPC Port Objects Understanding the Inside of Windows2000

  32. Understanding the Inside of Windows2000

  33. Understanding the Inside of Windows2000

  34. “Internal” IPC between address spaces, e.g. • Transport for local RPC • Calls to Win32 subsystem • Variants: • n <= 256 bytes done inband • n > 256 bytes via shmem section • n > shmem section – addr-to-addr copy • Typically client-server • Client connects to servers well-known LPC port • Server opens new port and tells client its address Understanding the Inside of Windows2000

  35. LPC端口的使用 Understanding the Inside of Windows2000

More Related