Simple/Basic Segmentation

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Prof. Hsien-Hsin Sean Lee
Part IV: Memory Management
Paging Hardware With TLB
Chapter 8.3: Memory Management
Background A program must be brought into memory and placed within a process for it to be executed. Input queue – collection of processes on the disk that.
Memory Management.
Memory Management (continued) CS-3013 C-term Memory Management CS-3013 Operating Systems C-term 2008 (Slides include materials from Operating System.
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Chapter 91 Translation Lookaside Buffer (described later with virtual memory) Frame.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
A. Frank - P. Weisberg Operating Systems Simple/Basic Segmentation.
Main Memory. Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are only.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
 Background  Swapping  Contiguous Allocation  Paging  Segmentation  Segmentation with Paging.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Memory Management -1 Background Swapping Memory Management Schemes
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 8 Operating Systems.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
Page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation) 
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
Memory Management 1. Background Programs must be brought (from disk) into memory for them to be run Main memory and registers are only storage CPU can.
Silberschatz and Galvin  Operating System Concepts Module 8: Memory Management Background Logical versus Physical Address Space Swapping Contiguous.
Paging Example What is the data corresponding to the logical address below:
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
CE Operating Systems Lecture 14 Memory management.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
CSC 360, Instructor Kui Wu Memory Management I: Main Memory.
Memory Management. Background Memory consists of a large array of words or bytes, each with its own address. The CPU fetches instructions from memory.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Memory and Addressing It all starts.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
1 Memory Management n In most schemes, the kernel occupies some fixed portion of main memory and the rest is shared by multiple processes.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
W4118 Operating Systems Instructor: Junfeng Yang.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
MEMORY MANAGEMENT. memory management  In a multiprogramming system, in order to share the processor, a number of processes must be kept in memory. 
Basic Paging (1) logical address space of a process can be made noncontiguous; process is allocated physical memory whenever the latter is available. Divide.
Module 9: Memory Management
Chapter 9: Memory Management
UNIT–IV: Memory Management
Chapter 8: Memory Management
COMBINED PAGING AND SEGMENTATION
Chapter 8: Main Memory.
Chapter 8: Memory Management
Paging and Segmentation
Chapter 8: Main Memory.
Chapter 8: Main Memory.
Storage Management Chapter 9: Memory Management
Operating System Concepts
Module 9: Memory Management
Segmentation Lecture November 2018.
Chapter 8: Main Memory.
Background Program must be brought into memory and placed within a process for it to be run. Input queue – collection of processes on the disk that are.
CSS 430: Operating Systems - Main Memory
Operating System Main Memory
Memory Management-I 1.
Main Memory Background Swapping Contiguous Allocation Paging
Memory Management Chapter 7.
Main Memory Session - 16.
Lecture 3: Main Memory.
Chapter 8: Memory Management strategies
Lecture 35 Syed Mansoor Sarwar
Page Main Memory.
Presentation transcript:

Simple/Basic Segmentation Segmentation supports user’s view of a program. A user’s program is a collection of segments - logical units - such as: main program, subprogram, class procedure, function, object, method, local variables, global variables, common block, stack, symbol table, arrays

Dynamics of Simple Segmentation Each program is subdivided into blocks of non-equal size called segments. When a process gets loaded into main memory, its different segments can be located anywhere. Each segment is fully packed with instructions/data; no internal fragmentation. There is external fragmentation; it is reduced when using small segments. In contrast with paging, segmentation is visible to the programmer: provided as a convenience to organize logically programs (example: data in one segment, code in another segment). must be aware of segment size limit. The OS maintains a segment table for each process. Each entry contains: the starting physical addresses of that segment. the length of that segment (for protection).

Example of Segmentation 1400 6300 4300 3200 4700 Physical address space Subroutine Segment 2 Segment 0 Segment 3 Segment 4 stack Symbol table Main program Segment 1 sqrt Logical address space Limit base 1000 1400 400 6300 400 4300 1100 3200 1000 4700 Segment table

Logical address used in segmentation and Address Translation logical address (segment number, offset) = (s, d), get starting physical address b and the length l of that segment from segment table. The physical address is obtained by adding d to b (in contrast with paging): the hardware also compares the offset d with the length l of that segment to determine if the address is valid.

Segmentation Architecture Logical address consists of a two tuple: <segment-number, offset>, Segment table – maps two-dimensional physical addresses; each table entry has: base – contains the starting physical address where the segments reside in memory. limit – specifies the length of the segment. Segment-table base register (STBR) points to the segment table’s location in memory. Segment-table length register (STLR) indicates number of segments used by a program; segment s is legal if s < STLR.

Segmentation Issues Allocation: Relocation: Sharing: Dynamic storage allocation external fragmentation Relocation: dynamic by segment table Sharing: shared segments same segment number Protection - with each entry in segment table associate: validation bit = 0  illegal segment read/write/execute privileges Protection bits associated with segments; code sharing occurs at segment level. Since segments vary in length, memory allocation is a dynamic storage-allocation problem.

Simple segmentation/paging comparison Segmentation is visible to the programmer whereas paging is transparent. Naturally supports protection/sharing. Segmentation can be viewed as commodity offered to the programmer to logically organize a program into segments while using different kinds of protection Segments are variable-size; Pages are fixed-size. Segmentation requires more complicated hardware for address translation than paging. Segmentation suffers from external fragmentation. Paging only yields a small internal fragmentation. Maybe combine Segmentation and Paging?

Segmentation with Paging Problems of external fragmentation and lengthy search times can be solved by paging the segments. Solution differs from pure segmentation in that the segment-table entry contains not the base address of the segment, but rather the base address of a page table for this segment.

Address Translation Scheme + t d p d S d Segment page-table length base  d yes no trap STBR memory segment table Page table for segment s