Fragmentation

In operating systems, fragmentation refers to the phenomenon where memory or disk space is allocated inefficiently, resulting in wasted space. There are two types of fragmentation: external fragmentation and internal fragmentation.

External Fragmentation

External fragmentation occurs when there is enough total memory space to satisfy a request, but it is not contiguous. This happens when there are many small gaps in memory, resulting in the inability to allocate larger memory segments. This can lead to a significant decrease in system performance, as memory allocation requests take longer to process.

Internal Fragmentation

Internal fragmentation, on the other hand, occurs when memory is allocated in fixed-size blocks, and the size of the allocated block is larger than the actual size of the data being stored. This results in wasted memory space, as the unused portion of the allocated block cannot be used by any other process.

Differences Between Internal Fragmentation and External Fragmentation:

Internal FragmentationExternal Fragmentation
Memory is allocated in fixed-size blocksFree memory is not contiguous
Allocated memory blocks are larger than neededFree memory is fragmented into smaller blocks
Occurs when memory blocks are not fully utilizedOccurs when there are many small gaps of free memory
Results in waste of memory resourcesResults in inability to allocate memory
Can be addressed by using variable-size allocation schemes, such as segmentationCan be addressed by using dynamic memory allocation techniques, such as compaction
Mostly occurs in systems that use fixed-size allocation schemes, such as static memory allocationMostly occurs in systems that use dynamic memory allocation schemes, such as heap allocation

Solving Fragmentation Problem Using Paging

To solve the problem of fragmentation, operating systems use various techniques, one of which is paging. Paging is a memory management technique used by operating systems to handle virtual memory. The main idea behind paging is to divide physical memory into small fixed-size blocks called pages and divide the logical memory into small fixed-size blocks called frames.

When a process requests memory, the operating system allocates one or more pages to the process. The pages are assigned to frames in physical memory, and the process can access them through the page table. The page table maps the logical memory addresses to the physical memory addresses.

Paging solves the fragmentation problem by allocating memory in fixed-size pages, eliminating external fragmentation. Internal fragmentation is also reduced since the pages are allocated only in the required size. This results in efficient memory utilization and improves system performance.

Paging also offers other benefits, such as improved memory protection and sharing. The page table can be used to protect memory from unauthorized access and to share memory between multiple processes. Paging also allows the operating system to swap pages to disk, freeing up physical memory for other processes.


OS-2022

Q-1.

(a) Write are the functions of operating systems? write a note on multi programmed operating systems ?

(b) Distinguish between client server and peer to peer model of distributed systems .

Q-2.

(a) With a Neat Sketch, Describe the services that an Operating System provides to users, processes and other systems.

(b) What is meant by Storage Structure? Discuss Storage Hierarchy.

(c) Write the Advantages and Disadvantages of using the same system call interface for manipulating both Files and Devices.

Q-3.

(a) What are the criteria for evaluating the CPU scheduling algorithms? Why do we need it?

(b) Define process. Explain various steps involved in change of a process state with process state neat transition diagram.

Q-4.

(a) What is synchronization? Explain how semaphores can be used to deal with n-process critical problem.

(b) Define a thread. Give the benefits of multithreading. What resources are used when a thread is created?

Q-5.

(a) How dose deadlock avoidance differ from deadlock prevention? Write about deadlock avoidance algorithm in detail.

(b) Different between external fragmentation and internal fragmentation. How to solve the fragmentation using paging?

Q-6.

(a) What is the purpose of paging the page table? Consider the following page reference string 1,2,3,4,5,1,2,3,4,5 for a memory with three frames. How many page faults would LRU and FIFO replacement algorithm?

(b) What are the disadvantages of single contiguous memory allocation? Explain.

Q-7.

(a) Briefly explain about single-level, two-level and three Structured directories.

(b) What is disk scheduling? Explain the C-SCAN scheduling by giving an example.

Q-8.

(a) Interrupt and spooling.

(b) UNIX file system.

(c) Program and system threats.

JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.