Hardware and OS Design and Layout.

Slides:



Advertisements
Similar presentations
Operating System.
Advertisements

Operating System Structures
Windows XP Kernel Architecture Mike Karlsven James Farrer Jason Smith.
Windows 2000 System Architecture (continued) Computing Department, Lancaster University, UK.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
INTRODUCTION OS/2 was initially designed to extend the capabilities of DOS by IBM and Microsoft Corporations. To create a single industry-standard operating.
Embedded Real-time Systems The Linux kernel. The Operating System Kernel Resident in memory, privileged mode System calls offer general purpose services.
OS Spring’03 Introduction Operating Systems Spring 2003.
OPERATING SYSTEMS Introduction
Operating System Organization
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Programming mobile devices Part II Programming Symbian devices with Symbian C++
Chapter 3 Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
Computer Organization
Protection and the Kernel: Mode, Space, and Context.
Operating System. Architecture of Computer System Hardware Operating System (OS) Programming Language (e.g. PASCAL) Application Programs (e.g. WORD, EXCEL)
Section 3.1: Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Processes Introduction to Operating Systems: Module 3.
Operating System Principles And Multitasking
UNIX Unit 1- Architecture of Unix - By Pratima.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
Lecture on Central Process Unit (CPU)
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
CITA 171 Section 1 DOS/Windows Introduction. DOS Disk operating system (DOS) –Term most often associated with MS-DOS –Single-tasking operating system.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
A+ Guide to Managing and Maintaining Your PC, 7e Chapter 2 Introducing Operating Systems.
Introduction to Operating Systems Concepts
Computer systems is a 10-credit unit
Introduction to Kernel
CSC 482/582: Computer Security
Chapter Objectives In this chapter, you will learn:
Operating System Review
Process Management Process Concept Why only the global variables?
CS161 – Design and Architecture of Computer
Chapter 1: A Tour of Computer Systems
Operating System.
Windows 95 & 98 Steve Boyle Mike Forster Maggie Hamill Nancy O’Brien.
Operating System Structure
Unit OS2: Operating System Principles
The PCI bus (Peripheral Component Interconnect ) is the most commonly used peripheral bus on desktops and bigger computers. higher-level bus architectures.
CIT 480: Securing Computer Systems
Operating System Review
OS Virtualization.
Windows Internals Brown-Bag Seminar Chapter 1 – Concepts and Tools
Chapter 9: Virtual-Memory Management
Main Memory Background Swapping Contiguous Allocation Paging
Operating Systems.
Today’s agenda Hardware architecture and runtime system
Lecture Topics: 11/1 General Operating System Concepts Processes
Morgan Kaufmann Publishers Memory Hierarchy: Virtual Memory
Windows Virtual PC / Hyper-V
Outline Operating System Organization Operating System Examples
Software - Operating Systems
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment. Phone:
Operating System Concepts
Operating System Concepts
Chapter 1: Introduction CSS503 Systems Programming
Chapter 13: I/O Systems.
Presentation transcript:

Hardware and OS Design and Layout

Computers Desktops, PCs, Laptops…

Hardware Commodity PCs are built from similar, replaceable components Motherboard Random Access Memory (RAM) Hard Drive Peripherals (Video Card, Keyboard, Mouse)

Even Laptops? Yes, even laptops. The components may be integrated together and less replaceable, but they still adhere to standardized designs and interfaces.

Diagram Motherboard Memory (RAM) CPU NorthBridge AGP or PCI Express FrontSide Bus NorthBridge AGP or PCI Express PCI Slots IO Serial/Parallel Keyboard Mouse SouthBridge Hard Drive USB IDE/SATA

Why use Memory? Hard Drives are much larger… Memory is FAST A read can take around 0.00000001 seconds Hard drives are SLOW A read can take around 0.01 seconds It comes down to electrical (Memory) vs. mechanical (Hard Drives)

Windows Concepts The Windows OS is highly structured and has many concepts: Kernel and User modes Drivers Processes Threads Services Registry

Architecture Diagram Executive User Applications Windows API Services Base Kernel Device Drivers Environment Subsystems USER and GUI support System Support Processes HAL Kernel mode User mode

CPU Privilege Level Ring 0: Unrestricted Ring 1, 2: Not used in Windows Ring 3: Restricted Ring 0 Ring 1 Ring 2 Ring 3

Windows Kernel Windows Exectuive, which handles memory, process, thread, security, object, IO, and networking management Hardware Abstraction Layer (HAL) USER and GUI functionality Device Drivers, to provide extendable user and hardware IO

Windows Kernel Kernel components have unrestricted access to the entire system Dangerous! The kernel is Ring 0

What are Device Drivers? Dynamic, Loadable modules that run in kernel mode and can provide hardware IO support, and/or user IO translation. Again, as with all kernel components, unrestricted access to the system (Dangerous)!

Windows User mode Contains user applications Contains Support processes (logon) Contains Service processes Contains Environment subsystems Restricted access to the system (Ring 3) Must access system resources through the Windows API

What are Processes? Processes are containers for executing a program Private Virtual Memory space Unique Identifier called a Process ID (PID) At least one Thread of execution Security context

What is a Thread? A Thread is a container for execution CPU registers and state Stacks Private storage called TLS Unique Identifier called a Thread ID (TID or client ID) Security context

Services User mode programs that provide functionality independent of the current user For example: Task Scheduler Print Spooler Windows Update

Services.exe Svchost.exe Others (see VMWareService.exe)

Registry A system database that contains important information For example: Startup settings Hardware configurations Application configurations Current user data

Physical Memory vs. Virtual Memory Physical Memory refers to the hardware view of memory There is only one Virtual Memory refers to “virtualized” OS views of memory There can be many different virtual memory spaces

Memory Physical Memory Virtual Memory(s) Memory (RAM) Operating System

Why have Virtual Memory Can provide process memory isolation (security) Allows more “logical” memory by increasing the addressable space (Each process gets its own 4GB of virtual memory) When combined with paging, can increase the total available memory (more on this later)

Total Logical Memory Sum of all Virtual Memory Physical Memory 2 GB Memory (RAM) OS 4GB 4GB 4GB 4GB 4GB 4GB Virtual Memory 6 x 4GB = 24 GB of Logical Memory

How does 2GB become 24GB (or more)? The OS utilizes CPU features to create page directories and page tables which can be used to divide physical memory among multiple virtual memory spaces

Physical <-> Virtual 2 GB Virtual Memory for Process A Page Directories and Page Tables 0 GB 4 GB Physical Memory Virtual Memory for Process B 0 GB 4 GB Virtual Memory for Process C 0 GB 0 GB 4 GB

What happens when all of Physical Memory is used? Paging to the Hard Drive (SLOW!) Pagefile.sys

Virtual Memory for Process A 2 GB Virtual Memory for Process A Page Directories and Page Tables 0 GB 4 GB Physical Memory Virtual Memory for Process B 0 GB 4 GB 0 GB Virtual Memory for Process C 0 GB 4 GB Hard Drive

Paging to Disk When Physical Memory is getting full, the least used pages of memory are written to disk When those pages are needed again, they are read back into Physical Memory and some other pages are written to disk. This is called Swapping. Reduces system performance.

Memory Dump To get a complete collection of memory you need to collect two pieces: Physical Memory The on disk pagefile

But is it really complete? There is another feature of Windows Memory Management that may leave empty sections in a memory dump Unreferenced Memory

Unreferenced Memory When loading a binary from disk, the Windows Memory Manager may decide to only read portions of the binary into memory The unread portions of the binary are tracked We call them “unreferenced pages”

Why not read everything? Speed Reduction of actual memory usage Some binaries are very large but only a small section may be commonly used

Virtual Memory for Process A Page Directories and Page Tables 2 GB Virtual Memory for Process A Page Directories and Page Tables 0 GB 4 GB Physical Memory Virtual Memory for Process B 0 GB 4 GB 0 GB Hard Drive pagefile ANYFILE

Virtual Memory Allocation Programs can allocate virtual memory dynamically The size can range from a single byte to several GBs (or 8192 GBs in x64 OS versions)

How is this tracked? The Windows kernel uses a data structure known as Virtual Address Descriptors (VADs) to track virtual memory allocations Responder combines this information with Page Table data for each process and displays it in the Memory Map detail panel

Virtual Memory for Process A 2 GB Virtual Memory for Process A Page Directories and Page Tables 0 GB 4 GB Physical Memory VAD Tree 0x00C00000 – 0x00E00000 0x00CD0000 – 0x00CDF000 PTE 0010 - 0015 0x00CE0000 – 0x00E00000 0 GB 0x00CE0000 – 0x00CF0000 0x00D10000 – 0x00D20000 Hard Drive

Memory Block Block Length Individual Pages for this Block Some Unreferenced Pages

Virtual Memory Layout 4 GB The upper 2GB* of every Virtual Memory space is reserved for the Windows Kernel to use. It is not accessible to user mode processes. * Note: except with the rarely used /3GB switch Kernel Memory 2 GB User Memory 0 GB

User Virtual Memory 2 GB Process specific Windows system structures Windows System DLLs Windows and Application DLLs or Allocated Memory DLLs or Allocated Memory Application Binary Stack Heap or Allocated Memory 0 GB

Might be Heap Stack Application DLLs System DLLs

User mode How do user mode programs (which are restricted) access system resources? The Windows API

What is the Windows API? The core set of Application Programming Interfaces for the Windows Operating System Provides all the functionality required to create software on the Windows platform. http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspx

API Example

How does the API work? From a user mode program: A call is made to an API function The API function eventually calls an exported function of NTDLL that provides the needed ability The NTDLL function issues an interrupt (or SYSENTER instruction) to pass control to kernel mode

API - Kernel Mode The interrupt/SYSENTER handler, KiSystemService, is called by the CPU KiSystemService looks up and calls the requested service in the System Service Descriptor Table (SSDT) Note there is also a Service Descriptor Table Shadow that handles USER and GDI services

Windows API Application Calls WriteFile Kernel32.DLL WriteFile Calls NtWriteFile NTDLL.DLL NtWriteFile Issues a SYSENTER instruction User mode Kernel mode NtosKrnl.exe KiSystemService Looks up requested service in the System Service Descriptor Table (SSDT) SSDT The SSDT is a table of function pointers 0x84c0780 Perform a write Return to user mode caller NtosKrnl.exe NtWriteFile