YouTube Icon

Interview Questions.

Top 100+ Unix Memory Management Interview Questions And Answers - Jun 02, 2020

fluid

Top 100+ Unix Memory Management Interview Questions And Answers

Question 1. What Is The Difference Between Swapping And Paging?

Answer :

Swapping: Whole method is moved from the swap device to the main reminiscence for execution. Process length should be less than or equal to the to be had essential reminiscence. It is less difficult to implementation and overhead to the machine. Swapping structures does now not deal with the memory more flexibly compared to the paging systems.

Paging: Only the desired reminiscence pages are moved to principal reminiscence from the switch device for execution. Process length does no longer be counted. Gives the concept of the digital reminiscence. It affords greater flexibility in mapping the virtual address area into the bodily reminiscence of the gadget. Allows greater quantity of techniques to match inside the primary reminiscence simultaneously. Allows the extra process size than the available bodily reminiscence. Demand paging structures cope with the reminiscence extra flexibly.

Question 2. What Is Major Difference Between The Historic Unix And The New Bsd Release Of Unix System V In Terms Of Memory Management?

Answer :

Historic Unix uses Swapping - whole method is transferred to the principle reminiscence from the change device, while the Unix System V makes use of Demand Paging - best the a part of the process is moved to the main reminiscence. Historic Unix uses one Swap Device and Unix System V permit a couple of Swap Devices.

UNIX/XENIX Interview Questions
Question 3. What Is The Main Goal Of The Memory Management?

Answer :

It comes to a decision which procedure must reside inside the principal memory,
Manages the parts of the digital address area of a system which is non-middle resident,
Monitors the to be had major reminiscence and periodically write the strategies into the swap device to offer extra strategies fit within the important reminiscence concurrently.
Question 4. What Scheme Does The Kernel In Unix System V Follow While Choosing A Swap Device Among The Multiple Swap Devices?

Answer :

Kernel follows Round Robin scheme choosing a switch device most of the more than one change devices in Unix System V.

Data Structure & Algorithms Tutorial
Question 5. What Is A Region?

Answer :

A Region is a continuous location of a method's deal with space (along with textual content, information and stack). The kernel in a "Region Table" this is local to the procedure keeps area. Regions are sharable most of the system.

Red Hat Linux System Administration Interview Questions
Question 6. What Are The Events Done By The Kernel After A Process Is Being Swapped Out From The Main Memory?

Answer :

When Kernel swaps the technique out of the number one memory, it plays the following:

Kernel decrements the Reference Count of each area of the procedure. If the reference count turns into zero, swaps the place out of the principle reminiscence,
Kernel allocates the space for the swapping process in the swap tool,
Kernel locks the opposite swapping system at the same time as the present day swapping operation goes on,
The Kernel saves the swap deal with of the place in the place table.
Question 7. Is The Process Before And After The Swap Are The Same? Give Reason.?

Answer :

Process before swapping is living within the number one memory in its authentic shape. The regions (text, information and stack) might not be occupied completely by using the procedure, there can be few empty slots in any of the regions and even as swapping Kernel do now not hassle approximately the empty slots even as swapping the technique out.

After swapping the technique resides in the swap (secondary reminiscence) device. The regions swapped out will be gift however simplest the occupied area slots however no longer the empty slots that had been gift earlier than assigning.

While swapping the technique over again into the primary reminiscence, the Kernel regarding the Process Memory Map, it assigns the primary reminiscence hence taking care of the empty slots in the regions.

Unix/Linux Tutorial Unix Inter-Process Communication (IPC) Interview Questions
Question eight. What Do You Mean By U-place (person Area) Or U-block?

Answer :

This incorporates the private information that is manipulated handiest with the aid of the Kernel. This is nearby to the Process, i.E. Each technique is allocated a u-region.

Question 9. What Are The Entities That Are Swapped Out Of The Main Memory While Swapping The Process Out Of The Main Memory?

Answer :

All reminiscence area occupied through the technique, manner's u-area, and Kernel stack are swapped out, theoretically.
Practically, if the technique's u-place carries the Address Translation Tables for the method then Kernel implementations do now not switch the u-region.
UNIX Process Management Interview Questions
Question 10. What Is Fork Swap?

Answer :

"fork()" is a machine call to create a child system. When the figure manner calls "fork()" gadget call, the child manner is created and if there is brief of memory then the child technique is despatched to the examine-to-run nation within the swap tool, and return to the consumer kingdom without swapping the determine system. When the reminiscence may be to be had the child manner can be swapped into the main memory.

Unix socket Tutorial
Question eleven. What Is Expansion Swap?

Answer :

At the time when any procedure requires more memory than it's miles currently allotted, the Kernel plays Expansion swap. To try this Kernel reserves sufficient space in the change tool. Then the address translation mapping is adjusted for the new virtual cope with space however the bodily reminiscence isn't always allotted.

At last Kernel swaps the manner into the assigned space within the switch device. Later while the Kernel swaps the process into the principle memory this assigns memory according to the new deal with translation mapping.

Data Structure & Algorithms Interview Questions
Question 12. How The Swapper Works?

Answer :

The swapper is the best process that swaps the processes. The Swapper operates best within the Kernel mode and it does no longer uses System calls as a substitute it makes use of internal Kernel functions for swapping. It is the archetype of all kernel method.

UNIX/XENIX Interview Questions
Question thirteen. What Are The Processes That Are Not Bothered By The Swapper? Give Reason.?

Answer :

Zombie manner: They do no longer take any up physical memory.

Processes locked in reminiscences which are updating the location of the system.

Kernel swaps best the slumbering approaches instead of the 'geared up-to-run' techniques, as they've the better opportunity of being scheduled than the Sleeping strategies.

Unix makefile Tutorial
Question 14. What Are The Requirements For A Swapper To Work?

Answer :

The swapper works on the best scheduling priority. Firstly it will look for any sleeping system, if not located then it's going to search for the ready-to-run system for swapping. But the essential requirement for the swapper to paintings the geared up-to-run procedure have to be core-resident for at the least 2 seconds before swapping out. And for swapping in the technique need to have been resided in the switch device for as a minimum 2 seconds. If the requirement isn't happy then the swapper will move into the wait kingdom on that event and it is wake up as soon as in a second by way of the Kernel.

Question 15. What Are The Criteria For Choosing A Process For Swapping Into Memory From The Swap Device?

Answer :

The resident time of the approaches inside the swap tool, the concern of the approaches and the amount of time the approaches were swapped out.

Advanced C# Interview Questions
Question 16. What Are The Criteria For Choosing A Process For Swapping Out Of The Memory To The Swap Device?

Answer :

The process's memory resident time,
Priority of the method and
The exceptional fee.
Question 17. What Do You Mean By Nice Value?

Answer :

Nice fee is the fee that controls increments or decrements the priority of the system. This cost that is again via the excellent() device name.

The equation for using great value is:

Priority = ("latest CPU utilization"/steady) + (base- priority) + (first-rate cost)

Only the administrator can deliver the satisfactory cost. The first-rate() machine name works for the going for walks technique handiest. Nice price of 1 method can not have an effect on the nice cost of the opposite system.

Unix/Linux Interview Questions
Question 18. What Are Conditions On Which Deadlock Can Occur While Swapping The Processes?

Answer :

All strategies within the major reminiscence are asleep.
All "ready-to-run" procedures are swapped out.
There is no space within the swap device for the brand new incoming manner that are swapped out of the primary memory.
There isn't any space within the main reminiscence for the brand new incoming procedure.
Red Hat Linux System Administration Interview Questions
Question 19. What Are Conditions For A Machine To Support Demand Paging?

Answer :

Memory architecture should primarily based on Pages,
The machine have to aid the 'restartable' commands.
Question 20. What Is "the Principle Of Locality"?

Answer :

It's the character of the tactics that they refer most effective to the small subset of the whole statistics area of the process. I.E. The manner regularly calls the same subroutines or executes the loop instructions.

Unix socket Interview Questions
Question 21. What Is The Working Set Of A Process?

Answer :

The set of pages that are referred by way of the technique inside the last "n", references, wherein "n" is referred to as the window of the running set of the technique.

Question 22. What Is The Window Of The Working Set Of A Process?

Answer :

The window of the operating set of a method is the overall quantity in which the procedure had referred the set of pages inside the working set of the manner.

Question 23. What Is Called A Page Fault?

Answer :

Page fault is referred to the scenario whilst the system addresses a web page inside the running set of the procedure however the system fails to discover the web page inside the running set. And on a web page fault the kernel updates the working set by way of reading the page from the secondary tool.

Unix Production Support Interview Questions
Question 24. What Are Data Structures That Are Used For Demand Paging?

Answer :

Kernel contains four information structures for Demand paging.

They are:

Page desk entries,
Disk block descriptors,
Page body information table (pfdata),
Swap-use table.
Unix Inter-Process Communication (IPC) Interview Questions
Question 25. What Are The Bits That Support The Demand Paging?

Answer :

Valid, Reference, Modify, Copy on write, Age. These bits are the a part of the page desk entry, which incorporates physical deal with of the page and protection bits.

Question 26. How The Kernel Handles The Fork() System Call In Traditional Unix And In The System V Unix, While Swapping?

Answer :

Kernel in traditional Unix, makes the reproduction replica of the figure's address space and attaches it to the child's system, while swapping. Kernel in System V Unix, manipulates the area tables, page table, and pfdata desk entries, by using incrementing the reference depend of the region table of shared regions.

Unix Shell Scripting Interview Questions
Question 27. Difference Between The Fork() And Vfork() System Call?

Answer :

During the fork() system name the Kernel makes a copy of the parent process's deal with space and attaches it to the kid procedure.

But the vfork() machine name do no longer makes any replica of the parent's address area, so it's miles faster than the fork() gadget name. The infant system because of the vfork() system call executes exec() system call. The toddler process from vfork() device name executes in the discern's cope with area (this will overwrite the figure's data and stack ) which suspends the parent manner until the kid manner exits.

UNIX Process Management Interview Questions
Question 28. What Is Bss(block Started By Symbol)?

Answer :

A records representation at the device stage, that has initial values while a software starts offevolved and tells about how a lot area the kernel allocates for the un-initialized facts. Kernel initializes it to 0 at run-time.

Question 29. What Is Page-stealer Process?

Answer :

This is the Kernel technique that makes rooms for the incoming pages, by way of swapping the reminiscence pages that are not the a part of the running set of a process.

Page-Stealer is created by using the Kernel at the system initialization and invokes it all through the lifetime of the machine. Kernel locks a vicinity whilst a process faults on a web page within the vicinity, in order that web page stealer cannot thieve the web page, that is being faulted in.

Question 30. Name Two Paging States For A Page In Memory?

Answer :

The  paging states are:

The page is growing older and isn't yet eligible for swapping,
The page is eligible for swapping however no longer but eligible for reassignment to different virtual deal with space.
Question 31. What Are The Phases Of Swapping A Page From The Memory?

Answer :

Page stealer unearths the page eligible for swapping and places the page quantity inside the list of pages to be swapped.

Kernel copies the web page to a change tool whilst necessary and clears the valid bit inside the page desk access, decrements the pfdata reference remember, and locations the pfdata desk access on the cease of the loose listing if its reference depend is 0.

Question 32. What Is Page Fault? Its Types?

Answer :

Page fault refers to the scenario of not having a web page in the predominant reminiscence whilst any manner references it.

There are  forms of page fault :

Validity fault,
Protection fault.
Question 33. In What Way The Fault Handlers And The Interrupt Handlers Are Different?

Answer :

Fault handlers are also an interrupt handler with an exception that the interrupt handlers can not sleep. Fault handlers sleep inside the context of the manner that triggered the memory fault. The fault refers to the running manner and no arbitrary methods are put to sleep.

Data Structure & Algorithms Interview Questions
Question 34. What Is Validity Fault?

Answer :

If a system referring a page in the most important memory whose valid bit is not set, it consequences in validity fault. The valid bit is not set for those pages:
which can be out of doors the digital cope with area of a manner,
which are the part of the digital cope with space of the manner but no bodily deal with is assigned to it.
Question 35. What Does The Swapping System Do If It Identifies The Illegal Page For Swapping?

Answer :

If the disk block descriptor does now not include any report of the faulted web page, then this reasons the tried reminiscence reference is invalid and the kernel sends a "Segmentation violation" sign to the offending process. This takes place whilst the swapping machine identifies any invalid memory reference.

Question 36. What Are States That The Page Can Be In, After Causing A Page Fault?

Answer :

On a change tool and not in memory,
On the unfastened web page listing inside the primary reminiscence,
In an executable report,
Marked "call for 0",
Marked "demand fill"
Advanced C# Interview Questions
Question 37. In What Way The Validity Fault Handler Concludes?

Answer :

It sets the legitimate bit of the page by means of clearing the adjust bit.
It recalculates the manner priority.
Question 38. At What Mode The Fault Handler Executes?

Answer :

At the Kernel Mode.

Question 39. What Do You Mean By The Protection Fault?

Answer :

Protection fault refers back to the process gaining access to the pages, which do now not have the get entry to permission. A manner also incur the protection fault whilst it tries to put in writing a page whose replica on write bit became set all through the fork() gadget call.

Question forty. How The Kernel Handles The Copy On Write Bit Of A Page, When The Bit Is Set?

Answer :

In conditions like, where the reproduction on write little bit of a web page is set and that page is shared by multiple manner, the Kernel allocates new web page and copies the content to the brand new web page and the opposite methods maintain their references to the vintage web page. After copying the Kernel updates the page desk access with the new page wide variety. Then Kernel decrements the reference be counted of the vintage pfdata desk entry.

In cases like, wherein the replica on write bit is set and no methods are sharing the page, the Kernel permits the physical page to be reused by means of the procedures. By doing so, it clears the replica on write bit and disassociates the page from its disk reproduction (if one exists), due to the fact other manner may additionally proportion the disk copy. Then it eliminates the pfdata desk access from the page-queue as the brand new copy of the digital page isn't at the switch tool. It decrements the switch-use matter for the web page and if be counted drops to zero, frees the switch space.

Unix/Linux Interview Questions
Question forty one. For Which Kind Of Fault The Page Is Checked First?

Answer :

The page is first checked for the validity fault, as soon as it's far located that the page is invalid (valid bit is obvious), the validity fault handler returns at once, and the manner incur the validity web page fault. Kernel handles the validity fault and the method will incur the protection fault if any one is gift.

Question forty two. In What Way The Protection Fault Handler Concludes?

Answer :

After completing the execution of the fault handler, it units the regulate and safety bits and clears the copy on write bit. It recalculates the procedure-precedence and assessments for indicators.

Unix socket Interview Questions
Question forty three. How The Kernel Handles Both The Page Stealer And The Fault Handler?

Answer :

The web page stealer and the fault handler thrash due to the lack of the memory. If the sum of the running sets of all approaches is extra that the physical reminiscence then the fault handler will normally sleep because it can't allocate pages for a manner. This effects in the reduction of the system throughput because Kernel spends an excessive amount of time in overhead, rearranging the memory in the frantic tempo.




CFG