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

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

28. Difference between the fork() and vfork() system call?

During the fork() system call the Kernel makes a copy of the parent process's address space and attaches it to the child process.

But the vfork() system call do not makes any copy of the parent's address space, so it is faster than the fork() system call. The child process as a result of the vfork() system call executes exec() system call. The child process from vfork() system call executes in the parent's address space (this can overwrite the parent's data and stack ) which suspends the parent process until the child process exits.

29. What is BSS(Block Started by Symbol)?

A data representation at the machine level, that has initial values when a program starts and tells about how much space the kernel allocates for the un-initialized data. Kernel initializes it to zero at run-time.

30. What is Page-Stealer process?

This is the Kernel process that makes rooms for the incoming pages, by swapping the memory pages that are not the part of the working set of a process. Page-Stealer is created by the Kernel at the system initialization and invokes it throughout the lifetime of the system. Kernel locks a region when a process faults on a page in the region, so that page stealer cannot steal the page, which is being faulted in.

31.Name two paging states for a page in memory?

The two paging states are:

  1. The page is aging and is not yet eligible for swapping,
  2. The page is eligible for swapping but not yet eligible for reassignment to other virtual address space.

32. What are the phases of swapping a page from the memory?

  1. Page stealer finds the page eligible for swapping and places the page number in the list of pages to be swapped.
  2. Kernel copies the page to a swap device when necessary and clears the valid bit in the page table entry, decrements the pfdata reference count, and places the pfdata table entry at the end of the free list if its reference count is 0.

33. What is page fault? Its types?

Page fault refers to the situation of not having a page in the main memory when any process references it. There are two types of page fault :

  1. Validity fault,
  2. Protection fault.

34. In what way the Fault Handlers and the Interrupt handlers are different?

Fault handlers are also an interrupt handler with an exception that the interrupt handlers cannot sleep. Fault handlers sleep in the context of the process that caused the memory fault. The fault refers to the running process and no arbitrary processes are put to sleep.

35.What is validity fault?

If a process referring a page in the main memory whose valid bit is not set, it results in validity fault. The valid bit is not set for those pages:

  1. that are outside the virtual address space of a process,
  2. that are the part of the virtual address space of the process but no physical address is assigned to it.

36. What does the swapping system do if it identifies the illegal page for swapping?

If the disk block descriptor does not contain any record of the faulted page, then this causes the attempted memory reference is invalid and the kernel sends a "Segmentation violation" signal to the offending process. This happens when the swapping system identifies any invalid memory reference.

37. What are states that the page can be in, after causing a page fault?

  1. On a swap device and not in memory,
  2. On the free page list in the main memory,
  3. In an executable file,
  4. Marked "demand zero",
  5. Marked "demand fill"

38. In what way the validity fault handler concludes?

  1. It sets the valid bit of the page by clearing the modify bit.
  2. It recalculates the process priority.

39. At what mode the fault handler executes?

At the Kernel Mode.

40. What do you mean by the protection fault?

Protection fault refers to the process accessing the pages, which do not have the access permission. A process also incur the protection fault when it attempts to write a page whose copy on write bit was set during the fork() system call.

41. How the Kernel handles the copy on write bit of a page, when the bit is set?

In situations like, where the copy on write bit of a page is set and that page is shared by more than one process, the Kernel allocates new page and copies the content to the new page and the other processes retain their references to the old page. After copying the Kernel updates the page table entry with the new page number. Then Kernel decrements the reference count of the old pfdata table entry.

In cases like, where the copy on write bit is set and no processes are sharing the page, the Kernel allows the physical page to be reused by the processes. By doing so, it clears the copy on write bit and disassociates the page from its disk copy (if one exists), because other process may share the disk copy. Then it removes the pfdata table entry from the page-queue as the new copy of the virtual page is not on the swap device. It decrements the swap-use count for the page and if count drops to 0, frees the swap space.

42. For which kind of fault the page is checked first?

The page is first checked for the validity fault, as soon as it is found that the page is invalid (valid bit is clear), the validity fault handler returns immediately, and the process incur the validity page fault. Kernel handles the validity fault and the process will incur the protection fault if any one is present.

43. In what way the protection fault handler concludes?

After finishing the execution of the fault handler, it sets the modify and protection bits and clears the copy on write bit. It recalculates the process-priority and checks for signals.

44. How the Kernel handles both the page stealer and the fault handler?

The page stealer and the fault handler thrash because of the shortage of the memory. If the sum of the working sets of all processes is greater that the physical memory then the fault handler will usually sleep because it cannot allocate pages for a process. This results in the reduction of the system throughput because Kernel spends too much time in overhead, rearranging the memory in the frantic pace.

The document Unix Memory Management (Part- 3), 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- 3), 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 by which the operating system manages and controls the allocation, usage, and deallocation of memory resources in a Unix-based system. It includes tasks such as memory allocation for processes, memory protection, virtual memory management, and swapping.
2. What is the purpose of memory management in Unix?
Ans. The purpose of memory management in Unix is to ensure efficient utilization of memory resources and provide a secure and stable environment for running processes. It allows multiple processes to coexist in memory, prevents one process from accessing or modifying the memory of another process, and enables the system to allocate additional virtual memory when physical memory is limited.
3. How does Unix manage memory for processes?
Ans. Unix manages memory for processes through various techniques like segmentation and paging. In segmentation, the logical address space of a process is divided into variable-sized segments, while in paging, it is divided into fixed-sized pages. The operating system keeps track of the memory allocation for each process and manages the mapping between logical and physical memory addresses.
4. What is virtual memory in Unix?
Ans. Virtual memory in Unix is a memory management technique that allows the operating system to use secondary storage (usually disk) as an extension of physical memory. It creates an illusion of having more physical memory than actually available by swapping data between memory and disk. This allows for efficient memory utilization and enables the execution of larger programs or multiple programs simultaneously.
5. How does swapping work in Unix memory management?
Ans. Swapping in Unix memory management involves moving inactive or less frequently used pages of memory from physical memory to disk and vice versa. When the system requires more physical memory, it swaps out pages from the memory to disk. When those pages are needed again, they are swapped back from disk to memory. This process is transparent to the running processes and helps in efficient memory allocation and management.
85 docs|57 tests
Download as PDF
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

video lectures

,

study material

,

past year papers

,

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

,

Free

,

Exam

,

Objective type Questions

,

pdf

,

MCQs

,

Unix Memory Management (Part- 3)

,

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

,

practice quizzes

,

mock tests for examination

,

Previous Year Questions with Solutions

,

Unix Memory Management (Part- 3)

,

shortcuts and tricks

,

Viva Questions

,

Extra Questions

,

Important questions

,

Summary

,

Sample Paper

,

Unix Memory Management (Part- 3)

,

ppt

,

Semester Notes

,

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

;