Presentation on theme: "Case study 1 Windows 7."— Presentation transcript:
1 Case study 1Windows 7
2 Sources and extra reading
Silberschatz, Galvin, Gagne. Operating System Concepts Essentials. 8th Edition. ISBN: A. Tanenbaum. Modern Operating Systems. 3rd Edition. ISBN:
3 Topics covered in this session
History of Windows 7Windows 7 Design principlesThreads and Scheduling.Process ManagerVirtual Memory ManagerWindows 7 file system.OS Security featuresProgrammer Interface for Windows 7 (Win32 API).Windows RegistryExercises
4 History of Windows 7Windows 3.0 used the Win16 API which became increasingly popular.XP brought support for 64-bit versionsVista released in 2006, not very popular.Windows 7 released in 2009Windows 8 released in late 2012.
5 Windows 7 Design Principles
Key Goals:SecurityReliabilityExtensibilityPortabilityInternational SupportEnergy EfficiencyDynamic device support
6 SecurityUse of Access Control Lists (ACLs) for permissions to files, registry settings and kernel objects.Address space layout randomization (ASLR).Bitlocker (encryption) allows encryption of removable media.Code integrity module to ensure modules in the kernel have valid signatures.
7 ExtensibilityAn operating systems capacity to keep up with advances in computing technology.Modular structure allows additional environmental subsystems to be added without affecting the executivePortability —Windows 7 can be moved from one hardware platform to another with relatively few changesWritten in C and C++Platform-dependent code is isolated in a dynamic link library (DLL) called the “hardware abstraction layer” (HAL)
8 CompatibilityApplications that follow the IEEE (POSIX) standard can be complied to run on Windows without changing the source code. Applications created for previous versions of Windows run using various virtual machine techniques
9 International Support
Supports different locales via the national language support (NLS) API.Supports UNICODE.Facilities for differences in date formats, currency etc.
10 Windows 7 Architecture
11 The Windows Kernel Foundation for the executive and the subsystems
Never paged out of memory; execution is never preemptedFour main responsibilities:thread schedulinginterrupt and exception handlinglow-level processor synchronizationrecovery after a power failureKernel is object-oriented, uses two sets of objectsdispatcher objects control dispatching and synchronization (events, mutexes, semaphores, threads and timers)control objects (asynchronous procedure calls, interrupts, power notify, process and profile objects)
12 The Executive - Threads and Scheduling
Each process has one or more thread.Each thread has it’s own scheduling state:Ready – Thread is waiting to run.Standby – highest priority thread which is waiting to run (next to run).Running – currently executing on the processor (Until pre-empted by a higher priority thread).Waiting – Waiting for dispatcher object to be signalled.Transition – While it waits for resources necessary for execution. (e.g waiting for its kernel stack to be swapped from disk).Terminated – Thread has finished execution.
13 Threads and scheduling continued
Real-time threads are given preferential access to the CPU; but Windows 7 does not guarantee that a real-time thread will start to execute within any particular time limit.This is known as soft real-time.The process manager provides services for creating, deleting and using threads and processes.
14 The Executive - Object Manager
Windows Objects == logical view of resourcesWindows 7 uses objects for all its services and entities; the object manager supervises the use of all the objectsObjects are manipulated by a standard set of methods, namely create, open, close, delete, query-name, parse and security.
15 The Executive — Naming Objects
The Windows executive allows any object to be given a name.Object names are structured like file path names in UNIX.Windows implements a symbolic link object, which is similar to symbolic links in UNIX that allow multiple nicknames or aliases to refer to the same object.Each object is protected by an access control list.The executive name space is extensible to allow naming of files, registry keys, and other objects with their own special semantics.
16 The Executive — Virtual Memory Manager
The design of the VM manager assumes that the underlying hardware supports virtual to physical mapping, a paging mechanism, transparent cache coherence on multiprocessor systems, and virtual address aliasing.The VM manager in Windows uses a page-based management scheme with a page size of 4 KB for both x86 and x64.A physical page can be in one of six states: valid, zeroed, free, standby, modified and bad.
17 Virtual-Memory Layout (32-bit)
PageDirectory…4K pagepagetable511page-directory entry 511page-directory entrypage-table entryTop-level Page Directory Table123
18 Virtual-to-Physical Address Translation
PDEPTEpage offset31Translation for a 32-bit Virtual Address to a Physical Address2 bit index into top-level page directory to get page directory9 bit index into page directory to get page directory entry for page table9 bit index into page table to get page table entry for physical page12 bits for byte offset within physical pageSo we have a 3 level hierarchy for Win32For 64 bit, it is a 4 level hierarchy
19 The Executive — I/O Manager
The I/O manager is responsible forfile systemscache managementdevice and network driversWorks with VM Manager to provide memory-mapped file I/O.Interfaces with the Windows cache manager, which handles caching for the entire I/O system.The cache manager memory-maps files into the kernel memoryAlso tries to predict the future reading modelsFlush cache contents for writes: write-back cache, accumulates writes for 4-5 seconds, then writes them
20 Windows 7 File System Uses NTFS (New Technology File System).
Max file size (16TB) – Bigger than most readily available drives.4kb clusters default for drives over 2GB.NTFS uses logical cluster numbers LCN as disk addresses.NTFS makes use of access control lists (ACL).Also supports FAT for portability (e.g Flash Drives).
21 File I/O
22 The Executive — Security Reference Monitor
The object-oriented nature of the Windows kernel enables the use of a uniform mechanism to perform runtime access validation and audit checks for every entity in the system.Whenever a process opens a handle to an object, the security reference monitor checks the process’s security token and the object’s access control list to see whether the process has the necessary rights.
23 The Executive – PnP and Power Managers
PnP (Plug-and-Play) manager is used to recognize and adapt to changes in the hardware configuration.The power manager controls energy use of by the CPU and devices.
24 Windows 7 Architecture (Revisited)
25 Programmer Interface (Win32)
26 Five main aspects of Win32 API
Access to Kernel ObjectsSharing of objects between processesProcess managementInterprocess communicationMemory Management
27 Programmer Interface (Win32) Continued - Job, Process & Thread Management
28 Programmer Interface (Win32) Continued - File System API Calls
Second column gives nearest UNIX equivalent
29 Programmer Interface (Win32) Continued - File System API Calls
Second column gives nearest UNIX equivalent
30 Windows 7 RegistryKernel can make use of registry, as well as third party applications.Registry has been used since Windows 3.1Contains keys and values.Stores information in hives.
Игра закончена. Червь ползет с удвоенной скоростью. У нас осталось всего восемь минут. Мы ищем число, а не произвольный набор букв.