0% found this document useful (0 votes)
21 views7 pages

OS Unit IV QA

Question and answers for operating system exam prep.

Uploaded by

joviee313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views7 pages

OS Unit IV QA

Question and answers for operating system exam prep.

Uploaded by

joviee313
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Questions for 2 Marks

1. Define Fragmentation in memory management. Enlist the two types of


fragmentation.

o Fragmentation: Fragmentation occurs when memory space is used inefficiently,


causing waste and reducing capacity or performance. It is the state where free
memory space is divided into small blocks and is interspersed by allocated
memory.

o Types:

▪ Internal Fragmentation: Wasted space within allocated memory blocks.

▪ External Fragmentation: Wasted space between allocated memory


blocks.

2. What is the main difference between Fixed Partitioning and Variable Partitioning?

o Fixed Partitioning: Divides memory into fixed-sized partitions regardless of


process size. Each partition can hold exactly one process.

o Variable Partitioning: Divides memory into partitions dynamically, according to


the size of the process. Partitions are created to fit the process size exactly.

3. Draw the memory layout for Fixed Partitioning and Variable Partitioning.

o Fixed Partitioning:

o Variable Partitioning:
4. What is a page in the context of Paging?

o A page is a fixed-size block of data that is a unit of logical memory. In the context
of paging, memory is divided into pages of equal size, which are mapped to
physical memory frames.

5. Define logical and physical addresses in the context of memory management.

o Logical Address: An address generated by the CPU during program execution,


also known as a virtual address. It is a reference to a memory location
independent of the current assignment of data to memory.

o Physical Address: The actual address in physical memory (RAM) where data is
stored. It is the real location in memory hardware.

6. State the primary purpose of memory management in an operating system.

o The primary purpose of memory management is to efficiently allocate and


manage memory space for processes, ensuring that each process gets enough
memory to execute while optimizing the overall performance and utilization of
the system resources.

Questions for 4 Marks

1. Compare and contrast the three memory allocation strategies: First Fit, Best Fit,
and Worst Fit. Discuss their advantages and disadvantages.

o First Fit:

▪ Method: Allocates the first sufficiently large free block found.

▪ Advantages:

▪ Simple Implementation: Easy to implement and understand.

▪ Fast Allocation: Quick to find a free block, reducing search time.

▪ Disadvantages:

▪ Fragmentation: Can lead to external fragmentation as small


gaps are left after allocations.

▪ Inefficient Use of Space: May not utilize memory as efficiently


as other methods.

o Best Fit:

▪ Method: Allocates the smallest free block that is large enough to


accommodate the process.

▪ Advantages:

▪ Minimizes Wasted Space: Reduces the leftover space within


blocks.

▪ Efficient Memory Use: More efficient in utilizing memory for


processes.
▪ Disadvantages:

▪ Slow Allocation: Requires searching the entire list of free blocks,


which can be time-consuming.

▪ Fragmentation: Can lead to small, unusable fragments (external


fragmentation).

o Worst Fit:

▪ Method: Allocates the largest free block available.

▪ Advantages:

▪ Reduces Small Fragments: Leaves larger free blocks, which can


be more useful for future allocations.

▪ Simple Allocation: Easy to implement and understand.

▪ Disadvantages:

▪ Inefficient Space Utilization: Can leave large amounts of


unused space, leading to inefficient memory utilization.

▪ Slow Allocation: Requires searching the entire list of free blocks,


similar to Best Fit.

2. Differentiate between Paging and Segmentation.

o Paging:

▪ Method: Divides memory into fixed-size pages.

▪ Addressing: Logical address is divided into page number and offset.

▪ Fragmentation: Eliminates external fragmentation but can have internal


fragmentation.

▪ Example: A process is divided into pages of 4KB each, and these pages
are mapped to frames of 4KB in physical memory.

o Segmentation:

▪ Method: Divides memory into variable-sized segments based on logical


divisions such as functions, arrays, etc.

▪ Addressing: Logical address is divided into segment number and offset.

▪ Fragmentation: Can suffer from external fragmentation but eliminates


internal fragmentation.

▪ Example: A process might have segments for code, stack, heap, and
data, each of a different size.

3. Discuss fixed partitioning and variable partitioning in memory allocation. Provide


examples of each.

o Fixed Partitioning:
▪ Method: Memory is divided into fixed-sized partitions at system startup.

▪ Example: A system with 1GB of RAM may be divided into ten 100MB
partitions. A process requiring 80MB will be allocated one of these
partitions, leaving 20MB wasted (internal fragmentation).

▪ Advantages: Simple to implement, no overhead in managing partitions


during runtime.

▪ Disadvantages: Can lead to significant internal fragmentation and


inefficient memory utilization.

o Variable Partitioning:

▪ Method: Memory is divided into partitions dynamically based on the size


of the processes.

▪ Example: A process requiring 120MB will be allocated a 120MB partition.


If another process requires 200MB, it will be allocated exactly 200MB,
minimizing wasted space.

▪ Advantages: Reduces internal fragmentation as partitions are created to


fit the process size.

▪ Disadvantages: Can lead to external fragmentation and requires


complex memory management algorithms to manage free space.

Questions for 7 Marks

1. Describe the different Memory management techniques. What are the advantages
and disadvantages of each?

o Contiguous Memory Allocation:

▪ Method: Each process is allocated a single contiguous block of memory.

▪ Advantages:

▪ Simplicity: Easy to implement and understand.

▪ Efficient Access: Fast access as memory is contiguous.

▪ Disadvantages:

▪ Fragmentation: Can suffer from both internal and external


fragmentation.

▪ Fixed Partitioning Issues: Fixed partitioning can lead to


inefficient memory utilization.

o Paging:

▪ Method: Memory is divided into fixed-size pages which are mapped to


physical memory frames.

▪ Advantages:
▪ No External Fragmentation: Any free frame can be used for any
page.

▪ Efficient Memory Use: Allows for efficient allocation of memory.

▪ Disadvantages:

▪ Internal Fragmentation: Some memory within the allocated


page might remain unused.

▪ Overhead: Requires additional memory for page tables and


address translation.

o Segmentation:

▪ Method: Divides memory into segments based on logical divisions such


as modules, functions, etc.

▪ Advantages:

▪ Logical Grouping: Matches logical divisions of programs, making


memory management more intuitive.

▪ No Internal Fragmentation: Memory allocated exactly as


needed.

▪ Disadvantages:

▪ External Fragmentation: Can suffer from external


fragmentation.

▪ Complexity: Requires more complex memory management.

o Virtual Memory:

▪ Method: Uses disk space to extend physical memory, allowing


processes to execute even if they are partially loaded in memory.

▪ Advantages:

▪ Large Program Execution: Allows execution of large processes


that do not fit in physical memory.

▪ Efficient Memory Use: Improves overall system utilization and


responsiveness.

▪ Disadvantages:

▪ Performance Overhead: Disk access is slower than RAM,


leading to potential performance degradation.

▪ Thrashing: Excessive paging can lead to thrashing, where the


system spends more time paging than executing processes.
Questions for 12 Marks

1. Explain the concept of paging in memory management. Discuss how paging


addresses the issues of fragmentation, and provide examples to illustrate your
points.

o Concept of Paging:

▪ Definition: Paging is a memory management scheme that eliminates the


need for contiguous allocation of physical memory by dividing memory
into fixed-size pages.

▪ Mechanism:

▪ Logical Address: Divided into page number and offset.

▪ Physical Address: Corresponding frame number and offset.

▪ Page Table: Maintains the mapping of logical pages to physical


frames.

▪ Example: Logical address 0x1234 with page size 1024 bytes has page
number 1 and offset 0x234.

o Addressing Fragmentation:

▪ Internal Fragmentation: Paging can have minimal internal


fragmentation as some memory within the allocated page might remain
unused, but this is generally small.

▪ External Fragmentation: Paging eliminates external fragmentation since


any free frame can be used for any page, and the physical memory can
be fully utilized.

o Example:

▪ If a process requires 6KB and the page size is 1KB, the process will be
divided into 6 pages. These pages can be placed into any available
frames in physical memory, such as frame 2, frame 5, frame 8, etc.

o Advantages:

▪ Efficient Memory Use: Optimizes memory utilization by allowing non-


contiguous memory allocation.

▪ Flexibility: Processes can grow by simply allocating additional pages.

▪ Simplified Allocation: Easy to allocate and deallocate memory as free


frames can be reused.

o Disadvantages:

▪ Overhead: Requires additional memory for storing page tables.

▪ Performance: Additional overhead in address translation can impact


performance, although hardware support like TLBs (Translation
Lookaside Buffers) can mitigate this.

You might also like