Posts

Introduction to file system in OS

Introduction to 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. A file system is a process that manages how and where data on a storage disk, typically a hard disk drive(HDD), is stored , accessed and managed. It is a logical disk component that manages a disk's internal operations as it relates to a computer and is abstract to a human user. A file system typically manages operations such as storage management , file naming , Directories /folders , metadata , access rule and privileges. Commonly used file system include file allocation table 32(FAT), new technology file system(NTFS), and hierarchical file system (HFS). File Structure A File Structure should be according to a required format that the operating system can understa

Concept of file and directories in OS

Image
      Concept of file and directories Introduction to file:- A file is collection of specific information stored in the memory of computer system.  File management is defined as the process of manipulating files in computer system, it management includes the process of creating, modifying and deleting the files . In general file is sequence of bits , bytes ,lines or records. The following are some of the  tasks performed by file management of operating system of any computer system : It helps to create new files in computer system and placing them at the specific locations. It helps in easily and quickly locating these files in computer system. It makes the process of sharing of the files among different users very easy and user friendly. 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. It helps the user to modify the data of files or to mo

Garbage collection in OS

Garbage collection (GC) is a dynamic approach to automatic memory management and heap allocation that processes and identifies dead memory blocks and reallocates storage for reuse. The primary purpose of garbage collection is to reduce memory leaks. GC implementation requires three primary approaches, as follows: Mark-and-sweep - In process when memory runs out, the GC locates all accessible memory and then reclaims available memory. Reference counting - Allocated objects contain a reference count of the referencing number. When the memory count is zero, the object is garbage and is then destroyed. The freed memory returns to the memory heap. Copy collection - There are two memory partitions. If the first partition is full, the GC locates all accessible data structures and copies them to the second partition, compacting memory after GC process and allowing continuous free memory. Some programming languages and platforms with built-in GC (e.g., Java, Lisp, C# and .Net) self-m

Compaction in OS

Image
                    Compaction Compaction is a process in which the free space is collected in a large memory chunk to make some space available for processes. - In memory management, swapping creates multiple fragments in the memory because of the processes moving in and out. - Compaction refers to combining all the empty spaces together and processes. - Compaction helps to solve the problem of fragmentation, but it requires too much of CPU time. - It moves all the occupied areas of store to one end and leaves one large free space for incoming jobs, instead of numerous small ones. - In compaction, the system also maintains relocation information and it must be performed on each new allocation of job to the memory or completion of job from memory. - compaction is used  to minimize the probability of external fragmentation. In compaction, all the free partitions are made contiguous and all the loaded partitions are brought together. -By applying this technique, we can store the

Demand paged memory management in OS

Image
Demand Paging : The process of loading the page into memory on demand (whenever page fault occurs) is known as demand paging. The process includes the following steps : If CPU try to refer a page that is currently not available in the main memory, it generates an interrupt indicating memory access fault. The OS puts the interrupted process in a blocking state. For the execution to proceed the OS must bring the required page into the memory. The OS will search for the required page in the logical address space. The required page will be brought from logical address space to physical address space. The page replacement algorithms are used for the decision making of replacing the page in physical address space. The page table will updated accordingly. The signal will be sent to the CPU to continue the program execution and it will place the process back into ready state. Hence whenever a page fault occurs these steps are followed by the operating system and the required page i

Segmented paged memory management In OS

Image
Segmented Paging- Segmented paging is a scheme that implements the combination of segmentation and paging. Working- In segmented paging, Process is first divided into segments and then each segment is divided into pages. These pages are then stored in the frames of main memory. A page table exists for each segment that keeps track of the frames storing the pages of that segment. Each page table occupies one frame in the main memory. Number of entries in the page table of a segment = Number of pages that segment is divided. A segment table exists that keeps track of the frames storing the page tables of segments. Number of entries in the segment table of a process = Number of segments that process is divided. The base address of the segment table is stored in the segment table base register.  Pure segmentation is not very popular and not being used in many of the operating systems. However, Segmentation can be combined with Paging to get the best features out of

Memory management|swapping| OS

Image
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. Though performance is usually affected by swapping process but it helps in running multiple and big processes in parallel and that's the reason  Swapping is also known as a technique for memory compaction . The total time taken by swapping process includes the time it takes to move the entire process to a secondary disk and then to copy the process back to memory, as well as the time the process takes to regain main memory. Let us assume that the user process is of size 2048KB and on a standard hard disk where swapping will take place has a data transfer rate around 1 MB per second. The actual transfer of the 1000K process to or from memory will take 2048KB / 1024KB per second = 2 seconds =