CSE 53437343 Fall 2002 Case Studies Windows CSE

  • Slides: 37
Download presentation
CSE 5343/7343 Fall 2002 Case Studies Windows CSE 5343/7343 UNIX Case Study 1

CSE 5343/7343 Fall 2002 Case Studies Windows CSE 5343/7343 UNIX Case Study 1

Windows Case Study Outline • History – – – • • MS-DOS Windows 3.

Windows Case Study Outline • History – – – • • MS-DOS Windows 3. xx Windows NT Windows 2000 Windows XP Design Philosophy Process Management Memory Management File Systems CSE 5343/7343 UNIX Case Study 2

CAUTION: There are so many variations of Windows. Each version is different. Some are

CAUTION: There are so many variations of Windows. Each version is different. Some are drastically different (even if the GUI is similar. ) CSE 5343/7343 UNIX Case Study 3

MS-DOS History ([1] pp 633 -639) • 1975 – First real PC, Altair, developed

MS-DOS History ([1] pp 633 -639) • 1975 – First real PC, Altair, developed by Micro Instrumentation Telemetry Systems based on Intel 8080 8 -bit microprocessor with 256 bytes of memory. – Bill Gates and Paul Allen of Microsoft develop a version of Basic for Altair. – CP/M was dominant OS. • IBM asked Microsoft to develop a ROM BASIC. IBM chose Intel 8088. Gates suggested IBM use CP/M-86. IBM met with Digital Research and CP/M-86 was running late. Microsoft decided to write its own OS. Microsoft purchased 86 -DOS from Seattle Computer Products. CSE 5343/7343 UNIX Case Study 4

MS-DOS History (cont’d) • 1981 – MS-DOS prototype running in February and appeared in

MS-DOS History (cont’d) • 1981 – MS-DOS prototype running in February and appeared in IBM PC announcement (MS-DOS 1. 0) in August. • • • 4000 lines of assembly code 12 K memory CP/M compatible Device independent I/O – treated as files in Unix Command processor had a resident and transient part CSE 5343/7343 UNIX Case Study 5

MS-DOS History (cont’d) • MS-DOS 2. 0 – March 1983 – – – 20,

MS-DOS History (cont’d) • MS-DOS 2. 0 – March 1983 – – – 20, 000 lines of code IBM PC/XT with 10 M hard disk Hierarchical file system (as in Unix) Device drivers Users wanted multi-tasking, but instead Microsoft added the ability for a print spooler to run concurrently with other tasks in background mode as time permits. When MS-DOS has nothing to do an interrupt is generated to run the print spooler. CSE 5343/7343 UNIX Case Study 6

MS-DOS History (cont’d) • MS-DOS 3. 0 – August 1984 – – – –

MS-DOS History (cont’d) • MS-DOS 3. 0 – August 1984 – – – – 40, 000 lines of code PBM PC/AT with 20 M hard and 1. 2 floppy Intel 80286 16 M address space 24 bit addresses Ring protection mechanism Cooperative multitasking Virtual memory Real address mode – 1 MB address space acts as fast 8086 – Protected mode – All 16 MB CSE 5343/7343 UNIX Case Study 7

Windows History ([3], [4]) • Early Windows – Not true OS just a new

Windows History ([3], [4]) • Early Windows – Not true OS just a new GUI layer with “fixes” to address memory constraints. CSE 5343/7343 UNIX Case Study 8

Windows History (cont’d) • Problems with DOS/Windows 3. 1 – 16 bits; Can’t access

Windows History (cont’d) • Problems with DOS/Windows 3. 1 – 16 bits; Can’t access all of memory. – 1 M barrier for memory – Cooperative multitasking – Nonreentrant – Lost system resources – Win 16 applications overwriting memory of another CSE 5343/7343 UNIX Case Study 9

Windows Question Who invented windows? Who invented the mouse? ANSWER: XEROX PARC CSE 5343/7343

Windows Question Who invented windows? Who invented the mouse? ANSWER: XEROX PARC CSE 5343/7343 UNIX Case Study 10

Windows 95 Design ([3]) • Design Goals: – Less than 4 MB – Backward

Windows 95 Design ([3]) • Design Goals: – Less than 4 MB – Backward compatible (Support Win 16 and DOS) – Increased stability – Fault handler is not part of application. • Three major portions: – User – I/O manager; Windows manager – GDI – GD manager – Kernel – Memory, Files, Task managers • Fig 11. 10 p 354 [3] CSE 5343/7343 UNIX Case Study 11

Windows 95 Design (cont’d) • Registry – Central information including startup and init. •

Windows 95 Design (cont’d) • Registry – Central information including startup and init. • Supports plug and play • Virtual Machine used to run Win 16 applications. • User mode – kernel mode • Long file names CSE 5343/7343 UNIX Case Study 12

OS/2 Design ([5]) • Microsoft/IBM designed to replace DOS on Intel machines • Early

OS/2 Design ([5]) • Microsoft/IBM designed to replace DOS on Intel machines • Early 1990 s Microsoft released Windows 3. 0 which took over the market • IBM viewed Windows as “stepping stone” to OS/2 • Microsoft wanted to have Windows compete with OS/2 • IBM/Microsoft split CSE 5343/7343 UNIX Case Study 13

Windows NT Design([3], [5], [6]) • New Technology RSX – VMS – ELN –

Windows NT Design([3], [5], [6]) • New Technology RSX – VMS – ELN – NT VMS +1 = WNT (HAL + 1 = IBM) All major designs of David Cutler • 1993, versions 3. 1, 3. 51, 4. 0 • Mostly C/C++ • 3. 1 had same GUI as Windows • 32 -bit OS CSE 5343/7343 UNIX Case Study 14

Windows NT Design (cont’d) • • Preemptive multi-tasking Supports multiple processors Used on many

Windows NT Design (cont’d) • • Preemptive multi-tasking Supports multiple processors Used on many architectures Backward compatibility Fully reentrant code Object oriented Table 11. 1 p 356 [3] CSE 5343/7343 UNIX Case Study 15

Windows NT Design (cont’d) • NTFS – NT File System – Permissions for file/directory

Windows NT Design (cont’d) • NTFS – NT File System – Permissions for file/directory and all objects • Security – Domain – Set of machines with similar uses and authorizations • Registry contains information about OS and application configurations: – – – Hardware Installed software Applications and file types Current user Actively loaded user profiles CSE 5343/7343 UNIX Case Study 16

Windows 2000 Design([5], [7]) • • • (AKA) Windows NT 5. 0 Distributed File

Windows 2000 Design([5], [7]) • • • (AKA) Windows NT 5. 0 Distributed File System Multiple monitors Fig 21. 1 p 747 [7] Objects – Event , Mutant, Mutex, Semaphore, Thread, Timer – Interrupt, Asynchronous Procedure Call (APC), Process • Subsystems provide backward compatibility – Like virtual machines CSE 5343/7343 UNIX Case Study 17

Windows XP Design ([7]) • • 32/64 bit Preemptive multitasking October 2001 released Client-server

Windows XP Design ([7]) • • 32/64 bit Preemptive multitasking October 2001 released Client-server architecture for multiple processors CSE 5343/7343 UNIX Case Study 18

Win 32 Subsystem ([6]) • • • Used in most Windows OSs Window manager

Win 32 Subsystem ([6]) • • • Used in most Windows OSs Window manager Process/Thread Create. File Get. Message CSE 5343/7343 UNIX Case Study 19

MS-DOS Processes ([2]) • Single tasking since functions are nonreentrant. • Only real multitasking

MS-DOS Processes ([2]) • Single tasking since functions are nonreentrant. • Only real multitasking is background for printing. Can change time slice for this. • EXEC function used by COMMAND. COM – – – Allocate memory Write program segment prefix Load program into memory Transfer control to program Child may in turn use EXEC CSE 5343/7343 UNIX Case Study 20

Early Windows Processes([2]) • Cooperative multitasking: – Windows program voluntarily yields control at certain

Early Windows Processes([2]) • Cooperative multitasking: – Windows program voluntarily yields control at certain times (Windows 4 and 6. 2) CSE 5343/7343 UNIX Case Study 21

Windows NT Processes ([6]) • • • Executable program (code and data) Private virtual

Windows NT Processes ([6]) • • • Executable program (code and data) Private virtual address space System resources (semaphores, ports, etc) Process ID Threads Process creation steps Fig 4 -6 p 158 [6] CSE 5343/7343 UNIX Case Study 22

Windows NT Threads ([6]) • • • Registers Stacks (kernel, user) Private storage (used

Windows NT Threads ([6]) • • • Registers Stacks (kernel, user) Private storage (used by subsystems) Thread ID (client ID) Mode transition (switch from user mode to kernel mode) does not require a context switch. • Thread Startup – Fig 4 -12 p 183 [6] • Test: – Windows Task Manager/Performance – Control Panel/Administrative Tools/Performance (p 10 [6]) CSE 5343/7343 UNIX Case Study 23

Windows NT Handles ([6]) • Provides ability to access an object at a certain

Windows NT Handles ([6]) • Provides ability to access an object at a certain level of priviledge. • Handle Table entry in EPROCESS block • Standardized interface to objects CSE 5343/7343 UNIX Case Study 24

Windows NT PCB ([6]) • • • Executive (EPROCESS) blocks ETHREAD blocks Process Environment

Windows NT PCB ([6]) • • • Executive (EPROCESS) blocks ETHREAD blocks Process Environment Block (PEB) Thread Environment Block (TEB) Fig 4 -1 p 142 [6] Fig 4 -2 p 143 [6] CSE 5343/7343 UNIX Case Study 25

Windows NT Fibers ([6]) • • • NT 3. 51 Subsets of threads “Lightweight”

Windows NT Fibers ([6]) • • • NT 3. 51 Subsets of threads “Lightweight” threads User level threads Scheduled to run by programmers not OS CSE 5343/7343 UNIX Case Study 26

Windows NT Process States ([6]) • • • Ready Standby – Next to run

Windows NT Process States ([6]) • • • Ready Standby – Next to run Running Waiting Transition – Ready to run but kernel stack paged out • Terminated • Fig 4 -15 p 194 [6] CSE 5343/7343 UNIX Case Study 27

Windows NT Quantums ([6]) • Default: – 6 on Windows NT Workstation – 36

Windows NT Quantums ([6]) • Default: – 6 on Windows NT Workstation – 36 on Windows NT Server – Units are not time values, but relative • At clock interrupt, 3 is deducted from quantum if it is 0 then another thread may run. • Fig 4 -18 [6] CSE 5343/7343 UNIX Case Study 28

Windows NT Thread Scheduling ([6]) • • • Preemptive priority Multilevel queues – RR

Windows NT Thread Scheduling ([6]) • • • Preemptive priority Multilevel queues – RR within queue Scheduling independent of process Threads have processor affinity If thread is preempted, it is put at the front of the ready queue for that priority. When scheduled it receives the rest of its quantum. CSE 5343/7343 UNIX Case Study 29

Windows NT Priorities ([6]) • 32 priority levels – 16 -31 real time –

Windows NT Priorities ([6]) • 32 priority levels – 16 -31 real time – 1 -15 variable levels – 0 system level • Priority classes – Real time, High, Normal, Idle • Threads (Type with Class) – Time critical, Highest, Above normal, Normal, Below normal, Lowest, Idle • Fig 4 -15 p 188 [6] CSE 5343/7343 UNIX Case Study 30

Windows NT Priorities ([6]) • Default base priority level within class • Thread has

Windows NT Priorities ([6]) • Default base priority level within class • Thread has base and current priority • Priorities raised (1 -15 range never above) – – – After wait state Entering wait state Threads not getting CPU time Table 4 -21 p 207 [6] Priority goes down after each quantum until base is reached CSE 5343/7343 UNIX Case Study 31

IPC([3], [4], [7]) • Windows 95 – Thunking: • Allows 16 bit modules to

IPC([3], [4], [7]) • Windows 95 – Thunking: • Allows 16 bit modules to communicate with 32 bit • Routine that maps addresses • Fig 11. 1 p 336 [3] CSE 5343/7343 UNIX Case Study 32

IPC (cont’d) • Messages – Fig 11. 8, 11. 9 p 353 [3] –

IPC (cont’d) • Messages – Fig 11. 8, 11. 9 p 353 [3] – Queue per thread • Semaphores – Win 16 mutex – Used to prevent to Win 16 applications from executing the same code – Ignored by Win 32 applications – Limits multitasking CSE 5343/7343 UNIX Case Study 33

IPC (cont’d) • Clipboard – Actually shared memory • OLE (Object Linking and Embedding)

IPC (cont’d) • Clipboard – Actually shared memory • OLE (Object Linking and Embedding) – – – Windows 95 Drag & Drop Enhancement to DDE Embed or link data from one application to another. Link – pointer to data Embed – actually move CSE 5343/7343 UNIX Case Study 34

IPC (cont’d) • DDE (Dynamic Data Exchange) – Windows 3. 1 – Protocol that

IPC (cont’d) • DDE (Dynamic Data Exchange) – Windows 3. 1 – Protocol that allows Windows applications to share data. – P 576 [4] CSE 5343/7343 UNIX Case Study 35

IPC (cont’d) • Deferred Procedure Call (DPC) – – Windows NT/2000 System function will

IPC (cont’d) • Deferred Procedure Call (DPC) – – Windows NT/2000 System function will be (ultimately) executed IRQL (Interrupt Queue Level) Fig 21. 2 p 750 [7] • Asynchronous Procedure Call (APC) – Like DPC but for users – Nonblocking • Both are viewed as software interrupts CSE 5343/7343 UNIX Case Study 36

References 1. 2. 3. 4. 5. 6. 7. Harvey M. Deitel, Operating Systems Second

References 1. 2. 3. 4. 5. 6. 7. Harvey M. Deitel, Operating Systems Second Edition, Addison-Wesley, 1990. Mark Minasi, etal. , Inside MS-DOS 6. 2 Second Edition, New Riders Publishing, 1993. Jime Boyce, etal. , Inside Windows 95, New Riders Publishing, 1995. Richard Wagner, Jim Boyce, Forrest Houlette, Randall Kennedy, and Keven Stoltz, Ultimate Windows 3. 1, New Riders publishing, 1993. John Savill, The Windows NT and Windows 2000 Answer Book A Colmplete Resource from the Desktop to the Enterprise, Addison. Wesley, 1999. David A. Solomon, Inside Windows NT Second Edition, Microsoft Press, 1998. Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne, Windows XP Update Operating System Concepts Sixth Edition, 2003, John Wiley & Sons. CSE 5343/7343 UNIX Case Study 37