Interview Preparation Exam  >  Interview Preparation Notes  >  Placement Papers - Technical & HR Questions  >  Unix Memory Management (Part- 1), UNIX Interview Questions

Unix Memory Management (Part- 1), UNIX Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation PDF Download

1. What is the difference between Swapping and Paging?

Swapping: Whole process is moved from the swap device to the main memory for execution. Process size must be less than or equal to the available main memory. It is easier to implementation and overhead to the system. Swapping systems does not handle the memory more flexibly as compared to the paging systems.

Paging: Only the required memory pages are moved to main memory from the swap device for execution. Process size does not matter. Gives the concept of the virtual memory. It provides greater flexibility in mapping the virtual address space into the physical memory of the machine. Allows more number of processes to fit in the main memory simultaneously. Allows the greater process size than the available physical memory. Demand paging systems handle the memory more flexibly.

2. What is major difference between the Historic Unix and the new BSD release of Unix System V in terms of Memory Management?

Historic Unix uses Swapping - entire process is transferred to the main memory from the swap device, whereas the Unix System V uses Demand Paging - only the part of the process is moved to the main memory. Historic Unix uses one Swap Device and Unix System V allow multiple Swap Devices.

3. What is the main goal of the Memory Management?

  1. It decides which process should reside in the main memory,
  2. Manages the parts of the virtual address space of a process which is non-core resident,
  3. Monitors the available main memory and periodically write the processes into the swap device to provide more processes fit in the main memory simultaneously.

4. What is a Map?

A Map is an Array, which contains the addresses of the free space in the swap device that are allocatable resources, and the number of the resource units available there.

Address  Units
      1      10,000

This allows First-Fit allocation of contiguous blocks of a resource. Initially the Map contains one entry - address (block offset from the starting of the swap area) and the total number of resources.

Kernel treats each unit of Map as a group of disk blocks. On the allocation and freeing of the resources Kernel updates the Map for accurate information.

5. What scheme does the Kernel in Unix System V follow while choosing a swap device among the multiple swap devices?

Kernel follows Round Robin scheme choosing a swap device among the multiple swap devices in Unix System V.

6. What is a Region?

A Region is a continuous area of a process's address space (such as text, data and stack). The kernel in a "Region Table" that is local to the process maintains region. Regions are sharable among the process.

7. What are the events done by the Kernel after a process is being swapped out from the main memory?

When Kernel swaps the process out of the primary memory, it performs the following:

  1. Kernel decrements the Reference Count of each region of the process. If the reference count becomes zero, swaps the region out of the main memory,
  2. Kernel allocates the space for the swapping process in the swap device,
  3. Kernel locks the other swapping process while the current swapping operation is going on,
  4. The Kernel saves the swap address of the region in the region table.

8. Is the Process before and after the swap are the same? Give reason.

Process before swapping is residing in the primary memory in its original form. The regions (text, data and stack) may not be occupied fully by the process, there may be few empty slots in any of the regions and while swapping Kernel do not bother about the empty slots while swapping the process out.

After swapping the process resides in the swap (secondary memory) device. The regions swapped out will be present but only the occupied region slots but not the empty slots that were present before assigning.

While swapping the process once again into the main memory, the Kernel referring to the Process Memory Map, it assigns the main memory accordingly taking care of the empty slots in the regions.

9. What do you mean by u-area (user area) or u-block?

This contains the private data that is manipulated only by the Kernel. This is local to the Process, i.e. each process is allocated a u-area.

10. What are the entities that are swapped out of the main memory while swapping the process out of the main memory?

All memory space occupied by the process, process's u-area, and Kernel stack are swapped out, theoretically.

Practically, if the process's u-area contains the Address Translation Tables for the process then Kernel implementations do not swap the u-area.

11. What is Fork swap?

"fork()" is a system call to create a child process. When the parent process calls "fork()" system call, the child process is created and if there is short of memory then the child process is sent to the read-to-run state in the swap device, and return to the user state without swapping the parent process. When the memory will be available the child process will be swapped into the main memory.

12. What is Expansion swap?

At the time when any process requires more memory than it is currently allocated, the Kernel performs Expansion swap. To do this Kernel reserves enough space in the swap device. Then the address translation mapping is adjusted for the new virtual address space but the physical memory is not allocated. At last Kernel swaps the process into the assigned space in the swap device. Later when the Kernel swaps the process into the main memory this assigns memory according to the new address translation mapping.

13. How the Swapper works?

The swapper is the only process that swaps the processes. The Swapper operates only in the Kernel mode and it does not uses System calls instead it uses internal Kernel functions for swapping. It is the archetype of all kernel process.

The document Unix Memory Management (Part- 1), UNIX Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation is a part of the Interview Preparation Course Placement Papers - Technical & HR Questions.
All you need of Interview Preparation at this link: Interview Preparation
85 docs|57 tests

Top Courses for Interview Preparation

FAQs on Unix Memory Management (Part- 1), UNIX Interview Questions - Placement Papers - Technical & HR Questions - Interview Preparation

1. What is memory management in Unix?
Ans. Memory management in Unix refers to the process of managing and organizing the memory resources in a Unix-based operating system. It involves allocating, tracking, and freeing up memory for various processes and applications running on the system.
2. How does Unix handle memory management?
Ans. Unix uses a virtual memory system to handle memory management. It divides the memory into fixed-size pages and maps them to physical memory or disk storage. When a process requires more memory than what is available in physical memory, the operating system swaps out less-used pages to disk and brings in the required pages from disk when needed.
3. What are the main components of Unix memory management?
Ans. The main components of Unix memory management are: - Page tables: These tables store the mapping between virtual memory addresses and physical memory frames. - Swapping: It is the process of moving pages between physical memory and disk storage to free up memory for other processes. - Demand paging: It allows the operating system to load pages into memory only when they are required by a process. - Page fault handling: When a process accesses a page that is not currently in physical memory, a page fault occurs, and the operating system handles it by bringing the required page into memory from disk.
4. How does Unix handle memory fragmentation?
Ans. Unix handles memory fragmentation by using dynamic memory allocation techniques. It uses algorithms like first-fit, best-fit, or worst-fit to allocate memory blocks to processes. Additionally, Unix supports memory compaction, which rearranges memory to reduce fragmentation. If fragmentation becomes severe, Unix can also perform memory compaction by moving processes around in memory to create larger contiguous free memory blocks.
5. What is the role of the kernel in Unix memory management?
Ans. The kernel plays a crucial role in Unix memory management. It is responsible for managing the allocation, deallocation, and tracking of memory resources. The kernel maintains data structures like page tables, process control blocks, and free memory lists. It also handles page faults, swapping, and other memory-related operations to ensure efficient memory utilization and allocation for processes.
Explore Courses for Interview Preparation exam

Top Courses for Interview Preparation

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

mock tests for examination

,

Sample Paper

,

study material

,

Unix Memory Management (Part- 1)

,

Semester Notes

,

shortcuts and tricks

,

Objective type Questions

,

Extra Questions

,

Previous Year Questions with Solutions

,

MCQs

,

Exam

,

video lectures

,

Summary

,

practice quizzes

,

Unix Memory Management (Part- 1)

,

past year papers

,

UNIX Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

Important questions

,

Viva Questions

,

pdf

,

Unix Memory Management (Part- 1)

,

ppt

,

UNIX Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

,

Free

,

UNIX Interview Questions | Placement Papers - Technical & HR Questions - Interview Preparation

;