Disk Management in OS
Overview
Disk Management is an important functionality provided by the Operating System which can be used to create, delete, format disk partitions, and much more. It enables users to manage and view the different disks and functions like viewing, creating, deleting, and shrinking the partitions associated with the disk drives.
What Is Disk Management in OS?
As we know, an operating system provides four major management, namely - process management, file management, and disk management, device management, memory management.
Let's learn about Disk Management in detail.
Disk Management is an important built-in utility or functionality provided by the Operating System that can be used to create, delete, format disk partitions, and much more. There are several methods to access Disk Management in different Operating Systems.
Methods to Access Disk Management in OS
Let's learn about the steps to access disk management in different operating systems.
Note: > resembles next step.
-
In Windows Operating System:
- Using Run Box: Click on Start Button > Click on Run > Type diskmgmt.msc > Click OK. The Disk Management will open.
-
In Linux Operating System: There are several commands used to check Disk Partitions and Disk Space on the Linux operating system.
- Some of them are mentioned below: a. fdisk b. sfdisk c. cfdisk d. parted e. df
-
In Mac Operating System:
- Using Launchpad: Click on Launchpad Icon > Type Disk Utility "> "Click on Disk Utility Icon. The Disk Utility will open.
What Does Disk Management do?
Disk Management is one of the most important facilities of the Operating System that enables its users to manage and view the different disks present in the computer system. Disk Management also enables users to perform different functions like viewing, creating, deleting, and shrinking the partitions associated with the disk drives.
Some of the other functions of Disk Management are:
- Disk Management helps to format disk drives.
- Disk Management enables the user to rename a disk.
- Disk Management also enables the user to change the file system of a disk drive.
- Using Disk Management, the user can assign a Drive Letter to a disk. For example, C Drive or D Drive, etc. can be found in Windows File System.
Unix File System
Because everything in the UNIX operating system is considered a file, the file system is a critical component. In the UNIX operating system, the file system is a logical method of storing, organizing, and managing large amounts of data.
The files are organized into directories or folders. The UNIX operating system organizes the files and folders in a hierarchal structure known as directory tree because the structure looks similar to a tree(shown below in the figure).
The main or top directory is known as the root directory, which is represented using the "/"symbol. Let's briefly know about some of the most important child directories of the root directory:
- "/bin ": "/bin "directory stands for binaries, and it contains the executable file commands that may be used by the system administrator and by users.
- "/boot ": "/boot "directory contains all the necessary files for booting or starting the system.
- "/dev ": "/dev "directory stands for devices, and it is the location of special or device files like peripheral devices.
Note: A peripheral device is any auxiliary device such as a mouse or keyboard.
- "/etc": /etc directory contains system databases and configuration files.
- "/home ": "/home "directory is the directory for a particular user of the system.
- "/lib ": "/lib "directory contains all helpful library files used by the system like system libraries, kernel modules, or device drivers.
- "/mnt ": "/mnt "directory stands for the mount, and it contains file-system mount points like CD or DVD drives, etc.
- "/proc ": "/proc "directory contains files and information that are related to system processes.
- /root: /root is not same as "/". "/root "is the home directory for a superuser account that has system administrator rights.
Note: A root user has unrestricted access to all commands, files, directories, and resources.
- "/sbin ": "/sbin "directory contains the executable files and administrative tools that are available only to the root user.
- "/tmp ": /tmp directory stands for temporary, and as the name suggests, it contains temporary files.
- "/usr ": /usr is one of the most important directories in the system, which contains all the user binaries, their documentation, libraries, etc.
File allocation and Access
File Allocation helps in allocating, managing, and organizing the files present in the system efficiently. The main aim is the effective utilization of system storage and faster file access. There are mainly three types of file allocation techniques:
- Contiguous or Continuous File Allocation: Each file occupies a continuous set of blocks on the Disk.
- Linked File Allocation: Each file is considered to be a linked list of data blocks. Hence files can be scattered anywhere in the memory.
- Indexed File Allocation: A special block known as an index block is used to store pointers. The pointer will point to all the blocks occupied by a file.
Disk Scheduling Algorithms
Disk Scheduling or I/O Scheduling is the process of managing the I/O requests. Disk Scheduling Algorithms are different techniques used to manage these I/O requests. There are six types of disk scheduling algorithms. Let's learn about them.
FCFS Algorithm:
FCFS is one of the simplest algorithms, which stands for First Come First Serve. As the name suggests, the I/O request that has come first will be served first. So, it serves the I/O requests in the order of their arrival.
Advantages and Disadvantages of FCFS:
- Every I/O request gets served; hence, FCFS is a fair algorithm.
- FCFS is not an optimized algorithm as it does not consider serving the Time and priority of the requests. Hence, it may not provide the best possible service.
Note: Seek Time is the Time taken by the hard disk controller to locate a specific piece of the stored data.
SSTF Algorithm:
SSTF is another simple algorithm that stands for Shortest Seek Time First. As the name suggests, the I/O requests having the least seek Time are served first.
Advantages and Disadvantages of SSTF:
- The seek Time of every request is calculated in advance, and a queue is used to maintain them as per their seek Time. Hence, SSTF has a better response time than FCFS.
- Since SSTF has a better response time, it increases the throughput (amount of work completed in a unit of Time) of the system.
- SSTF is not the most optimized algorithm as it suffers from the overhead of calculating the seek time in advance.
Note: Disk arm points to a particular location in the storage.
SCAN and C-SCAN Algorithm
The SCAN algorithm moves the disk arm in a particular direction and serves the I/O requests coming in its path. The DiskDisk then reverses its direction and serves the I/O requests present in the path. Since the movement of the DiskDisk is like an elevator, it is also known as the Elevator Algorithm.
In the C-SCAN or Circular-SCAN algorithm, the disk arm does not reverse its direction. It simply goes to the other end of the Disk and starts serving the requests from there.
Advantages and Disadvantages of SCAN and C-SCAN:
- SCAN and C-SCAN provide average response time and high throughput.
- One of the major disadvantages of these algorithms is the long waiting time for the requests for the locations that are just visited by the disk arm.
LOOK and C-LOOK Algorithm:
The LOOK scheduling algorithm works somewhat similarly to the SCAN algorithm. In the LOOK Algorithm, the disk arm reverses its direction from the last served request. Hence, the LOOK algorithm prevents useless delay in the movement of the Disk to the last.
In the C-LOOK or Circular-LOOK algorithm, the disk arm does not reverse its direction from the last request. It simply goes to the other end's last request and starts serving the requests from there.
Advantages and Disadvantages of LOOK and C-LOOK:
- The LOOK algorithm does not cause the head to move till the end, hence saving time.
- The LOOK algorithm has a better response time than the SCAN algorithm.
- One of the disadvantages of these algorithms is the overhead of finding the end request.
Other lesser-used Disk Scheduling Algorithms are:
- RSS: RSS stands for Random Scheduling, and as the name suggests, RSS selects a random I/O request and serves it.
- LIFO: LIFO stands for Last In First Out. So, the newest request is serviced before any other request.
Spooling and Buffering
Operating System improves the performance and efficiency of the computer by using the temporary memory space or buffer inside the main memory. We have two types of temporary memory space, namely:
- Spooling
- Buffering
Spooling
SPOOL or Simultaneous Peripheral Operation Online is an acronym for Spooling. Spooling is a temporary memory space used to store the tasks for a system. The tasks are stored until the system is ready to accept or execute new tasks. Spooling considers the DiskDisk as a large buffer that can store many jobs. The basic spooling can be seen in the image below:
Buffering
Buffering is the storing of data temporarily in the buffer so that the data transfer rate between the sender and the receiver is matched. If the sender's transmission speed is slower than the receiver's, then the buffer is created in the main memory of the receiver. On the other hand, if the receiver's transmission speed is slower than the transmitter's, then the buffer is created in the main memory of the transmitter. The basic buffering can be seen in the image below:
Conclusion
- Disk Management is an important functionality provided by the Operating System that can be used to create, delete, and format disk partitions, and much more.
- Disk Management enables users to view, create, delete, and shrink the partitions associated with the disk drives.
- The file system is considered a central component because of everything in the UNIX operating system.
- The file system in the UNIX operating system is a logical method of storing and managing huge amounts of information.
- The UNIX operating system organizes its files and directories in a multi-level hierarchal structure known as a directory tree.
- To manage the Input/Output requests on a system, the operating system uses different Disk Scheduling Algorithms.
- Spooling is a buffer that is used to hold the tasks for a system until the system is ready to accept another task.
- Buffering is the storing of data temporarily in the buffer so that the data transfer rate between the sender and the receiver is matched.