windows 2000 michael blinn ben hejl jane mchugh matthew vanmater

35
Windows 2000 Michael Blinn Ben Hejl Jane McHugh Matthew VanMater

Upload: hugh-baldwin

Post on 13-Dec-2015

234 views

Category:

Documents


0 download

TRANSCRIPT

Windows 2000

Michael BlinnBen Hejl

Jane McHughMatthew VanMater

Overview • Environment

– Designed to provide a true 32-bit, preemptive, reentrant, virtual memory OS

– Run on multiple hardware architectures and platforms– Run and scale well on SMP systems– Network client and server– Run most existing 16-bit MD-DOS and Microsoft

Windows 3.1 applications– Supports Unicode– Portable through the use of Hardware Abstraction

Layer (HAL)

Overview Continued

• Uses some state-of-the-art concepts.– Object Oriented design – Hybrid Microkernel

• As of February 2001, over one million licenses for the Server have been sold.

Overview Continued

• Strengths– Hybrid Microkernel – APIs

• Allow compatibility

• Weaknesses– Weak remote administration facilities

Scheduling

• Priorities– Levels

• 32 priority levels, ranging from 0 to 31.• Each process has one priority level, threads have

two

– Queues and Data Structures• Series of queues- one for each scheduling priority• Queues contain threads that are in the ready state• Ready summary bitmask• Idle summary bitmask

Scheduling Continued– Queues and Data Structures Continued

• Wait queues handled differently

– Current priority threads can be boosted• Upon completion of an I/O operation• After waiting on executive events or semaphores• After threads in the foreground process complete a

wait operation• When GUI threads wake up • When a thread that is ready to run has been waiting

for some time

Scheduling Continued

– I/O requests to devices that warrant better responsiveness have higher boost values.

– After the boost is applied, the thread is ran for one quantum at the elevated priority level, after which it decays one priority level, and so on.

• CPU Starvation– Win2K maintains a system thread called the

balance set manager.

Scheduling Continued

• Real Time– 15 priority levels in Windows 2000– Levels normally reserved for kernel-mode

system threads.– Win2K does not provide real-time operating

system facilities.

Scheduling Continued

• Priority Scheduling Differences in a Multi-Processor Environment

– Steps after a thread is selected for execution1. Schedule the thread on an idle processor in order

of ideal, last, and current CPU.

2. Schedule the thread on any idle processor.

3. Preempt a thread currently running on a processor in order of ideal, last, and current CPU.

Scheduling Continued

• Thread States– Ready- thread waiting to execute

– Standby- thread selected to run next

– Running- executing thread

– Waiting- thread waiting on an event to occur

– Transition- thread ready but paged out of memory

– Terminated- thread that finishes execution

– Initialized- used when a thread is being created

Scheduling Continued

• Thread Transitions– Voluntary Switch– Preemption– Quantum end– Termination

Scheduling Continued

• The Zero Page Thread– Enables and disables interrupts– Checks for any DPCs pending on any processor

and delivers them if necessary– Checks whether a thread has been selected to

run next on the CPU and, if so, dispatches it– Performs checks for power management

functions

Scheduling Continued

• In Win2K, a thread’s context and the procedure for context switching vary depending on the processor’s architecture.

• Saving and reloading of this data is made possible by using a kernel-mode stack.

Scheduling Continued

• Typically, a context switch involves saving and reloading the following data:– Program counter– Processor status register– Other register contents– User and kernel stack pointers– Pointer to the thread’s address space in which it

runs

Memory Management

• Memory manager provides a variety of services to the OS including:– Virtual memory management– Shared memory and mapped files– Locking memory– Protecting memory

Memory Management Continued

• Virtual Memory Management– Each user process has a separate 32-bit address

space, allowing 4 gigabytes of memory per process.

– Yet, 2 gigabytes of this address space is reserved for the OS so the available virtual address space is actually 2 gigabytes.

Memory Management Continued

• Virtual Memory Management Continued– Pages in a process address are free, reserved, or

committed.• Free- not currently being used

• Reserved- thread reserves a range of virtual addresses that may be needed in the future

• Committed- eventually become valid pages in physical memory, once accessed

Memory Management Continued

• Shared Memory and Mapped Files– Each process maintains its private memory

area, yet the program instructions and unmodified data can be shared without harm.

– Implementing shared memory involves the use of shared objects.

• Shared objects- represent a block of memory that 2 or more processes can share and can be mapped to the paging file or to another file on disk

Memory Management Continued

• Locking Memory– Two ways that pages can be locked in memory:

• Once pages are locked, they remain in memory until unlocked

• Can be locked through the function, VirtualLock

– VirtualLock can be called by an application to lock pages in their process working set.

Memory Management Continued

• Protecting Memory– Prevents user processes from accessing the

address space of another process or the OS itself.

1. Any structures, etc. used by kernel-mode system components are accessible only in kernel mode (not user mode).

2. Each process has a private address space

Memory Management Continued

3. All processes are supported by some form of hardware-controlled memory protection.

4. Shared memory section objects have standard access-control lists (ACLs) that are checked when processes attempt to open them.

This limits shared memory access to only processes with proper rights.

Memory Management Continued

• Page Directories– Each process has a single page directory that

the memory manager creates to map the location of all page tables for that process.

– The physical address of the process page directory is stored in the kernel process block and is also mapped virtually.

– Executable code running in kernel mode uses references to virtual, not physical, addresses.

Memory Management Continued

• Page Directories Continued– The OS constructs a page table, containing the

mapping information needed to find the desired page.

– In Windows 2000, each process has its own set of process page tables to map that private address space. This is because Win2K provides a private address space for each process.

File Management

• Main objectives a file management system:– Meets the data management needs and requirements of

the user.– Guarantees valid data in the files.– Optimizes performance from the viewpoint of the system

and the user.– Provides I/O support for many storage device types. – Helps to eliminates losing or destroying data.– Provides a uniform set of I/O interface routines.– Provides necessary I/O support in times of multiple-user

systems.

File Management Continued

• The only way that a user or application is able to access a file is through the file management system.

• Win2K includes support for these file system formats:– CDFS, UDF, FAT12, FAT16, FAT32, NTFS

File Management Continued

• NTFS– Meets high-end requirements for workstations

and servers.• Client/server applications, resource intensive

engineering, network applications

– Uses 64-bit cluster indexes, yet Win2K limits the size of an NTFS volume to 32-bit clusters.

File Management Continued

– Notable features of NTFS:• Recoverability, file and directory security, disk

quotas, file compression, directory-based symbolic links, and encryption

• Many of these support the main objectives for a file management system.

– Organizes information into 4 regions on a disk volume:

• Partition boot sector, Master file table, System files, File area

Threads

• Supports user-level and kernel-level threads– Kernel-level threads

• User mode kernel-level threads– Created and runs in user mode

– Can be preempted by the scheduler

• System worker threads– Created by threads and only exist to do work for other

threads

– Specific types are: delayed worker threads, critical worker threads, and hypercritical worker threads

Threads

– Kernel-level threads continued• Kernel mode system threads

– Have all the attributes of a user mode thread, but can only be run in kernel mode.

– Objects running in kernel mode can only create this type of thread.

– Has no process address space and must allocate all its storage needs dynamically from the heap- this is different than a user mode system thread.

Threads

– User-level threads• Created as a normal thread, and then converted to a

fiber.

• The scheduler does not preemptively schedule different fibers (threads). Instead, a fiber must be switched to from another fiber.

• The system can preempt the thread controlling the fiber suspending the execution of the fiber.

Mutual Exclusion and Synchronization

• Works differently inside and outside of the kernel of Windows 2000.

• Within the kernel, much of the mutual exclusion is done using spinlocks.

• Outside the kernel, the objects providing mutual exclusion and synchronization rely on services provided by the kernel.

Kernel Synchronization

• Synchronization in the kernel of Windows 2000 guarantees that only one processor can be executing in a critical section.– Enforced by disabling certain interrupts.– Spinlocks used to protect the core data

structures of the kernel.

Kernel Synchronization Continued

• Mutual exclusion and synchronization within the kernel– Dealt with by modifying how interrupts are

handled.– Uses spinlocks

• Spinlock- Provides a global data structure in the kernel. Before entering a critical section, the kernel must acquire the spinlock associated with the critical section

Kernel Synchronization Continued

• Mutual exclusion and synchronization outside the kernel– Executive objects use dispatcher objects (ex-

mutexes, semaphores, events, waitable timers)– A thread will issue a wait on one of these

objects if it wants to use it.– While waiting, the thread is placed into a

suspended state until the dispatcher object enters a signaled state.

Summary

• Preemptive, multitasking, multiprocessing, multiuser

• Scheduling / data management slightly different

• Object-driven architecture

• Hybrid kernel

• Multiple-architecture realized through HAL