OSY2 Microproject
OSY2 Microproject
A Micro-Project Report On
Submitted for
MSBTE, MUMBAI
Academic Year
(2023-24)
1
Department of Information Technology
CERTIFICATE
2
Department of Information Technology
TABLE OF CONTENTS
2 5
Introduction
3 Action Plan: 6
9 Program 14
10 Output 15
13 Conclusion 17
14 References 18
3
Department of Information Technology
Abstract (AIM)
In this micro project we were given the task to display Linux Utilities With its output and we learn the
Free space management techniques. We have attempted to use the most basic Linux utilities to
make this project successful. We can do the basic work and advanced work thought its terminal.
In this micro project we were given the task to display Linux utilities with its output and we learn the the
Free space management techniques. We have attempted to use the most basic Linux utilities to make this
project successful.
4
Department of Information Technology
Introduction
Free space management is a critical aspect of operating systems as it involves managing the available
storage space on the hard disk or other secondary storage devices. The operating system uses various
techniques to manage free space and optimize the use of storage devices. Here are some of the
commonly used free space management techniques:
1. Linked Allocation: In this technique, each file is represented by a linked list of disk blocks. When
a file is created, the operating system finds enough free space on the disk and links the blocks of
the file to form a chain. This method is simple to implement but can lead to fragmentation and
wastage of space.
2. Contiguous Allocation: In this technique, each file is stored as a contiguous block of disk space.
When a file is created, the operating system finds a contiguous block of free space and assigns it to
the file. This method is efficient as it minimizes fragmentation but suffers from the problem of
external fragmentation.
3. Indexed Allocation: In this technique, a separate index block is used to store the addresses of all
the disk blocks that make up a file. When a file is created, the operating system creates an index
block and stores the addresses of all the blocks in the file. This method is efficient in terms of
storage space and minimizes fragmentation.
4. File Allocation Table (FAT): In this technique, the operating system uses a file allocation table to
keep track of the location of each file on the disk. When a file is created, the operating system
updates the file allocation table with the address of the disk blocks that make up the file. This
method is widely used in Microsoft Windows operating systems.
5. Volume Shadow Copy: This is a technology used in Microsoft Windows operating systems to
create backup copies of files or entire volumes. When a file is modified, the operating system
creates a shadow copy of the file and stores it in a separate location. This method is useful for data
recovery and protection against accidental file deletion.
Overall, free space management is a crucial function of operating systems, as it ensures that storage
devices are utilized efficiently and effectively.
The system keeps tracks of the free disk blocks for allocating space to files when they are created.
Also, to reuse the space released from deleting the files, free space management becomes crucial. The
system maintains a free space list which keeps track of the disk blocks that are not allocated to some
file or directory. The free space list can be implemented mainly as:
5
Department of Information Technology
Action Plan
6
Department of Information Technology
First we created an action plan by discussing among ourselves about the project.
By applying our logic we learn the Free space management techniques
Next we runs the basic Linux utilities on the ubuntu terminal.
We implemented the designed of this project with our logic.
7
Department of Information Technology
2
Compiler Linux -
-
Hardware Requirements
3 Processor
Desktop PC/Laptop Pentium IV 1
4
RAM 512 MB 1 module
6
Hard-Disk 40 GB 1
7 AT & T
Mouse compatible 1
mouse
8 Standard
Keyboard QWERTY 1
keyboard
8
Department of Information Technology
Bit Vector
Linked list
1. Bit map
A Bitmap or Bit Vector is series or collection of bits where each bit corresponds to a disk block. The
bit can take two values: 0 and 1: 0 indicates that the block is allocated and 1 indicates a free block.
The given instance of disk blocks on the disk in Figure 1 (where green blocks are allocated) can be
represented by a bitmap of 16 bits as: 0000111000000110.
9
Department of Information Technology
Advantages
It is simple to understand.
It is an efficient method.
It occupies less memory.
Disadvantages
For finding a free block, the operating system may need to search the entire bit vector.
To detect the first 1 in a word that is not 0 using this method, special hardware support is needed.
Keeping the bit vector in the main memory is possible for smaller disks but not for larger ones.
For example, a 1.3 GB disk with 512-byte blocks would need a bit vector of over 332 KB to
track its free blocks. Giving away 332 KB just to maintain its free block space is not so efficient
in the long run.
1. Linked List
In this approach, the free disk blocks are linked together i.e. a free block contains a pointer to the next
free block. The block number of the very first disk block is stored at a separate location on disk and is
also cached in memory.
In Figure, the free space list head points to Block 5 which points to Block 6, the next free block and so
on. The last free block would contain a null pointer indicating the end of free list. A drawback of this
method is the I/O required for free space list traversal.
10
Department of Information Technology
Here are some advantages and disadvantages of free space management techniques in operating
systems:
Advantages:
1. Efficient use of storage space: Free space management techniques help to optimize the use of
storage space on the hard disk or other secondary storage devices.
2. Easy to implement: Some techniques, such as linked allocation, are simple to implement and
require less overhead in terms of processing and memory resources.
3. Faster access to files: Techniques such as contiguous allocation can help to reduce disk
fragmentation and improve access time to files.
Disadvantages:
1. Fragmentation: Techniques such as linked allocation can lead to fragmentation of disk space,
which can decrease the efficiency of storage devices.
2. Overhead: Some techniques, such as indexed allocation, require additional overhead in terms of
memory and processing resources to maintain index blocks.
3. Limited scalability: Some techniques, such as FAT, have limited scalability in terms of the number
of files that can be stored on the disk.
4. Risk of data loss: In some cases, such as with contiguous allocation, if a file becomes corrupted or
damaged, it may be difficult to recover the data.
5. Overall, the choice of free space management technique depends on the specific requirements of
the operating system and the storage devices being used. While some techniques may offer
advantages in terms of efficiency and speed, they may also have limitations and drawbacks that
need to be considered.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech
landscape, Geeks for Geeks Courses are your key to success. We provide top-quality content at
affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the
millions we've already empowered, and we're here to do the same for you. Don't miss out - .
11
Department of Information Technology
1. Ordinary files
An ordinary file is a file on the system that contains data, text, or program instructions.
Used to store your information, such as some text you have written or an image you have
drawn. This is the type of file that you usually work with.
Always located within/under a directory file.
Do not contain other files.
In long-format output of ls -l, this type of file is specified by the “-” symbol.
2. Directories
Directories store both special and ordinary files. For users familiar with Windows or Mac OS, UNIX
directories are equivalent to folders. A directory file contains an entry for every file and subdirectory
that it houses. If you have 10 files in a directory, there will be 10 entries in the directory. Each entry
has two components. (1) The Filename (2) A unique identification number for the file or directory
(called the in ode number)
3. Special Files
12
Department of Information Technology
Used to represent a real physical device such as a printer, tape drive or terminal, used for Input/Output
(I/O) operations. Device or special files are used for device Input/Output(I/O) on UNIX and Linux
systems. They appear in a file system just like an ordinary file or a directory. On UNIX systems there
are two flavors of special files for each device, character special files and block special files :
When a character special file is used for device Input/Output(I/O), data is transferred one
character at a time. This type of access is called raw device access.
When a block special file is used for device Input/Output(I/O), data is transferred in large
fixed-size blocks. This type of access is called block device access.
For terminal devices, it’s one character at a time. For disk devices though, raw access means
reading or writing in whole chunks of data – blocks, which are native to your disk.
13
Department of Information Technology
Program
14
Department of Information Technology
Output
15
Department of Information Technology
This project is well suited for the Linux utilities. We here by conclude that where able
to perform the micro-project task assigned by our teacher.
Out of the many features available, the project demonstrates some popular and
commonly used Linux commands. In this project we learn Linux basic Commands
with its output.
Result:
Displayed the Linux utilities with its output Free Space Management Techniques And Paging.
Also understood the Commands of it.
16
Department of Information Technology
Conclusion
In this article, we studied free space management in operating systems. We discussed four methods of
doing free space management in the operating system. These are - bit vector or bit map, linked list,
grouping, and counting. This article thoroughly discusses all the methods along with their advantages
and disadvantages. You can also find other articles on the operating system topics on
Coding Ninjas Studio.
17
Department of Information Technology
Reference
https://www.geeksforgeeks.org/shell-program-to-calculate-the-factorial-of-a-number/
https://www.log2base2.com/shell-script-examples/loop/shell-script-to-find-factorial-of-a-
number.html
https://www.codingninjas.com/studio/library/free-space-management#:~:text=free%20space
%20list.-,Commonly%20used%20free%20space%20management%20techniques,contiguous
%20block%20in%20disk%20space.
https://bash.cyberciti.biz/file-management/find-file-permission-script/
18