Lecture 13: Examples of Memory Management - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

Lecture 13: Examples of Memory Management

Description:

The byte index specifies one of 4KB within a page; the page index specifies one ... Author: Eleni Mangina elenim_at_roach.dai.ed.ac.uk % Created: Thu May 28 1998 ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 36
Provided by: EleniM9
Category:

less

Transcript and Presenter's Notes

Title: Lecture 13: Examples of Memory Management


1
Lecture 13Examples of Memory Management
2
MVS
  • Multiple Virtual Storage Operating System (IBM)
  • The byte index specifies one of 4KB within a
    page the page index specifies one of 256 pages
    within a segment the segment index identifies
    one of 2048 user-visible segments (231 bytes 2GB
    virtual storage)

0
11
12
31
19
20
Segment index
Page index
Byte index
0
31
25 26 27 28
Page table length
I
C
Page table origin
3
IBM System/370
  • Uses a two-level memory structure and refers o
    the two levels as segments and pages
  • Page size 2KB or 4KB
  • Segment size (fixed) 64KB or 1MB
  • 24 bit address structure BUT?

4
SYSTEM 370/XA
  • XA extended addressing
  • 31 bit address scheme

0
11
12
31
19
20
Segment index
Page index
Byte index
0
31
25 26 27 28
Page table length
I
C
Page table origin
5
System 370/ESA
  • Latest version Enterprise System Architecture

0
31
19 21 22
I
P
Page frame number
Unreferenced interval count (UIC)
Address space identifier
Segment number
Page number
Available frame
6
MVS address space structure
16KB
MVS

0
7
MVS address space structure
MVS/XA

16KB

0
8
MVS address space structure


16KB

0
MVS/ESA
9
370/ESA address translation
Instruction
Opcode R1 X2 B2 D2
Displacement
Access Register
General Purpose Registers
Address Space Reference
Base Address
Index

Virtual address
Segment-Table Designation
Real address
Dynamic Address Translation
Access register Translation
10
WINDOWS NT
  • Windows NT was designed to be implemented on a
    variety of processors. One of the most important
    platforms for Windows NT is the Intel 486.
  • Page size 4KB

11
Windows NT Address Spaces
  • Unsegmented unpaged memory The virtual address
    is the same as the physical address, which is
    useful in low complexity, high performance
    controller applications
  • Unsegmented paged memory Memory is viewed as a
    paged linear address space. Protection and
    management of memory are done by paging
  • Segmented unpaged memory Memory is viewed as a
    collection of logical address spaces. The
    advantages of this view over a paged approach is
    that it affords protection down to the level of a
    single byte if necessary. It guarantees that the
    translation table needed is on-chip when the
    segment is in memory. Hence the segmented unpaged
    memory results in predictable access times
  • Segmented paged memory Segmentation is used to
    define logical memory partitions subject to
    access control and paging is used to manage the
    allocation of memory within partitions.

12
The format of the virtual address includes the
following fields
  • Table indicator (TI) indicates whether the
    global segment table or a local segment table
    should be used for translation
  • Segment number is the number of the segment.
    This serves as an index into the segment table
  • Offset The offset of the address byte within the
    segment
  • Requested privilege level (RPL) The privilege
    level requested for this access

13
TI
Segment Offset
Directory Offset
Rpl
Page
47
35
31
0
31
21
11
0
(a) Virtual Address
(b) Linear Address
Limit 1916
Base 3134 G 000 P Dp1 1 Type
A Base 2316
Segment Base 15 0 Segment
Limit 15 0
(c) Segment table entry
US
RW
Page table Address 31 12 00 D A 00
P
Avail
(d) Page table directory entry
US
RW
Page Frame Address 3112 00 D A 00
P
Avail
(e) Page table entry
14
Segment Table entry
Limit Defines the size of the segment. The processor interprets the limit field in one of two ways, depending on the granularity bit in units of one byte, up to a limit of 1MB, or in units of 4KB, up to a limit of 4GB
Base Defines the starting address of the segment within the 4GB linear address space
Accessed bit (A) Set whenever the segment is accessed. An operating system that uses segmented non-paged memory may use this bit to monitor frequency of segment usage for memory management purposes. In a paged system, this bit is ignored
Type Distinguishes between various kinds of segments and indicates the access attributes
Descriptor privilege level Specifies the privilege level of the segment referred to by this segment table entry
Segment present bit (P) Used for non paged systems. It indicates whether the segment is present in main memory. For paged systems, this bit is always set to 1.
Granularity bit Indicates whether the Limit field is to be interpreted in units of 1 byte or 4KB
15
Page table Directory Entry and Page Table Entry
Page Frame Address Provides the physical address of the page in memory if the present bit is set. Because page frames are aligned on 4K boundaries, the bottom 12 bits are zero and only the top 20 bits are included in the entry
Page table address Provides the physical address of a page table in memory if the present bit is set
Present bit (P) Indicates whether the page table or page is in main memory
Accessed bit (A) This bit is set to 1 by the processor in both levels of page tables when a read or write operation to the corresponding page occurs
Dirty bit (D) This bit is set to 1 by the processor when a write operation to the corresponding page occurs
User/Supervisor bit Indicates whether the page is available only to the operating system (supervisor level) or is available to both operating system and applications (user level)
Read/Write bit Fir user-level pages, indicates whether the page is read-only access or read/write access for user-level programs
Available bits Available for systems programmer use
16
UNIX System V
  • Page table one page table per process, with one
    entry for each page in virtual memory for that
    process
  • Disk block descriptor associated with each page
    of a process is an entry in this table that
    describes the disk copy of the virtual page
  • Page frame data table describes each frame of
    real memory and is indexed by frame number
  • Swap-use table there is one swap use table for
    each swap device, with one entry for each page on
    the device

17
Linux System
  • Allocating and freeing physical memory pages,
    groups of pages and small blocks of memory
  • Handling virtual memory, which is memory mapped
    into the address space of running processes

18
Linux system Management of physical memory
  • Page allocator
  • Buddy-heap algorithm

8KB
8KB
16KB
4KB
8KB
4KB
19
Linux system Management of virtual memory
  • Maintaining the address space visible to each
    process
  • Creates pages of virtual memory on demand
  • Manages the loading of those pages from disk or
    their swapping back out to disk as required
  • Process address space as a set of separate
    regions and as a set of pages

20
Linux system Management of virtual memory
  • Vm_area_struct
  • Policy algorithm
  • Paging mechanism
  • Pageout policy

21
Linux system Management of virtual memory
(memory layout)
Kernel virtual memory
Stack

Memory-mapped region
Memory- mapped region
Memory mapped region

Run-time data
Uninitialised data
Initialised data
Program text

Memory invisible to user mode code
The brk pointer
Forbidden region
22
WINDOWS 2000
Page directory entry 1023
Page directory
Page directory entry 0
Page table entry 1023
Page table 0
Page table entry 1023
Page table 1023
Page directory entry 0
Page directory entry 0
4K page
4K page
4K page
4K page
23
WINDOWS 2000 Page file page-table entry
31
0
Protection
Page address
T
T
P
Page file
24
WINDOWS 2000 FILE I/O
process
I/O manager
I/O
Cache manager
Cached I/O
File system
Noncached I/O
VM manager
Disk driver
Page fault
25
Security
26
Security Violation
  • Intentional (malicious)
  • Unauthorised reading of data
  • Unauthorised modification of data
  • Unauthorised destruction of data
  • Accidental

27
Security Attacks
  • System calls
  • try illegal system calls or legal system calls
    with illegal parameters
  • Breaking login process
  • start logging in and then reboot or break halfway
  • Memory information
  • many systems do not erase the space before
    allocation
  • Bad login program
  • write a login program that records other users
    authentication

28
Security Flaws
  • Examples
  • Unix utility lpr has an option to remove the
    file after it has been printed. In early versions
    it was possible for anyone to use lpr to print,
    and then have the system remove, the password
    file
  • link the core file to password file and force a
    core dump of SETUID program
  • mkdir foo

29
Security Threats
  • Bacteria
  • program that consumes system resources by
    replicating itself
  • Logic Bomb
  • logic embedded in a program that checks for a
    certain set of conditions to be present on the
    system. When these conditions are met, it
    executes some function resulting in unauthorised
    actions
  • Trapdoor
  • Secret undocumented entry point into a program,
    used to grant access without normal methods of
    authentication

30
Security Threats (ctd)
  • Trojan Horse
  • secret undocumented routine embedded within a
    useful program. Execution of the program results
    in execution of the secret routine
  • Virus
  • Code embedded within a program that causes of
    itself to be inserted in one or more other
    programs, and performs unwanted functions
  • Worm
  • program that can replicate itself and send a
    copies across network connections

31
Windows NT Security
  • Access Control Scheme
  • governed by two entities
  • an access token is associated with each process
  • a security descriptor is associated with each
    object for which inter-process access is possible
  • Users log on to an NT system by name/password
    scheme authentication

32
Access Token
  • Security ID (SID)
  • identifies the user uniquely across all the
    computer system
  • Group SIDs
  • list of groups to which the user belongs
  • Default ACL
  • initial list of protections applied to the object
    at its creation

33
Security Descriptor
  • Flags
  • defines the type and contents of a security
    descriptor
  • System ACL (SACL)
  • specifies what kind of operations on the object
    should generate audit messages
  • Discretionary ACL (DACL)
  • Determines which users and groups can access this
    object for which operations

34
Access Control List (ACL)
35
After March break..
  • File KA.tex
  • Author Eleni Mangina ltelenim_at_roach.dai.ed.ac.u
    kgt
  • Created Thu May 28 1998
  • \documentclassa4paper,12ptarticle
  • \usepackagedvipsgraphics
  • \usepackageepsfig
  • Use \includegraphics.eps for pictures
  • Enlarge printing area a bit
  • \setlength\textwidth16cm
  • \setlength\oddsidemargin0cm
  • \setlength\evensidemargin0cm
  • \setlength\topmargin-0.94cm
  • \setlength\textheight23cm
  • \begindocument
  • \beginlarge
  • \bf Introduction
  • \endlarge
  • \paragraph
  • Knowledge-based systems can be connected with the
    field of
Write a Comment
User Comments (0)
About PowerShow.com