ebook

Similar documents
投影片 1

ebook 132-6

ebook12-1

第一章 概论

提纲 1 2 OS Examples for 3

3 N D I S N D I S N D I S N D I D D K C p a c k e t. c o p e n c l o s. c r e a d. c w r i t e. c p a c k e t. r c p a c k e t. s y s p a c k e t. i n

ebook129-11

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

, 7, Windows,,,, : ,,,, ;,, ( CIP) /,,. : ;, ( 21 ) ISBN : -. TP CIP ( 2005) 1

ebook15-10

ebook39-6

ebook 132-2

ebook50-15

epub 61-2

51 C 51 isp 10 C PCB C C C C KEIL

W. Richard Stevens UNIX Sockets API echo Sockets TCP OOB IO C struct C/C++ UNIX fork() select(2)/poll(2)/epoll(4) IO IO CPU 100% libevent UNIX CPU IO

Microsoft PowerPoint - os_4.ppt

ebook140-11

92 (When) (Where) (What) (Productivity) (Efficiency) () (2) (3) (4) (5) (6) (7) em-plant( SiMPLE++) Scheduling When Where Productivity Efficiency [5]

Cadence SPB 15.2 VOICE Cadence SPB 15.2 PC Cadence 3 (1) CD1 1of 2 (2) CD2 2of 2 (3) CD3 Concept HDL 1of 1

ebook140-8

ebook140-9

06 最新計算機概論 6-1 電腦軟體的類型 (software) (system software) (application software) Microsoft Office Adobe Photoshop Internet Explorer Macromedia Dreamweaver (

ebook 185-6

Desktop Management Guide

ebook204-2

ebook66-15

FY.DOC

提纲 Classical Problems of Synchronization 1 Classical Problems of Synchronization 2 3 4

epub 34-1

ebook70-19

未命名

ebook129-9

untitled

Chapter 9: Objects and Classes

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

Chapter 2

概述

普 通 高 等 教 育 十 二 五 重 点 规 划 教 材 计 算 机 系 列 中 国 科 学 院 教 材 建 设 专 家 委 员 会 十 二 五 规 划 教 材 操 作 系 统 戴 仕 明 姚 昌 顺 主 编 姜 华 张 希 伟 副 主 编 郑 尚 志 梁 宝 华 参 编 参 编 周 进 钱 进

C/C++ - 字符输入输出和字符确认

Oracle 4

`§Ù©u•Z37¥¡-4Æ’ Z.pdf

目录

27 :OPC 45 [4] (Automation Interface Standard), (Costom Interface Standard), OPC 2,,, VB Delphi OPC, OPC C++, OPC OPC OPC, [1] 1 OPC 1.1 OPC OPC(OLE f

ebook50-11

Microsoft Word - 11.doc

Microsoft Word - 澎湖田調報告_璉謙組.doc

epub83-1

untitled

概述

Copyright 2007 Hewlett-Packard Development Company, L.P. Microsoft 和 Windows 是 Microsoft Corporation 在 美 国 的 注 册 商 标 Bluetooth 是 其 所 有 者 拥 有 的 商 标,Hew

Microsoft Word - 小心翼翼的二十一點N.doc

PTS7_Manual.PDF

C/C++ - 文件IO

epub 75-1

128 ( ) ( ) [ 1 ] [2] [3] (1) (2) (3) [1] [2] [3] 10 2 ( ) (1997.6) ( ) 64

/ / (FC 3)...

Basic System Administration

ebook62-8

PowerPoint Presentation

驱动开发书籍介绍

ebook177-1

CHAPTER 1

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

TwinCAT 1. TwinCAT TwinCAT PLC PLC IEC TwinCAT TwinCAT Masc

Microsoft PowerPoint - MBL326_张汝颇.ppt [Compatibility Mode]

ebook66-24

BizSpark 初 创 公 司 计 划 指 南 目 录 什 么 是 BizSpark?... 1 计 划 概 述... 1 计 划 结 构 和 角 色... 1 初 创 公 司 资 格... 3 使 用 BizSpark 的 产 品 和 联 机 服 务 的 示 例 :... 3 职 责... 5

_汪_文前新ok[3.1].doc

ebook43-11

RunPC2_.doc

epub 79-1

untitled

WebSphere Studio Application Developer IBM Portal Toolkit... 2/21 1. WebSphere Portal Portal WebSphere Application Server stopserver.bat -configfile..

1 o o o CPU o o o o o SQL Server 2005 o CPU o o o o o SQL Server o Microsoft SQL Server 2005

ebook2-1

NNM_Advance_DS_FNL.qxd

Outline USB Application Requirements Variable Definition Communications Code for VB Code for Keil C Practice

c_cpp

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

C语言的应用.PDF

教育部高等学校教学

untitled

<C1F7CCE5C1A6D1A7D3EBC8C8B9A4BBF9B4A12DB3C2C0F12DC7E5BBAAB4F33F504446>

Microsoft PowerPoint - RT0950_EliminatingRubyGILthroughHTM_Slides_ja.ppt

表3:

epub 76-1

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

ebook20-2

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii

提问袁小兵:

TX-NR3030_BAS_Cs_ indd

ebook15-C

C/C++ - 函数

VB程序设计教程

C/C++程序设计 - 字符串与格式化输入/输出


1994 年 10 月 17 日 : 去 微 软 面 试 去 微 软 面 试 之 前, 我 就 读 了 很 多 有 关 微 软 面 试 的 文 章 大 家 都 说 微 软 的 员 工 是 用 面 试 来 释 放 自 己 的 工 作 压 力 的, 因 为 微 软 的 面 试 是 出 了 名 的 整 人

BOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2

2 12

Transcription:

3

3 3.1 3.1.1 ( ) 90

3 1966 B e r n s t e i n P ( i ) R ( i ) W ( i P ( i P ( j ) 1) R( i) W( j)=φ 2) W( i) R( j)=φ 3) W( i) W( j)=φ 3.1.2 ( p r o c e s s ) 91

Wi n d o w s Process Control Bl o c k P C B U N I X (/ p r o c ) 4 (process ID) (user ID) (process group) P C P S W P C B 3.1.3 1. 3-1 1) ( R u n n i n g ) 2) ( R e a d y ) I / O 3) ( B l o c k e d ) I / O 92

3 3-1 ( ) 4) ( N e w ) 5) ( E x i t ) 1) 2) (Admit, ) 3) ( D i s p a t c h ) 4) ( R e l e a s e ) ( E x i t ) ( a b o r t ) I / O 5) Ti m e o u t 6) Event Wa i t I / O 7) Event Occurs 3-2 3-3 93

Wi n d o w s 3-2 ( ) 1 1 1 2 2 2. 94 2 3-3 ( ) 3-4 3-5

3 3-4 3-5 1) ( r e a d y ) 2) ( b l o c k e d ) 3) blocked, suspend 4) r e a d y, suspend 1) s u s p e n d 95

Wi n d o w s 2) a c t i v a t e 3) event occur 4) ( a d m i t ) 3.2 3.2.1 3-1 f o r k s p a w n e x e c 3-1 f o r k 96 s p a w n e x e c

3 C e x i t ( ) 3.2.2 I / O U N I X ( s l e e p ) ( p a u s e ) ( w a i t ) ( k i l l ) 1) sleep s e c o n d s unsigned sleep(unsigned s e c o n d s ) ; 2) pause int pause(void); 3) wait w a i t pid_t wait(int * s t a t _ l o c ); I D 4) kill s i g p i d int kill(pid_t pid, int sig); / u s r / u c b i n c l u d e / s y s / s i g n a l. h k i l l kill -9100 S I G K I L L I D 1 00 Windows NT Windows 2000/XP S u s p e n d T h r e a d R e s u m e T h r e a d suspend count 1 0 1 0 1) Windows NT S u s p e n d T h r e a d DWORD SuspendThread( HANDLE hthread // ); 2) Windows NT R e s u m e T h r e a d DWORD ResumeThread( HANDLE hthread // ); 97

Wi n d o w s 3.2.3 Windows 2000/XP Windows 2000/XP Windows ( h a n d l e ) ( s e r v i c e s ) ( P I D (Access To k e n ) (Base Priority) (Processor Aff i n i t y ) Wi n 32 O S / 2 PO S I X Windows 2000/XP PO S I X PO S I X 3-6 Windows NT Windows 2000/XP Wi n 3 2 Wi n 32 PO S I X O S / 2 Wi n 32 Windows 2000/XP Wi n 32 POSIX POSIX Win32 fork( ) CreateProcess( ) Windows 2000 98 3-6 Windows 2000/XP 3-7 Windows 2000/XP Wi n 32 ( E P R O C E S S ) (Virtual Address space Descriptor, VAD) Windows 2000/XP Wi n 32 C r e a t e P r o c e s s E x i t P r o c e s s Te r m i n a t e P r o c e s s C r e a t e P r o c e s s E x i t P r o c e s s Te r m i n a t e P r o c e s s 1) CreateProcess Wi n 32 D L L 2) ExitProcess Te r m i n a t e P r o c e s s

3 E x i t P r o c e s s Te r m i n a t e P r o c e s s VAD VAD VAD 3-7 Windows 2000/XP Wi n 32 Windows 2000/XP d e b u g g e r t a rg e t DEBUG_ PROCESS D e b u g A c t i v e P r o c e s s D L L Wa i t F o r D e b u g E v e n t C o n t i n u e D e b u g E v e n t Wa i t F o r D e b u g E v e n t C o n t i n u e D e b u g E v e n t R e a d P r o c e s s M e m o r y () WriteProcessMemory() 3.3 3.3.1 99

Wi n d o w s ( T h r e a d ) 3-8 100 3-8 (kernel-level thread) I / O Windows NT Windows 2000/XP ( u s e r-level thread)

3 In f o r m i x Aldus PageMaker / ( L i g h t Weight Process) 3.3.2 3-9 3-9 3.3.3 Windows 2000/XP Windows 2000/XP 101

Wi n d o w s Windows 2000/XP 3-10 102 3-10 Windows 2000/XP 1) ( r e a d y ) 2) ( s t a n d b y ) 3) ( r u n n i n g ) 4) ( w a i t i n g ) 5) ( t r a n s i t i o n ) 6) ( t e r m i n a t e d )

3 7) ( I n i t i a l i z e d ) Windows 2000/XP C r e a t e T h r e a d E x i t T h r e a d S u s p e n d T h r e a d R e s u m e T h r e a d 0 3.4 3.4.1 3-2 (mutual exclusion) ( d e a d l o c k ) ( s t a r v a t i o n ) 3-2 ( ( c o m p e t i t i o n ) ) ( ) ( ) 103

Wi n d o w s 3-11 (entry section) (critical section) (exit section) (remainder section) 1. (1) 1 while (turn! = i); P i P j t u r n turn = j; t u r n t u r n i P i t u r n P i 3-12 1 t u r n P j j 3-12 P i 1 P i P j P i while (flag[j]); <a> (2) 2 flag[i] = TRUE; <b> 1 flag[ ] flag [i] = FALSE; FA L S E 3-13 2 3-13 P i 2 1 104 3-11

P i P j P i <a> P j <a> P i <b> P j < b > P i P j f l a g f l a g (3) 3 flag[i] = TRUE; <b> 2 while (flag[j]); <a> flag[i] = FALSE; 3 2 f l a g [ i ] 3-14 3 P i i 3-14 P i 3 P i P j P i <b> P j <b> P i <a> P j < a > f l a g f l a g (4) 4 4 1 3 f l a g [ i ] P i t u r n t u r n f l a g t u r n t u r n flag[i] = TRUE; turn = j; while (flag[j] && turn == j); 3-15 P i 4 flag[i] = FALSE; 3-15 4 2. T S S w a p (1) TS (Te s t - a n d - S e t ) 3 T S T R U E T 105

Wi n d o w s boolean TS(boolean *lock) { } boolean old; old = *lock; return old; 106 *lock = TRUE; T S l o c k T R U E FA L S E FA L S E T S l o c k 3-16 while TS (&lock); (2) Swap E x c h a n g e S w a p lock = FALSE; S w a p void SWAP(int *a, int *b) { int temp; 3-16 T S } temp = *a; *a = *b; *b = temp; do S w a p { l o c k FA L S E SWAP (&lock, &key); k e y l o c k S w a p } while (key); l o c k k e y k e y 3-17 lock = FALSE; 3-17 S w a p 3.4.2 ( s e m a p h o r e ) key = TRUE;

3 1. P V D i j k s t r a 1 965 P V t e s t ( p r o b e r e n ) i n c r e m e n t ( v e r h o g e n ) s s. c o u n t s. q u e u e P V P V P w a i t ( s ) w a i t ( s ) { -- s. c o u n t ; // ; if (s.count <0) // ; { s. q u e u e ; ; } } V s i g n a l ( s ) s i g n a l ( s ) { + + s. c o u n t ; / / if (s.count <= 0) } { / / s. q u e u e P ; P ; } 3-18 m u t e x ( M U Tual Exclusion) 1 P (mutex); P ( m u t e x ) V ( m u t e x ) P V V (mutex); P V P V 3-18 3-19 107

Wi n d o w s P 1 P 2 C 1 C 2 C 1 C 2 C 1 P(S 12 ); S 12 0 P 1 V ( S 12 ) P 2 P ( S 12 ) 2. (1) AND A N D A N D A N P Swait (Simultaneous Wa i t ) V Ssignal (Simultaneous Signal) S w a i t S w a i t S s i g n a l S w a i t ( S 1, S 2,..., Sn) { while (TRUE) { e l s e } / / P if (S 1 >=1 && S 2 >= 1 &&... && n S>= 1) } { / / for (i = 1; i <= n; ++i) i; --S // w a i t 1 } b r e a k ; { / / 1 Sj. q u e u e ; ; } P 1 V(S 12 ); P 2 3-19 C 2 S s i g n a l ( S 1, S 2,..., S n ) / / { for (i = 1; i <= n; ++i) { 108 + + S i ; / / for (each process P waiting in S i. q u e u e )

3 } } { / / S i. q u e u e P ; if ( P S w a i t ) // s i g n a l { // P ; } e l s e } { / / P } (2) n n w a i t n A N D S i t i >= t i t i d i S i S i = S i d i P V S w a i t ( S 1, t 1, d 1 ;...; S n, t n, d n ) ; S s i g n a l ( S 1, d 1 ;...; S n, d n ) ; 1) Swait(S, d, d) d d 2) Swait(S, 1, 1) 3) Swait(S, 1, 0) S 1 S = 0 S w a i t S s i g n a l 3.4.3 P V 109

Wi n d o w s 1. ( p r o d u c e r-consumer problem) ( ) ( ) n 3-20 1 2... M 1 2... N 3-20 n f u l l e m p t y m u t e x f u l l 0 e m p t y n m u t e x 1 f u l l e m p t y f u l l + empty == n 3-21 3-21 P A N D S w a i t ( e m p t y, mutex) Ssignal(full, mutex) 2. (readers-writers problem) 110

3 W m u t e x R m u t e x R c o u n t W m u t e x 1 R c o u n t 0 R m u t e x R c o u n t 1 3-22 3-22 R W m u t e x R c o u n t W m u t e x 1 R c o u n t R 3-23 3-23 3.4.4 111

Wi n d o w s P V H o a r e H a n s o n 1 973 ( m o n i t o r ) 3.4.5 Windows 2000/XP Windows 2000/XP 112

3 ( M u t e x ) A P I C r e a t e M u t e x O p e n M u t e x R e l e a s e M u t e x C r e a t e M u t e x O p e n M u t e x R e l e a s e M u t e ( S e m a p h o r e ) 0 A P I C r e a t e S e m a p h o r e O p e n S e m a p h o r e R e l e a s e S e m a p h o r e C r e a t e S e m a p h o r e O p e n S e m a p h o r e R e l e a s e S e m a p h o r ( E v e n t ) A P I C r e a t e E v e n t O p e n E v e n t S e t E v e n t R e s e t E v e n t P u l s e E v e n t C r e a t e E v e n t O p e n E v e n t S e t E v e n P u l s e E v e n t R e s e t E v e n t Windows 2000/XP Wa i t F o r S i n g l e O b j e c t Wa i t F o r M u l t i p l e O b j e c t s Wa i t F o r S i n g l e O b j e c t Wa i t F o r M u l t i p l e O b j e c t s A P I DWORD WaitForSingleObject( HANDLE hhandle, // DWORD dwmilliseconds ); DWORD WaitForMultipleObjects( DWORD ncount, / / CONST HANDLE *lphandles, // // BOOL bwaitall, // T R U E F A L S E DWORD dwmilliseconds // ) ; Windows 2000/XP A P I (Critical Section) C R I T I C A L _ S E C T I O N A P I I n i t i a l i z e C r i t i c a l S e c t i o n E n t e r C r i t i c a l S e c t i o n Tr y E n t e r C r i t i c a l S e c t i o n L e a v e C r i t i c a l S e c t i o n D e l e t e C r i t i c a l S e c t i o n I n i t i a l i z e C r i t i c a l S e c t i o n E n t e r C r i t i c a l S e c t i o n Tr y E n t e r C r i t i c a l S e c t i o n 0 L e a v e C r i t i c a l S e c t i o D e l e t e C r i t i c a l S e c t i o n 113

Wi n d o w s A P I A P I I n t e r l o c k e d E x c h a n g e I n t e r l o c k e d C o m p a r e E x c h a n g e I n t e r l o c k e d E x c h a n g e A d d I n t e r l o c k e d D e c r e m e n t I n t e r l o c k e d I n c r e m e n t I n t e r l o c k e d E x c h a n g e 3 2 I n t e r l o c k e d C o m p a r e E x c h a n g e I n t e r l o c k e d E x c h a n g e A d d I n t e r l o c k e d D e c r e m e n t 1 I n t e r l o c k e d I n c r e m e n t 1 3.5 ( I n t e r-process Communication, IPC) / / 3.5.1 Windows 2000/XP ( s i g n a l ) Windows 2000/XP 1. SetConsoleCtrlHandler G e n e r a t e C o n s o l e C t r l E v e n t S e t C o n s o l e C t r l H a n d l e r ( H a n d l e r R o u t i n e ) C T R L + C S e t C o n s o l e C t r l 114

3 H a n d l e r C T R L + C G e n e r a t e C o n s o l e C t r l E v e n t 3-3 5 3-3 C T R L _ C _ E V E N T C T R L _ B R E A K _ E V E N T C T R L _ C L O S E _ E V E N T C T R L _ L O G O F F _ E V E N T C T R L _ S H U T D O W N _ E V E N T C T R L + C C T R L + B R E A K 2. signal r a i s e s i g n a l r a i s e 3-4 6 6 U N I X 5 Windows 2000/XP 3-4 S I G A B RT S I G F P E S I G I L L S I G I N T S I G S E G V S I G T E R M C T R L + C ( Wi n 32 ) 3.5.2 Windows 2000/XP (shared memory) Windows 2000/XP (file mapping) C r e a t e F i l e M a p p i n g O p e n F i l e M a p p i n g M a p Vi e w O f F i l e F l u s h Vi e w O f F i l e U n m a p Vi e w O f F i l e C l o s e H a n d l e 115

Wi n d o w s 3.5.3 Windows 2000/XP ( p i p e ) K B Windows 2000/XP Windows U N I X U N I C r e a t e P i p e R e a d F i l e Wr i t e F i l e C r e a t e P i p e BOOL CreatePipe( PHANDLE hreadpipe, // PHANDLE hwritepipe, // LPSECURITY_ATTRIBUTES lppipeattributes, // DWORD nsize ); 116 // Windows 2000/XP ( ) \\.\ p i p e \ P i p e N a m e \\ s e r v e r N a m e \ p i p e \ p i p e n a m e C r e a t e N a m e d P i p e C o n n e c t N a m e d P i p C a l l N a m e d P i p e R e a d F i l e Wr i t e F i l e R e a d F i l e E x Wr i t e F i l e E x 3.5.4 Windows 2000/XP Windows 2000/XP ( m a i l s l o t ) \\.\ m a i l s l o t \[ p a t h ] n a m e \\ r a n g e \ m a i l s l o t \[ p a t h ] n a m e r a n g e C r e a t e M a i l s l o t G e t M a i l s l o t I n f o S e t M a i l s l o t I n f o R e a d F i l e C r e a t e F i l Wr i t e F i l e

3 3.5.5 ( s o c k e t ) / T C P / I P U N I X B S D T C P / I P s e n d s e n d t o r e c v r e c v f r o m Windows 2000/XP Wi n s o c k " B S D Wi n S o c k 2. 2 s e n d s e n d t o r e c v r e c v f r o m W S A S e n d W S A S e n d t o W S A R e c v W S A R e c v f r o m 3.6 ( d e a d l o c k ) 3.6.1 (reusable resource) I / O A B 3-24 P1<a> P2<a> P1<b> P2<b> 3-24 (consumable resource) 117

Wi n d o w s 3-25 P1<a> P2<a> 3-25 1) 2) 3) 4) 3-5 3-5 ( P r e v e n t i o n ) < 2 > < 3 > < 4 > ( Av o i d a n c e ) ( D e t e c t i o n ) 3.6.2 118

3 119 2 4 3.6.3 (resource allocation graph) G R P R P P R P R 3.6.4

Wi n d o w s 3.6.5 3.7 3.7.1 3-26 3.7.2 T 120

3 3-26 2 4 2 / I / O 3.7.3 121

Wi n d o w s ( d i s p a t c h e r ) A A B B 3.8 3.8.1 (First Come First Service, FCFS) F C F S I / O F C F S F C F S I / O 3.8.2 (Shortest Job First, SJF) (Shortest Process Next, SPN) F C F S S J F S J F F C F S S J F S J F ( S h o r t e s t Remaining Time, SRT ) S J F (Highest Response Ratio Next, HRRN) ( + ) / F C F S S J F 122

3 3.8.3 (Round Robin) F C F S m s m F C F S 3.8.4 (Multiple-level Queue) 3.8.5 (Priority Scheduling) 123

Wi n d o w s 3.8.6 (Round Robin with Multiple Feedback) I / O I / O 1 1 F C F S 1 2 F C F S I / O I / O I / O I / O I / O I / O I / O 3.9 Windows 2000/XP Windows 2000/XP Windows 2000/XP Wi n d o w s 2000 / X P Windows 2000/XP Wi n 32 Windows 2000/XP Windows 2000/XP 3.9.1 Windows 2000/XP Windows 2000/XP Wi n 32 124

3 ( q u a n t u m ) Windows 2000/XP Windows Windows 2000 Windows 2000 Windows 2000/XP Windows 2000/XP ( k e r n e l s dispatcher) D P C / 1) 2) 3) Windows 2000/XP 4) Windows 2000/XP Wi n d o w s 2 0 0 0 / X P Windows 2000/XP A 1 0 B 2 1 1 / 12 Windows 2000/XP A B Windows 2000/XP 3.9.2 Wi n 3 2 3-6 Win32 API Win32 3-6 A P I S u s p e n d / R e s u m e T h r e a d G e t / S e t P r i o r i t y C l a s s G e t / S e t T h r e a d P r i o r i t y ( ) 125

Wi n d o w s A P I G e t / S e t P r o c e s s A ff i n i t y M a s k S e t T h r e a d A ff i n i t y M a s k G e t / S e t T h r e a d P r i o r i t y B o o s t S e t T h r e a d I d e a l P r o c e s s o r G e t / S e t P r o c e s s P r i o r i t y B o o s t S w i t c h To T h r e a d S l e e p S l e e p E x ( ) Windows 2000/XP ( ) 0 I / O A P C 3.9.3 3-27 Windows 2000/XP 32 0 3 1 1) 16 16 3 1 2) 15 1 1 5 3) 0 Wi n 3 2 Windows 2000/XP Wi n 32 3-27 Wi n 32 3-28 Wi n 32 Windows 2000/XP 3-28 Task Manager Wi n 32 S e t P r i o r i t y C l a s s 2 4 1 3 1 0 8 6 4Windows 2000/XP 126

8 8 Windows 2000/XP Wi n 32 31 3 24 16 31 16 15 13 1 15 10 8 6 4 1 0 3-28 Wi n 3 2 Windows 2000/XP 1 1 5 Windows 2000/XP 16 3 1 1. Win32 Windows 2000/XP ( ) 127

Wi n d o w s Windows 2000/XP Windows 2000/XP 31 2. 30 3-29 29 0 1 28 0 27 1 26 n 3 1 2 DPC/dispatch 1 APC 0 31 D P C / 0 3-29 ( K i D i s p a t c h e r L o c k ) 3.9.4 Windows 2000/XP Windows 2000/XP (quantum unit) 1. Windows 2000 6 Windows 2000/XP 36 Wi n d o w s 2 0 0 0 / X P ( 3 ) Windows 2000 3 2 Windows 2000/XP 12 D P C / ( D P C ) 128

3 x 86 10 x 86 15 Wi n 32 G e t S y s t e m Ti m e A d j u s t m e n t w w w. s y s i n t e r n a l s. c o m C l o c k r e s I / O I / O ( I n t e r r u p t s / s e c ) x 86 100 1 / 100 = 0. 01 10 x 86 67 1 / = 0. 015 15 3 14 ( Wa i t F o r S i n g l e O b j e c t Wa i t F o r M u l t i p l e O b j e c t s ) 1 14 2. H K L M \ S Y S T E M \ C u r r e n t C o n t r o l S e t \ C o n t r o l \ P r i o r i t y C o n t r o l \ Wi n 32 P r i o r i t y S e p a r a t i o n ( ) 3-30 6 3 2 3-30 Wi n 32 P r i o r i t y S e p a r a t i o n (Short vs. Long) 1 2 0 3 ( Windows 2000 Windows 2000 ) ( Variable vs. Fixed) 1 2 0 3 ( Windows 2000 Windows 2000 ) 129

Wi n d o w s (Foreground Quantum Boost) 0 1 2 ( 3 2 ) P s P r i o r i t y S e p a r a t i o n Wi n 32 Wi n P r i o r i t y S e p a r a t i o n 3 P s p F o r e g r o u n d Q u a n t u m Wi n 32 P r i o r i t y S e p a r a t i o n 2 3-7 P s p F o r e g r o u n d Q u a n t u m 3-7 6 1 2 1 8 1 2 2 4 3 6 18 18 18 36 36 36 Windows 2000/XP ( ) start /abovenormal start /high Wi n 32 P r i o r i t y S e p a r a t i o n 3 (Performance Options) 2 Windows 2000 Windows 2000 Windows Windows 2000 ( Terminal Services) 3.9.5 3-31 130

3 ( K i D i s p a t c h e r R e a d y L i s t H e a d ) 31 0 31 0 31 0 3-31 Windows 2000/XP ( K i R e a d y S u m m a r y ) 3 2 B 0 0 B 1 1 Windows 2000/XP ( K i I d l e S u m m a r y ) 3 2 D P C / ( K i D i s p a t c h e r L o c k ) 3-8 3-8 K i D i s p a t c h e r L o c k K e N u m b e r P r o c e s s o r s K e A c t i v e P r o c e s s o r s 3 2 K i I d l e S u m m a r y 3 2 K i R e a d y S u m m a r y 3 2 K i D i s p a t c h e r R e a d y L i s t H e a d 3 23 2 3 131

Wi n d o w s 3.9.6 Windows 2000/XP Windows 2000/XP 1. Wi n 32 ( Wa i t F o r S i n g l e O b j e c t Wa i t F o r M u l t i p l e O b j e c t s ) I / O ( ) 3-32 Windows 2000/XP 20 19 18 17 16 3-32 3-32 ( ) 3-32 1 1 / 3 14 2. 132 15 14

3 1) 2) Windows 2000/XP 3-33 18 17 16 15 14 13 3-33 3-33 18 16 3. Windows 2000/XP Windows 2000/XP 133

Wi n d o w s 134 Windows 2000/XP ( ) 3-34 4. 3-34 E x i t T h r e a d Te r m i n a t e T h r e a 3.9.7 5 Windows 2000/XP 1) I/O 15 2) 3) 4) 5) ( ) Windows 2000/XP ( 16 3 1 ) Windows 2000/XP 14 13 12 11 1. I/O I / O Windows 2000/XP I / O I / O

I / O 1 D D K I / O W d m. h N t d d k. h #define IO 3-9 I / O I o C o m p l e t e R e q u e s t 3-9 I / O 3-9 3 1 2 6 8 3-35 I / O 3-35 ( 0 1 5 ) 15 14 5 1 15 15 2. S e t E v e n t P u l s e E v e n t R e l e a s e S e m a p h o r e 135

Wi n d o w s D D K E V E N T _ I N C R E M E N T S E M A P H O R E _ I N C R E M E N T I / O I / O 15 1 3. K i U n w a i t T h r e a d ( ) P s P r i o r i t y S e p a r a t i o n P s P r i o r i t y S e p a r a t i o n Windows 2000 Windows 2000 Wi n 3 2 S e t T h r e a d P r i o r i t y B o o s t 4. ( ) 2 ( Wi n 32 k. s y s ) K e S e t E v e n t K e S e t E v e n 5. 7 4 11 4 4 11 Windows 2000/XP (balance set manager) 300 300 3 4 15 3 0 0 136

3 16 10 10 ( ) 3.9.8 Wi n d o w s 2000 / X P Wi n d o w s 2 0 0 0 / X P 1. ( ) S e t P r o c e s s A ff i n i t y M a s k S e t T h r e a d A ff i n i t y M a s k 2. 1) 2) Windows 2000/XP S e t T h r e a d I d e a l P r o c e s s o r 3. Windows 2000/XP ( ) Windows 2000/XP Windows 2000/XP Windows 2000/XP 137

Wi n d o w s ( ) Windows 2000/XP Windows 2000/XP 4. ( ) Windows 2000/XP Windows 2000/XP Windows 2000/XP 1) 2) 3) 2 4) 24 Wi n d o w s 2 0 0 0 / X P 5. Windows 2000/XP Windows 2000/XP 0 8 1 4 0 6 0 138

3 8 Windows 2000/XP 6 0 8 0 1 0 8 1 4 3.9.9 Windows 2000/XP Windows 2000/XP 0 1) 2) D P C D P 3) 4) Windows 2000/XP 3.1 3.2 3.3 3.4 3.5 3.6 1000 Windows 2000 3.7 1000 Windows 2000 3.8 3.9 3.10 2 10 5 C t r l - C 5 C t r l - C 3. 11 A k k B n A ( 1 2 k ) k B n 3.12 T T T 1 256 139

Wi n d o w s 3.13 Windows 2000 3.14 Windows 2000 3.15 3.16 Windows 2000 3.17 Windows 2000 3.18 Windows 2000 I / O 3.19 Windows 2000 3.20 Windows 2000 1. David A. Solomon, Mark E. Russinovich. Inside Microsoft Windows 2000. 3rd Edition. Microsoft Press, 2000 2. Gary Nutt. Operating System Project Using Windows NT. Addison-We s l e y 3. The July 2000 release of the MSDN Library 4. William Stallings. Operating Systems.3rd edition., 1998 5... 1993 6. Uresh Vahalia. UNIX. 1999 140