abhi 444

Upload: cse08115

Post on 09-Oct-2015

14 views

Category:

Documents


0 download

DESCRIPTION

operating sys

TRANSCRIPT

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 1

    Project 2 for CS554 Research Option

    Memory Management and Virtual Memory

    Author: Nagunuri Abhinav

    Date: 03-08-2014

    Course name:CS554BH1

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 2

    ABSTRACT

    Memory management is the process of controlling and guiding the computer memory, assigning

    portions called blocks to various running programs to control overall system performance.

    Memory management is present inside hardware in the operating system, and in programs and

    applications. Virtual memory is a memory management technique that is implemented using

    both hardware and software also. this maps memory address used by a program, called virtual

    addresses into physical addresses in computer memory. The main storage as seen by a process

    or collection of contiguous segments .

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 3

    TIITLE CONTENTS PAGE NO

    Introduction .................................................................................... 4

    Full operating system identification..................................................... 5

    Memory capacity ................................................................................... 8

    Process Protection.................................................................................. 8

    Memory Allocation................................................................................ 9

    Memory Mapping.................................................................................. 11

    Conclusion.............................................................................................. 13

    References................................................................................................ 13

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 4

    Introduction :

    An operating system OS is a collection of software that manages computer

    hardware resources and provides common services for computer programs. The operating system

    is an essential component of the system software in a computer system. Application programs

    usually require an operating system to function.

    Time-sharing operating systems schedule tasks for efficient use of the system and may

    also include accounting software for cost allocation of processor time, mass storage, printing, and

    other resources. The data in this operating system is managed by memory management.

    Memory management

    Memory management is the process of controlling and guiding the computer

    memory, assigning portions called blocks to various running programs to control overall system

    performance. Memory management is present inside hardware in the operating system, and in

    programs and applications

    In hardware, memory management involves components that store data, such as RAM

    ,micro and macro chips , memory caches, and flash-based solid-state drives. In the OS, memory

    management involves the allocation of specific memory blocks to individual programs as user

    demands change. when the program requests a block of memory, a part of the memory manager

    called the allocator assigns that block to the program. When a program no longer needs the data

    in previously allocated memory blocks, those blocks become available for reassignment.

    Virtual memory

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 5

    Virtual memory is a memory management technique that is implemented using both

    hardware and software also. this maps memory address used by a program, called virtual

    addresses into physical addresses in computer memory. The main storage as seen by a process

    or collection of contiguous segments .The operating system manages virtual address spaces and

    the assignment of real memory to virtual memory.Address translation hardware in the CPU, often

    referred to as a Memory management unit automatically translates virtual addresses to physical

    addresses.Software within the operating system may extend these advantages and capabilities to

    provide a virtual address space that can exceed the capacity of real memory and thus reference

    more memory than is physically present in the computer. The primary benefits of virtual memory

    include freeing applications from having to manage the shared memory space, increased

    security due to memory isolation, and being able to continously using more memory than might

    be physically available, using the technique of paging.

    Full Operating System Identification

    Microsoft Windows 7 was an operating system produced by Microsoft for use on

    personal computers, including home and business desktops, laptops, net books ,Notes , and other

    media center computers. It was released to manufacturing on July 22,2009 and became a good

    product available for retail worldwide on October 22, 2009, Microsoft co founders are Bill gates

    and Paul Allen .Windows 7 is of 6.1 version which is highest than Windows vista that is 6.0

    version Its a Windows Updated , Hybrid is of kernel type, Unlike Windows Vista, which

    introduced many new features, Windows 7 was an upgrade designed to work with Vista-

    compatible applications and hardware. Presentations given by Microsoft in 2008 focused on

    multi touch support, an updated Windows shell with a new task bar home networking system

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 6

    called Home Group and performance improvements. Some standard applications that have been

    included with releases.

    The main features in Windows 7 are

    SPEED

    Even aside from incompatibilities and other issues that many people had with Vista, one

    of the most straightforward was speed it just felt too sluggish compared to XP, even on pumped

    up hardware. Windows 7 brings a more responsive and sprightly feel and Microsoft has spent a

    lot of time and effort getting the Start Menu response just right.

    COMPATIBILITY

    The compatibility on Windows 7 will be far better than it was with Vista. Many programs

    that individuals and companies used on Windows XP did not work immediately and required

    several updates, but with Windows 7 almost all applications that work on Vista should still run.

    LOWER HARD WARE REQIREMENT

    Vista gained a reputation for making hardware look rather ordinary. Windows 7,

    however, will run well on lower end hardware, making the transition from Window XP less

    painful

    SEARCH AND ORGANISATION

    One of the best things about Windows 7 is the improved search tool, For example, typing

    mouse will bring up the mouse option within the control panel or typing a word will display it

    and split it up neatly into files, folders and applications.

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 7

    START MENU

    The task bar looks like nothing has much has changed . but their was a dramatic look

    Infact, thats not the case and its a lot more powerful. Microsoft is now making best use of its

    aero technology.

    AERO-SHAKE

    Our new visual feature is called Aero Shake. If you have a more number of things to

    open the Windows open but want to focus on just the one you can all you have to do is grab it by

    the title bar and shake with the mouse. .

    STACKING

    Another great touch is Stacking. You simply drag a Window to the sides of your screen

    and it will stick automatically to the side filling half the screen, making it quick and easy to view

    documents side by side. Move to the top and it will

    maximize to the whole screen.

    GAMMA CURVE

    The display properties now boast a useful gamma curve feature enabling you to calibrate

    your display. Set aside 10 minutes to go through it carefully and you can really give your monitor

    image a boost, which will pay dividends when youre sitting in front of a screen all day.

    TOUCH

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 8

    The visual feature to come to Windows 7 is its touch capability. This will only be

    available to those with a touch enabled PC, such as HPs Touch Smart range, but for those

    suitably equipped it will provide a new way of interacting with their PC and with other.

    Memory Capacity

    Each process on 32-bit Microsoft Windows has its own virtual address space that enables

    addressing up to 4 gigabytes of memory. Each process on 64-bit Windows has a virtual address

    space of 8 terabytes. All threads of a process can access its virtual address space. However,

    threads cannot access memory that belongs to another process, which protects a process from

    being corrupted by another process.

    The virtual address space and the memory management functions can be known by detail study

    on Virtual Address Space,Memory Pools,Memory Performance Information,Virtual Memory

    Functions,Heap Functions.

    Process protection

    Windows security model enables you to control access to process objects. When a user logs in,

    the system collects a set of data that uniquely identifies the user during the authentication

    process, and stores it in an access token. This access token describes the security protocol to of

    all processes associated with the user. You can use a token to specify the current security context

    for a process using the Create Process With TokenW function. You can specify a security

    descriptor for a process when you call the Create Process, Create Process As User,

    orCreateProcessWithLogonW function. If you specify NULL, the process gets a default security

    descriptor. The ACLs in the default security descriptor for a process come from the primary or

    impersonation token of the creator. If a computer system has multiple users and allows the

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 9

    concurrent execution of multiple processes, then access to data must be regulated. For that

    purpose, mechanisms ensure that files, memory segments, CPU, and other resources can be

    operated on by only those processes that have gained

    proper authorization from the operating system.Some of the following specific access rights are

    not allowed from a process to a protected process:

    PROCESS_ALL_ACCESS PROCESS_CREATE_PROCE

    PROCESS_CREATE_THREAD PROCESS_DUP_HANDLE

    PROCESS_QUERY_INFORMATION PROCESS_SET_INFORMATION

    PROCESS_SET_QUOTA PROCESS_VM_OPERATION PROCESS_VM_READ

    PROCESS_VM_WRI

    Memory Allocation

    The following is a brief comparison of the various memory allocation methods:

    CoTaskMemAlloc

    GlobalAlloc

    HeapAlloc

    LocalAlloc

    mallo

    new

    VirtualAlloc

    Although the GlobalAlloc, LocalAlloc, and HeapAlloc functions ultimately allocate memory

    from the same heap, each provides a different set of functionality. For example, HeapAlloc can

    be instructed to raise an exception if memory could not be allocated, a capability not available

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 10

    with LocalAlloc. LocalAlloc supports allocation of handles which permit the underlying memory

    to be moved by a reallocation without changing the handle value, a capability not available with

    HeapAlloc.

    Starting with 32-bit Windows, GlobalAlloc and LocalAlloc are implemented as wrapper

    functions that call HeapAllocusing a handle to the process's default heap. Therefore, GlobalAlloc

    and LocalAlloc have greater overhead thanHeapAlloc.

    Because the different heap allocators provide distinctive functionality by using different

    mechanisms, you must free memory with the correct function. For example, memory allocated

    with HeapAlloc must be freed with HeapFree and notLocalFree or GlobalFree. Memory

    allocated with GlobalAlloc or LocalAlloc must be queried, validated, and released

    with the corresponding global or local function. The VirtualAllo However, its allocations use a

    page granularity, so using VirtualAlloc can result in higher memory usag.The malloc function

    has the disadvantage of being run-time dependent. The new operator has the disadvantage of

    being compiler dependent and language dependent.User memory can be allocated according to

    several schemes,virtual memory, memory-mapped les, heaps,

    and thread-local storage.

    Windows 7 provides a technique to check the memory allocation and de allocation for the

    processes and killing and creating a new process in Task Manager. When an active process is in

    memory and the system runs out of memory to allocate, does it deny the creation of a new

    process or does it use a swap file.

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 11

    Segmentation

    Memory segmentation is the division of a computer's primary memory into segments or

    sections. In a computer system using segmentation, a reference to a memory location includes a

    value that identifies a segment and an within that segment only. Segments or sections are also

    used in object files of compiled programs when they are linked together into a program image

    and when the image is loaded into memory.

    Segments usually correspond to natural divisions of a program such as individual routines or data

    tables so segmentation is generally more visible to the programmer than paging alone.

    Swap file

    Swap file is a space on a hard disk used as the virtual memory extension of a computer's real

    memory (RAM). A swap file allows your computer's operating system to pretend that you have

    more RAM than you actually what we do. The last recently used files in RAM can be "swapped

    out" to your hard disk until they are needed later so that new files can be "swapped in" to RAM

    In larger operating systems , the units that are moved are called pages and the swapping is called

    paging One advantage of a swap file is that it can be organized as a single contiguous space so

    that fewer I/O operations are required to read or write a complete file.

    .

    MEMORY MAPPING

    A memory map is a structure of data that indicates how memory is laid out. Memory

    maps can have a different meaning in different parts of the operating system.In the boot process,

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 12

    a memory map is passed on from the firmware in order to instruct an operating system kernel

    about memory layout. It contains the information regarding the size of total memory, any

    reserved regions and may also provide other details specific to the architecture.

    Virtual memory allows the system to use hard disk space to store information normally stored in

    RAM. Windows 7 and Windows Vista manages virtual memory by using a paging file. You

    specify the minimum and maximum size of this file. If the size is different from the default in

    Windows.Vista, applications may return errors.Dynamically monitor memory for a few minutes

    to see the hard fault count increase quickly.A page table is the data structure used by the

    Windows Virtual Memory Manager (VMM) to store the mapping between virtual addresses and

    physical addresses in memory. The performance counter Free System Page Table Entries is the

    number of page table entries not currently used by the system.

    The primary benefit of memory mapping a file is increasing I/O performance, especially when

    used on large files. Since Windows 95, Windows-based operating systems have used a special

    file that acts as a sort of "scratch pad" to store modified pages that are still in use by some

    process.

    Page file space is reserved when the pages are initially committed, however the page file

    locations are not chosen until the page is written to disk. So, in simplistic terms, the page file is

    used by Windows to hold temporary data which is swapped in and out of physical memory in

    order to provide a larger virtual memory set.

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 13

    Page file

    The page file is one of those pieces of the operating system that administrators know t when hat

    they need to have - but they can't always explain why they need it, or how to accurately size it.

    Operating System

    The memory management function keeps track of the status of each memory location,

    either allocated

    It determines how memory is allocated among competing processes, deciding who gets

    memory, when they receive it, and how much they are allowed.

    When memory is allocated it determines which memory locations will be assigned. It

    tracks when memory is freed and updates the status.

    Conclusion :

    Research on Memory management and virtual memory have been studied and presented.

    References

    Operating Systems Design and Implementation by Andrew S. Tannenbaum, Albert S.

    Woodhull, Alfred Woodhull

    Simple Memory Allocation Algorithms (originally published on OSDEV Community)

    Formal Description of Components in Operating Systems written by Asen Petkov Iliev

  • CS554 RESEARCH PROJECT 2 MEMORY MANAGMENT AND VIRUAL MEMORY 14

    http://galvin.info/history-of-operating-system-concepts-textbook/.

    Berger, E.D.; Zorn, B.G.; McKinley, K.S. (2001). "composing high perfomence memory

    allocation"

    Jessen, Elke (2004). "Origin of the Virtual Memory Concept".

  • CS554BH1 OPERATING SYSTEM MEMORY MANAGEMENT AND VIRTUAL MEMORY