1
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze
Unit OS B: Comparing the Linux and Windows Kernels
3
Roadmap for Section B A Brief History of Windows and Linux - - PDF document
Unit OS B: Comparing the Linux and Windows Kernels Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Roadmap for Section B A Brief History of Windows and Linux Comparing the Windows and Linux
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze
3
4
5
6
7
8
9
10
1970 1980 1990 2000
UNIX born UNIX public UNIX V6 Linux v1.0 v2.0 v2.1 v2.2 v2.3 v2.4 v2.6
1970 1980 1990 2000
VMS v1.0 Windows NT 3.1 NT 4.0 Windows 2000 Windows XP Server 2003 11
Linux: vmlinuz Windows: ntoskrnl.exe
12
Device Drivers Process Management, Memory Management, I/O Management, etc. X-Windows Application System Services User Mode Kernel Mode Hardware Dependent Code
Linux
Device Drivers Process Management, Memory Management, I/O Management, etc. Win32 Windowing Application System Services User Mode Kernel Mode Hardware Dependent Code
Windows
13
14
15
16
17
18
Address space, handle table, statistics and at least
No inherent parent/child relationship
Basic scheduling unit Fibers - cooperative user- mode threads
Basic Address space, handle table, statistics Parent/child relationship Basic scheduling unit
No threads per-se Tasks can act like Windows threads by sharing handle table, PID and address space PThreads – cooperative user-mode threads
19
31 15 16 Fixed Dynamic I/O
20
Normal – priority 100-139 Fixed Round Robin – priority 0-99 Fixed FIFO – priority 0-99
Priorities of normal threads go up (decay) as they use CPU Priorities of interactive threads go down (boost)
21
31 15 16 Fixed Dynamic I/O
140 100 99 Fixed FIFO Fixed Round-Robin Normal CPU I/O
22
23
Selected with the sched-setscheduler( ) system call Use static priority values in the range of 1 to 99 Executed strictly in order of decreasing static priority
Thread needs to indicate completion by calling the sched-yield( )
Then switches to the next thread with the same static priority
Root privileges or the CAP-SYS-NICE capability are required for the selection of a real-time scheduling policy
Same as in Windows; but cmp. rtLinux
24
25
26
Fixed: 120ms 20ms Foreground: 60ms Background
100ms 200ms 10ms
27
Windows
Supports symmetric multiprocessing (SMP)
Up to 32 processors on 32-bit Windows Up to 64 processors on 64-bit Windows All CPUs can take interrupts
Supports Non-Uniform Memory Access systems
Scheduler favors the node a thread prefers to run on Memory manager tries to allocate memory on the node a thread prefers to run on
Supports Hyperthreading
Scheduler favors idle physical processors when it has a choice Doesn’t count logical CPUs against licensing limits
Physical CPU 0 Physical CPU 1 1 3 4 Ready Thread
28
Windows
Supports symmetric multiprocessing (SMP)
Up to 32 processors on 32-bit Windows Up to 64 processors on 64-bit Windows All CPUs can take interrupts
Supports Non-Uniform Memory Access systems
Scheduler favors the node a thread prefers to run on Memory manager tries to allocate memory on the node a thread prefers to run on
Supports Hyperthreading
Scheduler favors idle physical processors when it has a choice Doesn’t count logical CPUs against licensing limits
Linux Supports SMP
No upper CPU limit: set as kernel build constant All CPUs can take interrupts
Supports Non-Uniform Memory Access systems
Scheduler favors the node a thread last ran on Memory manager tries to allocate memory on the node a thread is running on
Supports Hyperthreading Scheduler favors idle physical processors when it has a choice
29
Windows 32-bit versions split user- mode/kernel-mode from 2GB/2GB to 3GB/1GB Demand-paged virtual memory
32 or 64-bits Copy-on-write Shared memory Memory mapped files
User System 2GB 4GB
Linux Splits user-mode/kernel-mode from 1GB/3GB to 3GB/1GB
2.6 has “4/4 split” option where kernel has its own address space
Demand-paged virtual memory
32-bits and/or 64-bits Copy-on-write Shared memory Memory mapped files
User System 3GB 4GB
30
Working set tuner adjust sets according to memory needs using the “clock” algorithm
Process LRU Reused Page
LRU Reused Page Other Process LRU
31
Centered around the file object Layered driver architecture throughout driver types Most I/O supports asynchronous
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
Only sockets and direct disk I/O support asynchronous I/O
IRQL Masked
32
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
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
33
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
Supports auditing
Two models:
Standard UNIX model Access Control Lists (SELinux)
Users are defined with:
Capabilities (privileges) Member groups
Security is implemented on an
Has no built-in auditing support Version 2.6 includes Linux Security Module framework for add-on security models
34
Linux supports a number of special filesystems
Like special files, they are of a more dynamic nature and tend to have side effects when accessed
Prime example is procfs (mounted at /proc)
provides access to and control over various aspects of Linux (I.e.; scheduling and memory management)
/proc/meminfo contains detailed statistics on the current memory usage of Linux Content changes as memory usage changes over time
Services for Unix implements procfs on Windows
35
36
37
38
cpu 1 cpu 2 cpu 1 cpu 2 Non-reentrant Reentrant Time Saved
39
40
1 Buffer Cache 0 Buffer Cache 1 CPUs
41
103 112 112 101 Ready List Highest Priority Task
42
Calculates a task’s priority at the time it makes scheduling decision Has per-CPU ready queues where the tasks are pre-sorted by priority 112 112 101 103 Highest-priority Non-empty Queue
43
Not seen as an issue in performance testing by Microsoft Applications where it might be an issue are expected to use affinity
44
I pointed out that the initial implementation incurred a copy operation, even if the file data was cached
File Data Buffer Network Adapter Buffer Network File Data Buffer Network Driver Network Network Driver
45
46
Also added alternate epoll model
47
48
49
50