SlideShare a Scribd company logo
1 of 15
Operating System - Memory Management
Memory management is the functionality of an operating system
which handles or manages primary memory. Memory
management keeps track of each and every memory location
either it is allocated to some process or it is free. It checks how
much memory is to be allocated to processes. It decides which
process will get memory at what time. It tracks whenever some
memory gets freed or unallocated and correspondingly it updates
the status.
Memory management provides protection by using two registers,
a base register and a limit register. The base register holds the
smallest legal physical memory address and the limit register
specifies the size of the range. For example, if the base register
holds 300000 and the limit register is 120000, then the program
can legally access all addresses from 300000 through 411999.
Instructions and data to memory addresses can be done in
following ways
 Compile time -- When it is known at compile time where
the process will reside, compile time binding is used to
generate the absolute code.
 Load time -- When it is not known at compile time where
the process will reside in memory, then the compiler
generates re-locatable code.
 Execution time -- If the process can be moved during its
execution from one memory segment to another, then
binding must be delayed to be done at run time
Dynamic Loading
In dynamic loading, a routine of a program is not loaded until it
is called by the program. All routines are kept on disk in a re-
locatable load format. The main program is loaded into memory
and is executed. Other routines methods or modules are loaded
on request. Dynamic loading makes better memory space
utilization and unused routines are never loaded.
Dynamic Linking
Linking is the process of collecting and combining various
modules of code and data into a executable file that can be
loaded into memory and executed. Operating system can link
system level libraries to a program. When it combines the
libraries at load time, the linking is called static linking and when
this linking is done at the time of execution, it is called as
dynamic linking.
In static linking, libraries linked at compile time, so program
code size becomes bigger whereas in dynamic linking libraries
linked at execution time so program code size remains smaller.
Logical versus Physical Address Space
An address generated by the CPU is a logical address whereas
address actually available on memory unit is a physical address.
Logical address is also known a Virtual address.
Virtual and physical addresses are the same in compile-time and
load-time address-binding schemes. Virtual and physical
addresses differ in execution-time address-binding scheme.
The set of all logical addresses generated by a program is
referred to as a logical address space. The set of all physical
addresses corresponding to these logical addresses is referred to
as a physical address space.
The run-time mapping from virtual to physical address is done by
the memory management unit (MMU) which is a hardware
device. MMU uses following mechanism to convert virtual
address to physical address.
 The value in the base register is added to every address
generated by a user process which is treated as offset at
the time it is sent to memory. For example, if the base
register value is 10000, then an attempt by the user to use
address location 100 will be dynamically reallocated to
location 10100.
 The user program deals with virtual addresses; it never sees
the real physical addresses.
Swapping
Swapping is a mechanism in which a process can be swapped
temporarily out of main memory to a backing store , and then
brought back into memory for continued execution.
Backing store is a usually a hard disk drive or any other
secondary storage which fast in access and large enough to
accommodate copies of all memory images for all users. It must
be capable of providing direct access to these memory images.
Major time consuming part of swapping is transfer time. Total
transfer time is directly proportional to the amount of memory
swapped. Let us assume that the user process is of size 100KB
and the backing store is a standard hard disk with transfer rate
of 1 MB per second. The actual transfer of the 100K process to or
from memory will take
100KB / 1000KB per second
= 1/10 second
= 100 milliseconds
Memory Allocation
Main memory usually has two partitions
 Low Memory -- Operating system resides in this memory.
 High Memory -- User processes then held in high memory.
Operating system uses the following memory allocation
mechanism.
S.N. Memory Allocation Description
1 Single- allocation In this type of
allocation, relocation-
register scheme is
used to protect user
processes from each
other, and from
changing operating-
system code and
data. Relocation
register contains
value of smallest
physical address
whereas limit register
contains range of
logical addresses.
Each logical address
must be less than the
limit register.
2 Multiple-partition allocation In this type of
allocation, main
memory is divided
into a number of
fixed-sized partitions
where each partition
should contain only
one process. When a
partition is free, a
process is selected
from the input queue
and is loaded into the
free partition. When
the process
terminates, the
partition becomes
available for another
process.
Fragmentation
As processes are loaded and removed from memory, the free
memory space is broken into little pieces. It happens after
sometimes that processes can not be allocated to memory blocks
considering their small size and memory blocks remains unused.
This problem is known as Fragmentation.
Fragmentation is of two types
S.N. Fragmentation Description
1 External fragmentation Total memory space is
enough to satisfy a request
or to reside a process in it,
but it is not contiguous so it
can not be used.
2 Internal fragmentation Memory block assigned to
process is bigger. Some
portion of memory is left
unused as it can not be
used by another process.
External fragmentation can be reduced by compaction or shuffle
memory contents to place all free memory together in one large
block. To make compaction feasible, relocation should be
dynamic.
Paging
External fragmentation is avoided by using paging technique.
Paging is a technique in which physical memory is broken into
blocks of the same size called pages (size is power of 2, between
512 bytes and 8192 bytes). When a process is to be executed,
it's corresponding pages are loaded into any available memory
frames.
Logical address space of a process can be non-contiguous and a
process is allocated physical memory whenever the free memory
frame is available. Operating system keeps track of all free
frames. Operating system needs n free frames to run a program
of size n pages.
Address generated by CPU is divided into
 Page number (p) -- page number is used as an index into
a page table which contains base address of each page in
physical memory.
 Page offset (d) -- page offset is combined with base
address to define the physical memory address.
Following figure show the paging table architecture.
Segmentation
Segmentation is a technique to break memory into logical pieces
where each piece represents a group of related information. For
example ,data segments or code segment for each process, data
segment for operating system and so on. Segmentation can be
implemented using or without using paging.
Unlike paging, segment are having varying sizes and thus
eliminates internal fragmentation. External fragmentation still
exists but to lesser extent.
Address generated by CPU is divided into
 Segment number (s) -- segment number is used as an
index into a segment table which contains base address of
each segment in physical memory and a limit of segment.
 Segment offset (o) -- segment offset is first checked
against limit and then is combined with base address to
define the physical memory address.
File System
A file can be "free formed", indexed or structured collection of related
bytes having meaning only to the one who created it. Or in other words
an entry in a directory is the file. The file may have attributes like name,
creator, date, type, permissions etc.
File Structure
A file has various kinds of structure. Some of them can be :
Simple Record Structure with lines of fixed or variable lengths.
Complex Structures like formatted document or reloadable load files.
No Definite Structure like sequence of words and bytes etc.
Attributes of a File
Following are some of the attributes of a file :
Name . It is the only information which is in human-readable form.
Identifier. The file is identified by a unique tag(number) within file
system.
Type. It is needed for systems that support different types of files.
Location. Pointer to file location on device.
Size. The current size of the file.
Protection. This controls and assigns the power of reading, writing,
executing.
Time, date, and user identification. This is the data for protection,
security, and usage monitoring.
File Access Methods
The way that files are accessed and read into memory is determined by
Access methods. Usually a single access method is supported by
systems while there are OS's that support multiple access methods.
Sequential Access
Data is accessed one record right after another is an order.
Read command cause a pointer to be moved ahead by one.
Write command allocate space for the record and move the pointer to
the new End Of File.
Such a method is reasonable for tape.
Direct Access
This method is useful for disks.
The file is viewed as a numbered sequence of blocks or records.
There are no restrictions on which blocks are read/written, it can be
dobe in any order.
User now says "read n" rather than "read next".
"n" is a number relative to the beginning of file, not relative to an
absolute physical disk location.
Indexed Sequential Access
It is built on top of Sequential access.
It uses an Index to control the pointer while accessing files.
What is a Directory?
Information about files is maintained by Directories. A directory can
contain multiple files. It can even have directories inside of them. In
Windows we also call these directories as folders.
Following is the information maintained in a directory :
Name : The name visible to user.
Type : Type of the directory.
Location : Device and location on the device where the file header is
located.
Size : Number of bytes/words/blocks in the file.
Position : Current next-read/next-write pointers.
Protection : Access control on read/write/execute/delete.
Usage : Time of creation, access, modification etc.
Mounting : When the root of one file system is "grafted" into the
existing tree of another file system its called Mounting.
Name: Mohammad Hussain Ahmady
ID:15BCA080

More Related Content

What's hot

Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
rohassanie
 
Process management
Process managementProcess management
Process management
Mohd Arif
 

What's hot (20)

Memory management
Memory managementMemory management
Memory management
 
Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
 
Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4Ios103 ios102 iv-operating-system-memory-management_wk4
Ios103 ios102 iv-operating-system-memory-management_wk4
 
Memory management ppt coa
Memory management ppt coaMemory management ppt coa
Memory management ppt coa
 
Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
 
Memory management
Memory managementMemory management
Memory management
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Overview of Distributed Systems
Overview of Distributed SystemsOverview of Distributed Systems
Overview of Distributed Systems
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Process management
Process managementProcess management
Process management
 
Operating system
Operating systemOperating system
Operating system
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Main memoryfinal
Main memoryfinalMain memoryfinal
Main memoryfinal
 
Memory management
Memory managementMemory management
Memory management
 
Ch4 memory management
Ch4 memory managementCh4 memory management
Ch4 memory management
 
Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029
 
Operating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management ConceptsOperating Systems 1 (9/12) - Memory Management Concepts
Operating Systems 1 (9/12) - Memory Management Concepts
 
Main memory os - prashant odhavani- 160920107003
Main memory   os - prashant odhavani- 160920107003Main memory   os - prashant odhavani- 160920107003
Main memory os - prashant odhavani- 160920107003
 
Memory managment
Memory managmentMemory managment
Memory managment
 

Similar to Operating system

Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OS
C.U
 
Memory Managementgggffffffffffgggggggggg
Memory ManagementgggffffffffffggggggggggMemory Managementgggffffffffffgggggggggg
Memory Managementgggffffffffffgggggggggg
BHUPESHRAHANGDALE200
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
C.U
 
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptxMEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
22bec032
 

Similar to Operating system (20)

Chapter 9 OS
Chapter 9 OSChapter 9 OS
Chapter 9 OS
 
Memory management Assignment Help
Memory management Assignment HelpMemory management Assignment Help
Memory management Assignment Help
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Ch8
Ch8Ch8
Ch8
 
Memory Managementgggffffffffffgggggggggg
Memory ManagementgggffffffffffggggggggggMemory Managementgggffffffffffgggggggggg
Memory Managementgggffffffffffgggggggggg
 
CH08.pdf
CH08.pdfCH08.pdf
CH08.pdf
 
unit5_os (1).pptx
unit5_os (1).pptxunit5_os (1).pptx
unit5_os (1).pptx
 
Os
OsOs
Os
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
OSCh9
OSCh9OSCh9
OSCh9
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
Paging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory managementPaging +Algorithem+Segmentation+memory management
Paging +Algorithem+Segmentation+memory management
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
Os unit 2
Os unit 2Os unit 2
Os unit 2
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Management
 
Dynamic loading
Dynamic loadingDynamic loading
Dynamic loading
 
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptxMEMORY MANAGEMENT FHES har ar mahaadev.pptx
MEMORY MANAGEMENT FHES har ar mahaadev.pptx
 
Memory comp
Memory compMemory comp
Memory comp
 
Operating system
Operating systemOperating system
Operating system
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 

Operating system

  • 1. Operating System - Memory Management Memory management is the functionality of an operating system which handles or manages primary memory. Memory management keeps track of each and every memory location either it is allocated to some process or it is free. It checks how much memory is to be allocated to processes. It decides which process will get memory at what time. It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status. Memory management provides protection by using two registers, a base register and a limit register. The base register holds the smallest legal physical memory address and the limit register specifies the size of the range. For example, if the base register holds 300000 and the limit register is 120000, then the program can legally access all addresses from 300000 through 411999.
  • 2. Instructions and data to memory addresses can be done in following ways  Compile time -- When it is known at compile time where the process will reside, compile time binding is used to generate the absolute code.  Load time -- When it is not known at compile time where the process will reside in memory, then the compiler generates re-locatable code.  Execution time -- If the process can be moved during its execution from one memory segment to another, then binding must be delayed to be done at run time Dynamic Loading In dynamic loading, a routine of a program is not loaded until it is called by the program. All routines are kept on disk in a re- locatable load format. The main program is loaded into memory and is executed. Other routines methods or modules are loaded
  • 3. on request. Dynamic loading makes better memory space utilization and unused routines are never loaded. Dynamic Linking Linking is the process of collecting and combining various modules of code and data into a executable file that can be loaded into memory and executed. Operating system can link system level libraries to a program. When it combines the libraries at load time, the linking is called static linking and when this linking is done at the time of execution, it is called as dynamic linking. In static linking, libraries linked at compile time, so program code size becomes bigger whereas in dynamic linking libraries linked at execution time so program code size remains smaller. Logical versus Physical Address Space An address generated by the CPU is a logical address whereas address actually available on memory unit is a physical address. Logical address is also known a Virtual address. Virtual and physical addresses are the same in compile-time and load-time address-binding schemes. Virtual and physical addresses differ in execution-time address-binding scheme. The set of all logical addresses generated by a program is referred to as a logical address space. The set of all physical addresses corresponding to these logical addresses is referred to as a physical address space. The run-time mapping from virtual to physical address is done by the memory management unit (MMU) which is a hardware device. MMU uses following mechanism to convert virtual address to physical address.  The value in the base register is added to every address generated by a user process which is treated as offset at the time it is sent to memory. For example, if the base
  • 4. register value is 10000, then an attempt by the user to use address location 100 will be dynamically reallocated to location 10100.  The user program deals with virtual addresses; it never sees the real physical addresses. Swapping Swapping is a mechanism in which a process can be swapped temporarily out of main memory to a backing store , and then brought back into memory for continued execution. Backing store is a usually a hard disk drive or any other secondary storage which fast in access and large enough to accommodate copies of all memory images for all users. It must be capable of providing direct access to these memory images. Major time consuming part of swapping is transfer time. Total transfer time is directly proportional to the amount of memory swapped. Let us assume that the user process is of size 100KB and the backing store is a standard hard disk with transfer rate of 1 MB per second. The actual transfer of the 100K process to or from memory will take 100KB / 1000KB per second = 1/10 second = 100 milliseconds
  • 5. Memory Allocation Main memory usually has two partitions  Low Memory -- Operating system resides in this memory.  High Memory -- User processes then held in high memory. Operating system uses the following memory allocation mechanism. S.N. Memory Allocation Description 1 Single- allocation In this type of allocation, relocation- register scheme is used to protect user processes from each other, and from changing operating- system code and
  • 6. data. Relocation register contains value of smallest physical address whereas limit register contains range of logical addresses. Each logical address must be less than the limit register. 2 Multiple-partition allocation In this type of allocation, main memory is divided into a number of fixed-sized partitions where each partition should contain only one process. When a partition is free, a process is selected from the input queue and is loaded into the free partition. When the process terminates, the partition becomes available for another process. Fragmentation As processes are loaded and removed from memory, the free memory space is broken into little pieces. It happens after sometimes that processes can not be allocated to memory blocks considering their small size and memory blocks remains unused. This problem is known as Fragmentation.
  • 7. Fragmentation is of two types S.N. Fragmentation Description 1 External fragmentation Total memory space is enough to satisfy a request or to reside a process in it, but it is not contiguous so it can not be used. 2 Internal fragmentation Memory block assigned to process is bigger. Some portion of memory is left unused as it can not be used by another process. External fragmentation can be reduced by compaction or shuffle memory contents to place all free memory together in one large block. To make compaction feasible, relocation should be dynamic. Paging External fragmentation is avoided by using paging technique. Paging is a technique in which physical memory is broken into blocks of the same size called pages (size is power of 2, between 512 bytes and 8192 bytes). When a process is to be executed, it's corresponding pages are loaded into any available memory frames. Logical address space of a process can be non-contiguous and a process is allocated physical memory whenever the free memory frame is available. Operating system keeps track of all free frames. Operating system needs n free frames to run a program of size n pages. Address generated by CPU is divided into
  • 8.  Page number (p) -- page number is used as an index into a page table which contains base address of each page in physical memory.  Page offset (d) -- page offset is combined with base address to define the physical memory address. Following figure show the paging table architecture.
  • 9. Segmentation Segmentation is a technique to break memory into logical pieces where each piece represents a group of related information. For example ,data segments or code segment for each process, data segment for operating system and so on. Segmentation can be implemented using or without using paging. Unlike paging, segment are having varying sizes and thus eliminates internal fragmentation. External fragmentation still exists but to lesser extent.
  • 10. Address generated by CPU is divided into  Segment number (s) -- segment number is used as an index into a segment table which contains base address of each segment in physical memory and a limit of segment.  Segment offset (o) -- segment offset is first checked against limit and then is combined with base address to define the physical memory address.
  • 11.
  • 12. File System A file can be "free formed", indexed or structured collection of related bytes having meaning only to the one who created it. Or in other words an entry in a directory is the file. The file may have attributes like name, creator, date, type, permissions etc. File Structure A file has various kinds of structure. Some of them can be : Simple Record Structure with lines of fixed or variable lengths. Complex Structures like formatted document or reloadable load files. No Definite Structure like sequence of words and bytes etc. Attributes of a File Following are some of the attributes of a file : Name . It is the only information which is in human-readable form. Identifier. The file is identified by a unique tag(number) within file system. Type. It is needed for systems that support different types of files. Location. Pointer to file location on device. Size. The current size of the file. Protection. This controls and assigns the power of reading, writing, executing. Time, date, and user identification. This is the data for protection, security, and usage monitoring.
  • 13. File Access Methods The way that files are accessed and read into memory is determined by Access methods. Usually a single access method is supported by systems while there are OS's that support multiple access methods. Sequential Access Data is accessed one record right after another is an order. Read command cause a pointer to be moved ahead by one. Write command allocate space for the record and move the pointer to the new End Of File. Such a method is reasonable for tape. Direct Access This method is useful for disks. The file is viewed as a numbered sequence of blocks or records. There are no restrictions on which blocks are read/written, it can be dobe in any order. User now says "read n" rather than "read next". "n" is a number relative to the beginning of file, not relative to an absolute physical disk location. Indexed Sequential Access It is built on top of Sequential access. It uses an Index to control the pointer while accessing files. What is a Directory? Information about files is maintained by Directories. A directory can contain multiple files. It can even have directories inside of them. In Windows we also call these directories as folders.
  • 14. Following is the information maintained in a directory : Name : The name visible to user. Type : Type of the directory. Location : Device and location on the device where the file header is located. Size : Number of bytes/words/blocks in the file. Position : Current next-read/next-write pointers. Protection : Access control on read/write/execute/delete. Usage : Time of creation, access, modification etc. Mounting : When the root of one file system is "grafted" into the existing tree of another file system its called Mounting.
  • 15. Name: Mohammad Hussain Ahmady ID:15BCA080