You are on page 1of 29

TM2033

Platform Technology

Lecture # 7
Memory and File Management

By Dr. Faizan Qamar


THE JOURNEY

1 Computer 2 CPU, Memory 3 ISA 4 Computer


System System and
Performance
Input Output

8 Operating
5 Operating 6 Process 7 Memory and File System
System Management Management Design

9 Mobile Computing 10 Parallel Computing


Platform
OUTLINE FOR MEMORY
MANAGEMENT

• MEMORY MANAGEMENT
• MEMORY ADDRESSES
• MEMORY MANAGEMENT UNIT
• SWAPPING
• PAGING
• VIRTUAL MEMORY
MEMORY MANAGEMENT

• Memory management is the functionality of an operating system


which handles or manages primary memory and moves
processes back and forth between main memory and disk during
execution.
• Memory management keeps track of each and every memory
location, regardless of 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 ADDRESSES
 Physical addresses refer to hardware addresses of physical memory.
 Virtual addresses refer to the virtual store viewed by the process, is also
called logical address.
• Logical Address is generated by CPU whereas Physical Address
location is in memory management unit (MMU).

• The user can use the logical address to access the physical address. The
user can always access the physical address indirectly but can never
access it directly.
MEMORY MANAGEMENT UNIT (MMU)
• The runtime 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 or


vice versa.
SWAPPING
 Swapping is a mechanism in which a process can be swapped
temporarily out of main memory (or move) to secondary storage (disk)
and make that memory available to other processes. At some later
time, the system swaps back the process from the secondary storage
to main memory.
 Backing store is a hard disk or some other secondary storage device
that should be big enough in order to accommodate copies of all
memory images for all users. It is also capable of offering direct
access to these memory images.
 Though performance is usually affected by swapping process, but it
helps in running multiple and big processes in parallel.
SWAPPING Cont..

 The procedure by which any process gets removed from the hard
disk and placed in the main memory or RAM commonly known
as Swap In.
 On the other hand, Swap Out is the method of removing a process
from the main memory or RAM and then adding it to the Hard Disk.
BENEFIT OF SWAPPING

• The swapping technique mainly helps the CPU to manage multiple


processes within a single main memory.
• It helps to get better utilization of memory.
• Minimum wastage of CPU time on completion so it can easily be
applied to a priority-based scheduling method to improve its
performance.
• This technique helps to create and use virtual memory.
DISADVANTAGE:
• External fragmentation: It is a weakness of certain storage
allocation algorithms, when they fail to order memory used by
programs efficiently. It has arisen when free memory is separated into
small blocks and is interspersed by allocated memory.
• If the computer system loses power at the time of high swapping
activity, then the user might lose all the information related to the
program.
PAGING
 Paging is a storage mechanism that allows OS to retrieve
processes from the secondary storage into the main memory in
the form of pages.
 The main memory is divided into small fixed-size blocks of physical
memory, which is called frames.
 The size of a frame should be kept the same as that of a page to
have maximum utilization of the main memory and to avoid external
fragmentation.
 When a process is scheduled for execution, its pages are loaded
into any available memory frames from the backing store.
BENEFIT OF PAGING

 Eliminates EXTERNAL FRAGMENTATION.


 Easy to use memory management algorithm.
 Easy to move data for equal-sized pages and page frames.
 Just swap out page least likely to be used.

DISADVANTAGE:
 Longer memory access times (page table lookup)
 Larger page table lookup cause limit virtual memory size
DIFFERENCE BETWEEN PAGING AND
SWAPPING
Swapping Paging

It is a technique of memory
It is procedure of copying out
allocation (from the secondary
the entire process.
storage into the main memory).

Swapping occurs when whole Paging occurs when some part


process is transferred to disk. of process is transferres to disk.

In this process, the pages are


In this process is swapped
loaded into any available
temporarily from main memory
memory frames from the
to secondary memory.
backing store.
VIRTUAL MEMORY

 Virtual Memory is a storage mechanism which offers user an illusion of


having a very big main memory. It is done by treating a part of secondary
memory as the main memory.
 In Virtual memory, the user can store processes with a bigger size than
the available main memory.
 Therefore, instead of loading one long process in the main memory, the OS
loads the various parts of more than one process in the main memory.
Virtual memory is mostly implemented with demand.
 Whenever your computer doesn't have space in the physical memory, it
writes what it needs to remember to the hard disk in a swap file as virtual
memory.
 If a computer running Windows needs more memory/RAM, then installed in
the system, it uses a small portion of the hard drive for this purpose.
BENEFIT OF VIRTUAL MEMORY

 Large programs can be written, as the virtual space available is


huge compared to physical memory.
 Less I/O required leads to faster and easy swapping of processes.
 More physical memory available, as programs are stored on
virtual memory, so they occupy very less space on actual physical
memory.
 Therefore, the Logical address space can be much larger than that
of physical address space.
DISADVANTAGE:
 The performance of Virtual memory is not fast as that of RAM.
 If a system is using virtual memory, then applications may run
slower.
FILE MANAGEMENT
OUTLINE FOR FILE MANAGEMENT

• FILE SYSTEM
• FILE MANAGEMENT
• FUCTION OF FILE MANAGEMENT
• FILE ARTRIBUTES
• FILE TYPE
• FILE DIRECTORIES
• TERMINOLOGIES
FILE SYSTEM

• A file is a collection of correlated information which is recorded on


secondary or non-volatile storage like magnetic disks, optical
disks, and tapes.
• It is a method of data collection that is used as a medium for
giving input and receiving output from that program.
• In general, a file is a sequence of bits, bytes, or records whose
meaning is defined by the file creator and user.
• Every File has a logical location where they are located for
storage and retrieval.
FILE MANAGEMENT

• File management is defined as the process of manipulating


files in computer system, its management includes the process
of creating, modifying and deleting the files.
• It helps to store files on disk or other storage so it do not
disappear when a user logs off.
• It manages the files names and its information associated
with access permission that permits controlled sharing for
each users.
• It helps to minimizes the chances of lost or destroyed
data.
• It helps to stores the files in separate folders known as
directories. These directories help users to search file
quickly or to manage the files according to their types or
uses.
FUNCTION OF FILE MANAGEMENT
The function of file management in operating system (OS) is based on the
following concepts:

1. File Attributes
It specifies the characteristics of the files such as type, date of last modification,
size, location on disk etc. file attributes help the user to understand the value and
location of files.

2. File Operations
It specifies the task that can be performed on a file such as opening and closing
of file.

3. File Access Permission


It specifies the access permissions related to a file such as read and write.

4. File Systems
It specifies the logical method of file storage in a computer system. Some of the
commonly used files systems include FAT and NTFS. FAT stands for File Allocation
Table and NTFS stands for New Technology File System.
FILE ATTRIBUTES
A file has a name and data. Moreover, it also stores meta information like file
creation date and time, current size, last modified date, etc. All this information
is called the attributes of a file system.

Here, are some important File attributes used in OS:

•Name: It is the only information stored in a human-


readable form.
•Identifier: Every file is identified by a unique tag
number within a file system known as an identifier.
•Location: Points to file location on device.
•Type: This attribute is required for systems that support
various types of files.
•Size. Attribute used to display the current file size.
•Protection. This attribute assigns and controls the
access rights of reading, writing, and executing the file.
•Time, date and security: It is used for protection,
security, and also used for monitoring
FILE TYPE
FILE DIRECTORIES
A single directory may or may not contain multiple files. It can also have
sub-directories inside the main directory. Information about files is
maintained by Directories. In Windows OS, it is called folders.
Following is the information which is maintained in a directory:
• Name: The name which is displayed to the user.
• Type: Type of the directory.
• Position: Current next-read/write pointers.
• Location: Location on the device where the file header is stored.
• Size: Number of bytes, block, and words in the file.
• Protection: Access control on read/write/execute/delete.
• Usage: Time of creation, access, modification
TERMINOLOGY 1
1. Drive:
• A drive is a computer storage device that
holds information. It is the top-level
location (or "Root" directory) for file
storage.
• Drives are usually designated with a letter
such as C:\ (which is typically the hard
drive of the computer you are working
on).
• Other examples of drives would be the
network drive on campus (which is the Z:\
drive) and external USB drives that you
may use such as a Flash or Thumb Drive.
• The letters of these drives vary
depending on the computer that you are
using.
TERMINOLOGY 2
2. Folder:
• A folder is a storage location within a drive. Another term for a folder is a "directory", however
the term "folder" has become the term of choice for most.
• A folder can consist of files or additional folders (called "Subfolders").
• Users can create folders that accommodate their method of organization.
TERMINOLOGY 3
3. File Extension
• The file extension appears after the period in the filename and is used to indicate the type
of format the file is in.
• For example the file extension ".docx" indicates that the file is a Microsoft Word document.
• A complete filename using this extension may look like this: "Letter to Mom.docx“
TERMINOLOGY 4
4. Path
• The path refers to the exact location of the file and indicates to the computer user the
entire sequence that must be followed to find the file.
• The path begins with the drive and then includes any folders or subfolders that house the
file.
• In the screenshot above, a Microsoft Word document named "paper1.docx" that is stored
in the "Papers" folder would have the path: C:\English\Papers\paper1.docx.
TERMINOLOGY 5
5. Zipping (Compressing)
• Zipping is the process of packaging a folder that contains multiple files into a single file (called
a "Compressed" or "Zipped" folder).
• In addition to combining multiple files into one, the resulting zipped folder typically takes up
less storage space.
• Knowing how to zip files is especially useful when you need to send multiple files to someone
either (example: through email or an online course).
TERMINOLOGY 6
6. File Management Utility
• A File Management Utility is a computer program that provides a user with a graphical
interface.
• This helps to organize files and folders on a computer's storage device.
• Below figure shows you about the searching the files in Drive C.
THANK YOU

You might also like