Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.5. Lab Slides & Lab Manual.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Tutorial 3 - Linux Interrupt Handling -
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS1: Overview of Operating Systems 1.1. Windows.
Lab6 – Debug Assembly Language Lab
© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei
 A quantum is the amount of time a thread gets to run before Windows checks.  Length: Windows 2000 / XP: 2 clock intervals Windows Server systems: 12.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Operating Systems Parallel Systems and Threads (Soon to be basic OS knowledge)
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Chapter 14 Chapter 14: Server Monitoring and Optimization.
Systems Programming Course Gustavo Rodriguez-Rivera.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
MCITP Guide to Microsoft Windows Server 2008 Server Administration (Exam #70-646) Chapter 14 Server and Network Monitoring.
1 Inside the Windows NT Scheduler, Part 1 Assigning CPU time in a uniprocessor environment by Mark Russinovich Windows NT Magazine - July 1997 Inside the.
Operating System Organization
Windows Server 2008 Chapter 11 Last Update
16.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 16: Examining Software Update.
Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Scheduling in Windows Zoltan Micskei
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS4: Scheduling and Dispatch 4.6. Demos.
Windows OS Internals - Copyright © 2005 David A. Solomon, Mark E. Russinovich, and Andreas Polze Unit OS4: Scheduling and Dispatch 4.4. Windows Thread.
7.3. Windows Security Descriptors
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
Windows NT and Real-Time? Reading: “Inside Microsoft Windows 2000”, (Solomon, Russinovich, Microsoft Programming Series) “Real-Time Systems and Microsoft.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Tami Meredith, Ph.D. CSCI  Devices need CPU access  E.g., NIC has a full buffer it needs to empty  These device needs are often asynchronous.
ScreenMonkey v3. 7 (Tested Windows 7 64bits) screenmonkey
Windows 2000 System Mechanisms Computing Department, Lancaster University, UK.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS5: Memory Management 5.5. Lab Manual.
Chapter 33 Troubleshooting Windows Errors. STOP Errors  When Microsoft Windows XP encounters a serious problem  And the operating system can't continue.
Unit OS8: File System 8.6. Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows Operating.
NT Kernel CS Spring Overview Interrupts and Exceptions: Trap Handler Interrupt Request Levels and IRT DPC’s, and APC’s System Service Dispatching.
Unit OS11: Performance Evaluation Lab Manual.
3.1. Concurrency, Critical Sections, Semaphores
Unit OS A: Windows Networking A.4. Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows.
Lab 13 Department of Computer Science and Information Engineering National Taiwan University Lab13 – Interrupt + Timer 2014/12/23 1 /16.
WHDC PowerPoint Template Notes & Handouts
Unit OS6: Device Management 6.4. Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS8: File System 8.1. Background: File System.
Unit OS12: Scripting Lab Manual. 2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows Operating.
3. System Mechanisms ■ Trap Dispatching - Trap : A Processor`s mechanism for capturing an executing thread an exception or an interrupt occurs and transferring.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS7: Security 7.1. The Security Problem.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS4: Scheduling and Dispatch 4.5. Advanced Windows.
System Components ● There are three main protected modules of the System  The Hardware Abstraction Layer ● A virtual machine to configure all devices.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Virtualization Technology and Microsoft Virtual PC 2007 YOU ARE WELCOME By : Osama Tamimi.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS7: Security 7.4. Lab Manual.
7. IRQ and PIC ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  Interrupts ◦ Section
Kernel Synchronization in Linux Uni-processor and Multi-processor Environment By Kathryn Bean and Wafa’ Jaffal (Group A3)
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.3. Advanced Windows Synchronization.
3.2. Windows Trap Dispatching, Interrupts, Synchronization
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS1: Overview of Operating Systems 1.1. Windows.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
Unit 4: Processes, Threads & Deadlocks June 2012 Kaplan University 1.
CHAPTER 7 CONCURRENT SOFTWARE Copyright © 2000, Daniel W. Lewis. All Rights Reserved.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Hands-On Microsoft Windows Server 2008
Unit OS7: Security 7.4. Quiz Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze.
Unit OSC: Interoperability
Unit OS9: Real-Time and Embedded Systems
Unit OS4: Scheduling and Dispatch
Unit OS11: Performance Evaluation
Unit OS A: Windows Networking
Unit OS2: Operating System Principles
Unit OS10: Fault Tolerance
Unit OSB: Comparing the Linux and Windows Kernels
Intro to Processes CSSE 332 Operating Systems
Unit OS5: Memory Management
3.3. Advanced Windows Synchronization
CS333 Intro to Operating Systems
Presentation transcript:

Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS3: Concurrency 3.5. Lab Slides & Lab Manual

2 Copyright Notice © David A. Solomon and Mark Russinovich These materials are part of the Windows Operating System Internals Curriculum Development Kit, developed by David A. Solomon and Mark E. Russinovich with Andreas Polze Microsoft has licensed these materials from David Solomon Expert Seminars, Inc. for distribution to academic organizations solely for use in academic environments (and not for commercial use)

3 Roadmap for Section 3.5. Lab experiments investigating: Viewing the interrupt dispatch table Viewing configuration of programmable interrupt controller (PIC/APIC) Viewing the interrupt request level (IRQL) on Windows Monitoring Interrupt and DPC activity Viewing System Service Activity Viewing Global Queued Spinlocks Looking at Wait Queues

4 x86 Interrupt Controllers - Hardware Interrupt Processing Most x86 systems rely on i8259A Programmable Interrupt Controller (PIC) or a variant of the i82489 Advanced Programmable Interrupt Controller (APIC) - most new computers PICs work only with uniprocessor systems APICs work with multiprocessor systems Lab: Observe PIC / APIC configuration Use !pic and !apic kernel debugger commands

5 Viewing the IRQL on Windows On Windows Server 2003, kernel debugger displays IRQL: !irql debugger command: kd> !irql Debugger saved IRQL for processor 0x (LOW_LEVEL) Processor control region (PCR) and processor control block (PRCB) store: current IRQL, pointer to the hardware IDT, currently running thread, next thread selected to run.

6 Lab: Viewing IRQL/IRQ Assignments 1. Display the interrupt vector  XP/2003: !idt  Win2000: !kdex2x86.idt 2. Dump the KINTERRUPT block for the PS/2 mouse ISR to get the IRQL (Dt nt!_KINTERRUPT xxxxxx) 3. With Device Manager, go to the mouse device properties and click on the resources tab to see the IRQ  If you are on a uniprocessor system, the IRQ should be the 27-IRQL Note: IRQL is raised when breaking in with debugger or on a crash  !pcr displays this changed IRQL  !irql displays previous IRQL (Server 2003 & later)

7 Lab: Kernel Profiling Since time spent at DPC level and above is not accounted by driver type, one way to determine where time has been spent in kernel mode is by using a profiling/sampling tool Kernrate is a such a tool Free download from Can be used both for kernel time and user mode processes Can show where time is being spent down to the function level May miss short lived events or events close to the sampling interval Lab: Download and install Kernrate cd c:\program files\krview\kernrates Kernrate_i386_XP.exe -z ntoskrnl.exe –j srv*c:\symbols Perform some system activity (run Windows Media Player, drag windows around, etc) Press ^C to stop execution

8 Flow of Interrupts CPU Interrupt Controller CPU Interrupt Service Table ISR Address Spin Lock Dispatch Code Peripheral Device Controller n Raise IRQL Lower IRQL Read from device Acknowledge- Interrupt Request DPC Interrupt Object KiInterruptDispatchDriver ISR Grab Spinlock Drop Spinlock

9 Lab: ISR/DPC Tracing XP SP2 and Server 2003 SP1 and later support tracing ISRs and DPCs 1. Start capturing events (tracelog.exe is in Support Tools): tracelog -start -f kernel.etl -b 64 -UsePerfCounter -eflag 8 0x307 0x Stop capturing events: tracelog -stop 3. Generate reports (tracerpt.exe is part of Windows): tracerpt kernel.etl -df –report -o 4. Review workload.txt to determine where ISR/DPC time spent 5. Open "dumpfile.csv" & search for lines with "DPC" or "ISR" in the second value. In kernel debugger, do an “ln” on 8 th argument (start address)

10 Try to acquire spinlock: Test, set, was set, loop Test, set, WAS CLEAR (got the spinlock!) Begin updating data Try to acquire spinlock: Test, set, was set, loop Test, set, WAS CLEAR (got the spinlock!) Begin updating data Try to acquire spinlock: Test, set, WAS CLEAR (got the spinlock!) Begin updating data that’s protected by the spinlock (done with update) Release the spinlock: Clear the spinlock bit Try to acquire spinlock: Test, set, WAS CLEAR (got the spinlock!) Begin updating data that’s protected by the spinlock (done with update) Release the spinlock: Clear the spinlock bit Spinlocks in Action CPU 1CPU 2

11 Looking at Waiting Threads For waiting threads, user-mode utilities only display the wait reason Example: pstat To find out what a thread is waiting on, must use kernel debugger

12 Looking at Wait Queues !thread command to kernel debugger Lists addresses of objects being waited on (if a mutex, shows owner) !irpfind can search IRPs for an event object address