Case Study. Windows XP. Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

Similar documents
Unit OS2: Operating System Principles. Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

Process and Thread Management

Outline. Process and Thread Management. Data Structures (2) Data Structures. Kernel Process Block (PCB)

Copyright Notice David A. Solomon and Mark Russinovich

Scheduling (Win 2K) CSE Computer Systems November 21, 2001

Windows Interrupts

Ausgewählte Betriebssysteme - Mark Russinovich & David Solomon (used with permission of authors)

Roadmap for This Lecture

Windows 7 Overview. Windows 7. Objectives. The History of Windows. CS140M Fall Lake 1

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

windows maurizio pizzonia roma tre university

OVERVIEW. Last Week: But if frequency of high priority task increases temporarily, system may encounter overload: Today: Slide 1. Slide 3.

RT extensions/applications of general-purpose OSs

Windows History 2009 Windows 7 2

Comp 310 Computer Systems and Organization

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

Process Scheduling Queues

CSE 451: Operating Systems Winter I/O System. Gary Kimura

Announcements. Program #1. Reading. Due 2/15 at 5:00 pm. Finish scheduling Process Synchronization: Chapter 6 (8 th Ed) or Chapter 7 (6 th Ed)

Timers 1 / 46. Jiffies. Potent and Evil Magic

Scheduling - Overview

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

For use by students enrolled in #71251 CSE430 Fall 2012 at Arizona State University. Do not use if not enrolled.

Process Description and Control

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Announcements. Program #1. Program #0. Reading. Is due at 9:00 AM on Thursday. Re-grade requests are due by Monday at 11:59:59 PM.

From last time. What is the maximum size of a file in bytes? What is the maximum total size of directories and files in a single disk partition?

CSI3131 Final Exam Review

Interrupts and Time. Real-Time Systems, Lecture 5. Martina Maggio 28 January Lund University, Department of Automatic Control

Operating System Review Part

Real Time and Embedded Systems. by Dr. Lesley Shannon Course Website:

Module 23: Windows NT. Windows NT

Interrupts and Time. Interrupts. Content. Real-Time Systems, Lecture 5. External Communication. Interrupts. Interrupts

Threads, SMP, and Microkernels. Chapter 4

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Module 23: Windows NT

Copyright Notice David A. Solomon and Mark Russinovich

Questions answered in this lecture: CS 537 Lecture 19 Threads and Cooperation. What s in a process? Organizing a Process

Module 22: Windows XP. Chapter 22: Windows XP. Objectives. Windows XP. History. Design Principles

Chapter 22: Windows XP

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

KOSR 22 차세미나. KOSR 연역및소개 t h K o r e a O p e r a t i n g S y s t e m S e m e n a r

Frequently asked questions from the previous class survey

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

This slide show uses materials from the Windows Operating System Internals Curriculum Development Kit

NuttX Realtime Programming

6/20/2018. Lecture 2: Platforms & RTOS. Outline. Lab Setup (20 min) Labs work. Lecture: Platform + RTOS

8: Scheduling. Scheduling. Mark Handley

CS2506 Quick Revision

Appendix C: Windows Operating System Concepts Essentials 8 th Edition

Chapter 9: Virtual-Memory Management. Operating System Concepts 8 th Edition,

Module 21: Windows 2000

Module 21: Windows 2000

Universal Windows Driver Development with WDF UMDF 2.0 and KMDF for IoT, Desktop and Server

LINUX OPERATING SYSTEM Submitted in partial fulfillment of the requirement for the award of degree of Bachelor of Technology in Computer Science

THREADS ADMINISTRIVIA RECAP ALTERNATIVE 2 EXERCISES PAPER READING MICHAEL ROITZSCH 2

Chapter 4 Threads, SMP, and

Interrupts, Etc. Operating Systems In Depth V 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.

OS Design Approaches. Roadmap. OS Design Approaches. Tevfik Koşar. Operating System Design and Implementation

CS370 Operating Systems

Course Syllabus. Operating Systems

Scheduling policy. Reference: ULK3e 7.1. Scheduling in Linux 1 / 20

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

Example: CPU-bound process that would run for 100 quanta continuously 1, 2, 4, 8, 16, 32, 64 (only 37 required for last run) Needs only 7 swaps

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Chapter 4: Multi-Threaded Programming

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

EE458 - Embedded Systems Exceptions and Interrupts

Native POSIX Thread Library (NPTL) CSE 506 Don Porter

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

238P: Operating Systems. Lecture 14: Process scheduling

Interactive Scheduling

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Two Level Scheduling. Interactive Scheduling. Our Earlier Example. Round Robin Scheduling. Round Robin Schedule. Round Robin Schedule

Chapter 2 Operating System Overview

SMD149 - Operating Systems

Chapter 4: Multithreaded Programming

Real-time Multiple Video Player Systems

Fall 2014:: CSE 506:: Section 2 (PhD) Threading. Nima Honarmand (Based on slides by Don Porter and Mike Ferdman)

CS370 Operating Systems

Department of Computer Science Institute for System Architecture, Operating Systems Group REAL-TIME MICHAEL ROITZSCH OVERVIEW

Multi-Level Feedback Queues

Chapter 4: Threads. Chapter 4: Threads

Real-Time Systems Hermann Härtig Real-Time Operating Systems Brief Overview

Main Memory. Electrical and Computer Engineering Stephen Kim ECE/IUPUI RTOS & APPS 1

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Chapter 3 Process Description and Control

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

Software Development & Education Center

Model Based Development of Embedded Control Software

Operating System Architecture. CS3026 Operating Systems Lecture 03

CSC Operating Systems Fall Lecture - II OS Structures. Tevfik Ko!ar. Louisiana State University. August 27 th, 2009.

Announcements. Computer System Organization. Roadmap. Major OS Components. Processes. Tevfik Ko!ar. CSC Operating Systems Fall 2009

Scheduling in the Supermarket

Process management. Scheduling

Processes. Overview. Processes. Process Creation. Process Creation fork() Processes. CPU scheduling. Pål Halvorsen 21/9-2005

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Transcription:

Case Study Windows XP Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

Background Architecture Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

3 Windows and Linux Both Linux and Windows are based on foundations developed in the mid-1970s 1970 1980 1990 2000 1970 1980 1990 2000

4 Architectures Both Linux and Windows are monolithic All core operating system services run in a shared address space in kernel-mode All core operating system services are part of a single module Windows: ntoskrnl.exe Windowing is handled differently: Windows has a kernel-mode Windowing subsystem

Kernel Architectures Application Windows User Mode Kernel Mode Win32 Windowing Device Drivers System Services Process Management, Memory Management, I/O Management, etc. Hardware Dependent Code 5

6 Windows Kernel Windows is a monolithic but modular system No protection among pieces of kernel code and drivers Support for Modularity is somewhat weak: Windows Drivers allow for dynamic extension of kernel functionality Windows XP Embedded has special tools / packaging rules that allow coarse-grained configuration of the OS Windows Drivers are dynamically loadable kernel modules Significant amount of code run as drivers (including network stacks such as TCP/IP and many services) Built independently from the kernel Can be loaded on-demand Dependencies among drivers can be specified

7 Portability Windows kernels are portable Mainly written in C Have been ported to a range of processor architectures

8 Layering, APIs, Complexity Windows Kernel exports about 250 system calls (accessed via ntdll.dll) Layered Windows/POSIX subsystems Rich Windows API (17 500 functions on top of native APIs)

Process Management Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

10 Process Management Windows Process Address space, handle table, statistics and at least one thread No inherent parent/child relationship Threads Basic scheduling unit Fibers - cooperative usermode threads

11 Scheduling Priorities Windows Two scheduling classes Real time (fixed) - priority 16-31 Dynamic - priority 1-15 Higher priorities are favored Priorities of dynamic threads get boosted on wakeups Thread priorities are never lowered 31 Fixed 16 15 Dynamic I/O 0 Windows

12 Windows Scheduling Details Most threads run in variable priority levels Priorities 1-15; A newly created thread starts with a base priority Threads that complete I/O operations experience priority boosts (but never higher than 15) A thread s priority will never be below base priority The Windows API function SetThreadPriority() sets the priority value for a specified thread This value, together with the priority class of the thread's process, determines the thread's base priority level Windows will dynamically adjust priorities for non-realtime threads

13 Real-Time Scheduling on Windows Windows supports static round-robin scheduling policy for threads with priorities in real-time range (16-31) Threads run for up to one quantum Quantum is reset to full turn on preemption Priorities never get boosted RT threads can starve important system services Such as CSRSS.EXE SeIncreaseBasePriorityPrivilege required to elevate a thread s priority into real-time range (this privilege is assigned to members of Administrators group) System calls and DPC/APC handling can cause priority inversion

14 Scheduling Timeslices Windows The thread timeslice (quantum) is 10ms-120ms When quanta can vary, has one of 2 values Reentrant and preemptible Fixed: 120ms 20ms Background Foreground: 60ms

15 Scheduling Windows NT has always had an O(1) scheduler based on pre-sorted thread priority queues Windows has always had CriticalSections Server 2003 introduced per-cpu ready queues Linux load balances queues Windows does not Not seen as an issue in performance testing by Microsoft Applications where it might be an issue are expected to use affinity

16 Virtual Memory Management Windows 32-bit versions split usermode/kernel-mode from 2GB/2GB to 3GB/1GB Demand-paged virtual memory 32 or 64-bits Copy-on-write Shared memory Memory mapped files 0 User 2GB 4GB System

17 Physical Memory Management Windows Per-process working sets Working set tuner adjust sets according to memory needs using the clock algorithm No swapper Process LRU Reused Page LRU Other Process

18 I/O Management Windows Centered around the file object Layered driver architecture throughout driver types Most I/O supports asynchronous operation Internal interrupt request level (IRQL) controls interruptability Interrupts are split between an Interrupt Service Routine (ISR) and a Deferred Procedure Call (DPC) Supports plug-and-play IRQL Masked

I/O & File System Management Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

20 File Caching Windows Single global common cache Virtual file cache Caching is at file vs. disk block level Files are memory mapped into kernel memory Cache allows for zero-copy file serving File Cache File System Driver Disk Driver

Security Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

22 Security Windows Very flexible security model based on Access Control Lists Users are defined with Privileges Member groups Security can be applied to any Object Manager object Files, processes, synchronization objects, Supports auditing