SlideShare a Scribd company logo
Linux Interview Essentials – Part III (Memory management)
Emertxe Information Technologies
1. What is MMU? Explain its significance
A memory management unit (MMU) is a computer hardware component that handles all memory
and caching operations associated with the processor. In other words, the MMU is responsible for
all aspects of memory management. It is usually integrated into the processor, although in some
systems it occupies a separate IC (integrated circuit) chip.
The work of the MMU can be divided into three major categories:
 Hardware memory management, which oversees and regulates the processor's use of
RAM (random access memory) and cache memory.
 OS (operating system) memory management, which ensures the availability of
adequate memory resources for the objects and data structures of each running
program at all times.
 Application memory management, which allocates each individual program's required
memory, and then recycles freed-up memory space when the operation concludes.
2. What is logical address and physical address? Explain the differences
An address generated by the CPU is a logical address whereas address actually available on
memory unit is a physical address. Logical address is also known a Virtual address. Virtual and
physical addresses are the same in compile-time and load-time address-binding schemes. Virtual
and physical addresses differ in execution-time address-binding scheme.
The set of all logical addresses generated by a program is referred to as a logical address space.
The set of all physical addresses corresponding to these logical addresses is referred to as a
physical address space. The run-time mapping from virtual to physical address is done by the
memory management unit (MMU) which is a hardware device.
3. What are difference between Volatile / Non-volatile / Hybrid memory?
Non-volatile memory is typically used for the task long-term persistent storage (ROM) which will
generally use for one time dump. The most widely used form of primary storage today is a volatile
form of random access memory (RAM), meaning that when the system power down, anything
contained in RAM is lost. Some memory have both properties like, we can store and remove data
any number of time. Eg Flash, EPROM etc
4. Explain the concept of Virtual memory
Ref Qns 1, 2 & 5
5. What is paging and page table? What are the advantages?
If programs access physical memory, we will face three problems
 Don't have enough physical memory.
 Holes in address space (fragmentation).
 No security (All program can access same memory)
These problems can be solved using virtual memory.
 Each program will have their own virtual memory.
 They separately maps virtual memory space to physical memory.
 We can even move to disk if we run out of memory (Swapping).
What is paging?
 Virtual memory divided into small chunks called pages.
 Similarly physical memory divided into frames.
 Virtual memory and physical memory mapped using page table.
Linux Interview Essentials – Part III (Memory management)
Emertxe Information Technologies
6. What is TLB? Explain
For faster access page table entries will be stored in CPU cache memory is called TLB.
 But limited entries only possible.
 If page entry available in TLB (Hit), control goes to physical address directly (Within
one cycle).
 If page entry not available in TLB (Miss), it use page table from main memory and
maps to physical address (Takes more cycles compared to TLB).
7. What is DMA?
Direct memory access (DMA) chips or controllers solve this problem by allowing the device to
access the memory directly without involving the processor, as shown in Figure. The processor is
used to set up the DMA controller before a data transfer operation begins, but the processor is
bypassed during data transfer, regardless of whether it is a read or write operation.
Linux Interview Essentials – Part III (Memory management)
Emertxe Information Technologies
The transfer speed depends on the transfer speed of the I/O device, the speed of the memory
device, and the speed of the DMA controller. In essence, the DMA controller provides an
alternative data path between the I/O device and the main memory. The processor sets up the
transfer operation by specifying the source address, the destination memory address, and the
length of the transfer to the DMA controller.
8. Explain differences between memory mapped I/O and port mapped I/O
 Port-mapped I/O:
The devices are programmed to occupy a range in the I/O address space. Each device is on a
different I/O port. The I/O ports are accessed through special processor instructions, and actual
physical access is accomplished through special hardware circuitry. This I/O method is also called
isolated I/O because the memory space is isolated from the I/O space, thus the entire memory
address space is available for application use.
 Memory mapped I/O
The memory-mapped I/O, the device address is part of the system memory address space. Any
machine instruction that is encoded to transfer data between a memory location and the
processor or between two memory locations can potentially be used to access the I/O device. The
I/O device is treated as if it were another memory location. Because the I/O address space
occupies a range in the system memory address space, this region of the memory address space is
not available for an application to use.
Linux Interview Essentials – Part III (Memory management)
Emertxe Information Technologies
9. What is cache memory?
A CPU cache is a cache used by the central processing unit (CPU) of a computer to reduce the
average time to access data from the main memory. The cache is a smaller, faster memory which
stores copies of the data from frequently used main memory locations. Most CPUs have different
independent caches, including instruction and data caches, where the data cache is usually
organized as a hierarchy of more cache levels (L1, L2, etc.).
When the processor needs to read from or write to a location in main memory, it first checks
whether a copy of that data is in the cache. If so, the processor immediately reads from or writes
to the cache, which is much faster than reading from or writing to main memory. Most modern
desktop and server CPUs have at least three independent caches: an instruction cache to speed up
executable instruction fetch, a data cache to speed up data fetch and store, and a translation
look-aside buffer (TLB) used to speed up virtual-to-physical address translation for both
executable instructions and data.
The data cache is usually organized as a hierarchy of more cache levels (L1, L2, etc.; see also
multi-level caches below). However, a TLB cache is part of the memory management unit (MMU)
and not directly related to the CPU caches.
10. What is DMA cache coherency? How to solve?
If a CPU has a cache and external memory, then the data the DMA controller has access to (store
in RAM) may not be updated with the correct data stored in the cache.
Solutions
 Cache-coherent systems:
External writes are signaled to the cache controller which performs a cache invalidation for
incoming DMA transfers or cache flush for outgoing DMA transfers (done by hardware)
 Non-coherent systems:
OS ensures that the cache lines are flushed before an outgoing DMA transfer is started and
invalidated before a memory range affected by an incoming DMA transfer is accessed. The OS
makes sure that the memory range is not accessed by any running threads in the meantime.
11. What is position dependent code and position independent code in Linux?
The code within a dynamic executable is typically position-dependent, and is tied to a fixed
address in memory. Shared objects, on the other hand, can be loaded at different addresses in
different processes. Position-independent code is not tied to a specific address. This independence
allows the code to execute efficiently at a different address in each process that uses the code.
Linux Interview Essentials – Part III (Memory management)
Emertxe Information Technologies
Position independent code is recommended for the creation of shared objects.
12. What is swapping? Explain with details
Swapping is a mechanism in which a process can be swapped temporarily out of main memory to a
backing store, and then brought back into memory for continued execution. Backing store is a
usually a hard disk drive or any other secondary storage which fast in access and large enough to
accommodate copies of all memory images for all users. It must be capable of providing direct
access to these memory images.
Major time consuming part of swapping is transfer time. Total transfer time is directly proportional
to the amount of memory swapped. Let us assume that the user process is of size 100KB and the
backing store is a standard hard disk with transfer rate of 1 MB per second. The actual transfer of
the 100K process to or from memory will take

More Related Content

What's hot

Type of Embedded core
Type of Embedded core Type of Embedded core
Type of Embedded core mukul bhardwaj
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
Vandana Salve
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2
rahul_p_shukla
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running Modules
YourHelper1
 
1 introduction
1 introduction1 introduction
1 introduction
Dr. Loganathan R
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
Vandana Salve
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Operating System 2
Operating System 2Operating System 2
Operating System 2
tech2click
 
Kernal
KernalKernal
Kernal
Ramasubbu .P
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
Siddique Ibrahim
 
Board support package_on_linux
Board support package_on_linuxBoard support package_on_linux
Board support package_on_linux
Vandana Salve
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
Vandana Salve
 
Chapter 22 - Windows XP
Chapter 22 - Windows XPChapter 22 - Windows XP
Chapter 22 - Windows XP
Wayne Jones Jnr
 
Linux Kernel and Driver Development Training
Linux Kernel and Driver Development TrainingLinux Kernel and Driver Development Training
Linux Kernel and Driver Development Training
Stephan Cadene
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
Saurabh Bangad
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
Neel Parikh
 

What's hot (20)

Type of Embedded core
Type of Embedded core Type of Embedded core
Type of Embedded core
 
Linux for embedded_systems
Linux for embedded_systemsLinux for embedded_systems
Linux for embedded_systems
 
Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2Device Driver in WinCE 6.0 R2
Device Driver in WinCE 6.0 R2
 
Device Drivers and Running Modules
Device Drivers and Running ModulesDevice Drivers and Running Modules
Device Drivers and Running Modules
 
1 introduction
1 introduction1 introduction
1 introduction
 
Windows Kernel-
Windows Kernel-Windows Kernel-
Windows Kernel-
 
Introduction to char device driver
Introduction to char device driverIntroduction to char device driver
Introduction to char device driver
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Windows kernel
Windows kernelWindows kernel
Windows kernel
 
Operating System 2
Operating System 2Operating System 2
Operating System 2
 
Kernal
KernalKernal
Kernal
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
 
Board support package_on_linux
Board support package_on_linuxBoard support package_on_linux
Board support package_on_linux
 
Driver development – memory management
Driver development – memory managementDriver development – memory management
Driver development – memory management
 
Chapter 22 - Windows XP
Chapter 22 - Windows XPChapter 22 - Windows XP
Chapter 22 - Windows XP
 
Linux Kernel and Driver Development Training
Linux Kernel and Driver Development TrainingLinux Kernel and Driver Development Training
Linux Kernel and Driver Development Training
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
 
What is Kernel, basic idea of kernel
What is Kernel, basic idea of kernelWhat is Kernel, basic idea of kernel
What is Kernel, basic idea of kernel
 

Viewers also liked

Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
Emertxe Information Technologies Pvt Ltd
 
Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0
Emertxe Information Technologies Pvt Ltd
 
Embedded C
Embedded CEmbedded C
Linux device drivers
Linux device drivers Linux device drivers
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
Emertxe Information Technologies Pvt Ltd
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
Emertxe Information Technologies Pvt Ltd
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
Emertxe Information Technologies Pvt Ltd
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
Emertxe Information Technologies Pvt Ltd
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
Emertxe Information Technologies Pvt Ltd
 
Emertxe Certified Embedded Professional (ECEP) : Induction
Emertxe Certified Embedded Professional (ECEP) : InductionEmertxe Certified Embedded Professional (ECEP) : Induction
Emertxe Certified Embedded Professional (ECEP) : Induction
Emertxe Information Technologies Pvt Ltd
 
Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros Interoperability
Rajesh Sola
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolaRajesh Sola
 
Linux internals v4
Linux internals v4Linux internals v4
Linux internals v4
Liran Ben Haim
 
Introduction of omap4 booting sequence
Introduction of omap4 booting sequence Introduction of omap4 booting sequence
Introduction of omap4 booting sequence Johnson Chou
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARM
Rajesh Sola
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaRajesh Sola
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save Power
Rajesh Sola
 
Windows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel DevelopersWindows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel Developers
Kernel TLV
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardware
Rajesh Sola
 
OmapBootSequence
OmapBootSequenceOmapBootSequence
OmapBootSequence
Veda Linux
 

Viewers also liked (20)

Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0Linux Internals - Interview essentials 2.0
Linux Internals - Interview essentials 2.0
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
Linux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platformLinux systems - Getting started with setting up and embedded platform
Linux systems - Getting started with setting up and embedded platform
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Emertxe Certified Embedded Professional (ECEP) : Induction
Emertxe Certified Embedded Professional (ECEP) : InductionEmertxe Certified Embedded Professional (ECEP) : Induction
Emertxe Certified Embedded Professional (ECEP) : Induction
 
Vba Macros Interoperability
Vba Macros InteroperabilityVba Macros Interoperability
Vba Macros Interoperability
 
fudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsolafudcon-fedora-arm-iot-rajeshsola
fudcon-fedora-arm-iot-rajeshsola
 
Linux internals v4
Linux internals v4Linux internals v4
Linux internals v4
 
Introduction of omap4 booting sequence
Introduction of omap4 booting sequence Introduction of omap4 booting sequence
Introduction of omap4 booting sequence
 
Getting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARMGetting started with IOT Development using Fedora on ARM
Getting started with IOT Development using Fedora on ARM
 
aoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsolaaoa-adk-osidays-rajeshsola
aoa-adk-osidays-rajeshsola
 
Go Green - Save Power
Go Green - Save PowerGo Green - Save Power
Go Green - Save Power
 
Windows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel DevelopersWindows Internals for Linux Kernel Developers
Windows Internals for Linux Kernel Developers
 
Hands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardwareHands on with embedded linux using zero hardware
Hands on with embedded linux using zero hardware
 
OmapBootSequence
OmapBootSequenceOmapBootSequence
OmapBootSequence
 

Similar to Linux Internals - Interview essentials 3.0

Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
Johan Granados Montero
 
Memory managment
Memory managmentMemory managment
Memory managment
Shahbaz Khan
 
Operating system
Operating systemOperating system
Operating system
Hussain Ahmady
 
ARM architcture
ARM architcture ARM architcture
ARM architcture
Hossam Adel
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
Mukesh Chinta
 
CA UNIT V..pptx
CA UNIT V..pptxCA UNIT V..pptx
CA UNIT V..pptx
ssuser9dbd7e
 
Multilevel arch & str org.& mips, 8086, memory
Multilevel arch & str org.& mips, 8086, memoryMultilevel arch & str org.& mips, 8086, memory
Multilevel arch & str org.& mips, 8086, memoryMahesh Kumar Attri
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
ImranKhan880955
 
COMPUTER MEMORY
COMPUTER MEMORYCOMPUTER MEMORY
COMPUTER MEMORYRajat More
 
ICT - Lecture Notes 3.pdf
ICT - Lecture Notes 3.pdfICT - Lecture Notes 3.pdf
ICT - Lecture Notes 3.pdf
HonKencyTress
 
Virtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryVirtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryAshik Iqbal
 
Computer System Overview,
Computer System Overview, Computer System Overview,
Computer System Overview,
Sajid Marwat
 
Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
Transweb Global Inc
 
Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)
Subhajit Sahu
 
2. the memory systems (module2)
2. the memory systems (module2)2. the memory systems (module2)
2. the memory systems (module2)
Ajit Saraf
 
CH08.pdf
CH08.pdfCH08.pdf
CH08.pdf
ImranKhan880955
 
Unit 5-lecture-2
Unit 5-lecture-2Unit 5-lecture-2
Unit 5-lecture-2
vishal choudhary
 
Presentation1
Presentation1Presentation1
Presentation1
dthewryq4y
 

Similar to Linux Internals - Interview essentials 3.0 (20)

Opetating System Memory management
Opetating System Memory managementOpetating System Memory management
Opetating System Memory management
 
Memory managment
Memory managmentMemory managment
Memory managment
 
Memory hierarchy
Memory hierarchyMemory hierarchy
Memory hierarchy
 
Operating system
Operating systemOperating system
Operating system
 
ARM architcture
ARM architcture ARM architcture
ARM architcture
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
 
CA UNIT V..pptx
CA UNIT V..pptxCA UNIT V..pptx
CA UNIT V..pptx
 
Multilevel arch & str org.& mips, 8086, memory
Multilevel arch & str org.& mips, 8086, memoryMultilevel arch & str org.& mips, 8086, memory
Multilevel arch & str org.& mips, 8086, memory
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
 
Cache memory
Cache memoryCache memory
Cache memory
 
COMPUTER MEMORY
COMPUTER MEMORYCOMPUTER MEMORY
COMPUTER MEMORY
 
ICT - Lecture Notes 3.pdf
ICT - Lecture Notes 3.pdfICT - Lecture Notes 3.pdf
ICT - Lecture Notes 3.pdf
 
Virtual Memory vs Cache Memory
Virtual Memory vs Cache MemoryVirtual Memory vs Cache Memory
Virtual Memory vs Cache Memory
 
Computer System Overview,
Computer System Overview, Computer System Overview,
Computer System Overview,
 
Memory Management | Computer Science
Memory Management | Computer ScienceMemory Management | Computer Science
Memory Management | Computer Science
 
Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)Shared memory Parallelism (NOTES)
Shared memory Parallelism (NOTES)
 
2. the memory systems (module2)
2. the memory systems (module2)2. the memory systems (module2)
2. the memory systems (module2)
 
CH08.pdf
CH08.pdfCH08.pdf
CH08.pdf
 
Unit 5-lecture-2
Unit 5-lecture-2Unit 5-lecture-2
Unit 5-lecture-2
 
Presentation1
Presentation1Presentation1
Presentation1
 

More from Emertxe Information Technologies Pvt Ltd

Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
Emertxe Information Technologies Pvt Ltd
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf

More from Emertxe Information Technologies Pvt Ltd (20)

premium post (1).pdf
premium post (1).pdfpremium post (1).pdf
premium post (1).pdf
 
Career Transition (1).pdf
Career Transition (1).pdfCareer Transition (1).pdf
Career Transition (1).pdf
 
10_isxdigit.pdf
10_isxdigit.pdf10_isxdigit.pdf
10_isxdigit.pdf
 
01_student_record.pdf
01_student_record.pdf01_student_record.pdf
01_student_record.pdf
 
02_swap.pdf
02_swap.pdf02_swap.pdf
02_swap.pdf
 
01_sizeof.pdf
01_sizeof.pdf01_sizeof.pdf
01_sizeof.pdf
 
07_product_matrix.pdf
07_product_matrix.pdf07_product_matrix.pdf
07_product_matrix.pdf
 
06_sort_names.pdf
06_sort_names.pdf06_sort_names.pdf
06_sort_names.pdf
 
05_fragments.pdf
05_fragments.pdf05_fragments.pdf
05_fragments.pdf
 
04_magic_square.pdf
04_magic_square.pdf04_magic_square.pdf
04_magic_square.pdf
 
03_endianess.pdf
03_endianess.pdf03_endianess.pdf
03_endianess.pdf
 
02_variance.pdf
02_variance.pdf02_variance.pdf
02_variance.pdf
 
01_memory_manager.pdf
01_memory_manager.pdf01_memory_manager.pdf
01_memory_manager.pdf
 
09_nrps.pdf
09_nrps.pdf09_nrps.pdf
09_nrps.pdf
 
11_pangram.pdf
11_pangram.pdf11_pangram.pdf
11_pangram.pdf
 
10_combinations.pdf
10_combinations.pdf10_combinations.pdf
10_combinations.pdf
 
08_squeeze.pdf
08_squeeze.pdf08_squeeze.pdf
08_squeeze.pdf
 
07_strtok.pdf
07_strtok.pdf07_strtok.pdf
07_strtok.pdf
 
06_reverserec.pdf
06_reverserec.pdf06_reverserec.pdf
06_reverserec.pdf
 
05_reverseiter.pdf
05_reverseiter.pdf05_reverseiter.pdf
05_reverseiter.pdf
 

Recently uploaded

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 

Recently uploaded (20)

Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 

Linux Internals - Interview essentials 3.0

  • 1. Linux Interview Essentials – Part III (Memory management) Emertxe Information Technologies 1. What is MMU? Explain its significance A memory management unit (MMU) is a computer hardware component that handles all memory and caching operations associated with the processor. In other words, the MMU is responsible for all aspects of memory management. It is usually integrated into the processor, although in some systems it occupies a separate IC (integrated circuit) chip. The work of the MMU can be divided into three major categories:  Hardware memory management, which oversees and regulates the processor's use of RAM (random access memory) and cache memory.  OS (operating system) memory management, which ensures the availability of adequate memory resources for the objects and data structures of each running program at all times.  Application memory management, which allocates each individual program's required memory, and then recycles freed-up memory space when the operation concludes. 2. What is logical address and physical address? Explain the differences An address generated by the CPU is a logical address whereas address actually available on memory unit is a physical address. Logical address is also known a Virtual address. Virtual and physical addresses are the same in compile-time and load-time address-binding schemes. Virtual and physical addresses differ in execution-time address-binding scheme. The set of all logical addresses generated by a program is referred to as a logical address space. The set of all physical addresses corresponding to these logical addresses is referred to as a physical address space. The run-time mapping from virtual to physical address is done by the memory management unit (MMU) which is a hardware device. 3. What are difference between Volatile / Non-volatile / Hybrid memory? Non-volatile memory is typically used for the task long-term persistent storage (ROM) which will generally use for one time dump. The most widely used form of primary storage today is a volatile form of random access memory (RAM), meaning that when the system power down, anything contained in RAM is lost. Some memory have both properties like, we can store and remove data any number of time. Eg Flash, EPROM etc 4. Explain the concept of Virtual memory Ref Qns 1, 2 & 5 5. What is paging and page table? What are the advantages? If programs access physical memory, we will face three problems  Don't have enough physical memory.  Holes in address space (fragmentation).  No security (All program can access same memory) These problems can be solved using virtual memory.  Each program will have their own virtual memory.  They separately maps virtual memory space to physical memory.  We can even move to disk if we run out of memory (Swapping). What is paging?  Virtual memory divided into small chunks called pages.  Similarly physical memory divided into frames.  Virtual memory and physical memory mapped using page table.
  • 2. Linux Interview Essentials – Part III (Memory management) Emertxe Information Technologies 6. What is TLB? Explain For faster access page table entries will be stored in CPU cache memory is called TLB.  But limited entries only possible.  If page entry available in TLB (Hit), control goes to physical address directly (Within one cycle).  If page entry not available in TLB (Miss), it use page table from main memory and maps to physical address (Takes more cycles compared to TLB). 7. What is DMA? Direct memory access (DMA) chips or controllers solve this problem by allowing the device to access the memory directly without involving the processor, as shown in Figure. The processor is used to set up the DMA controller before a data transfer operation begins, but the processor is bypassed during data transfer, regardless of whether it is a read or write operation.
  • 3. Linux Interview Essentials – Part III (Memory management) Emertxe Information Technologies The transfer speed depends on the transfer speed of the I/O device, the speed of the memory device, and the speed of the DMA controller. In essence, the DMA controller provides an alternative data path between the I/O device and the main memory. The processor sets up the transfer operation by specifying the source address, the destination memory address, and the length of the transfer to the DMA controller. 8. Explain differences between memory mapped I/O and port mapped I/O  Port-mapped I/O: The devices are programmed to occupy a range in the I/O address space. Each device is on a different I/O port. The I/O ports are accessed through special processor instructions, and actual physical access is accomplished through special hardware circuitry. This I/O method is also called isolated I/O because the memory space is isolated from the I/O space, thus the entire memory address space is available for application use.  Memory mapped I/O The memory-mapped I/O, the device address is part of the system memory address space. Any machine instruction that is encoded to transfer data between a memory location and the processor or between two memory locations can potentially be used to access the I/O device. The I/O device is treated as if it were another memory location. Because the I/O address space occupies a range in the system memory address space, this region of the memory address space is not available for an application to use.
  • 4. Linux Interview Essentials – Part III (Memory management) Emertxe Information Technologies 9. What is cache memory? A CPU cache is a cache used by the central processing unit (CPU) of a computer to reduce the average time to access data from the main memory. The cache is a smaller, faster memory which stores copies of the data from frequently used main memory locations. Most CPUs have different independent caches, including instruction and data caches, where the data cache is usually organized as a hierarchy of more cache levels (L1, L2, etc.). When the processor needs to read from or write to a location in main memory, it first checks whether a copy of that data is in the cache. If so, the processor immediately reads from or writes to the cache, which is much faster than reading from or writing to main memory. Most modern desktop and server CPUs have at least three independent caches: an instruction cache to speed up executable instruction fetch, a data cache to speed up data fetch and store, and a translation look-aside buffer (TLB) used to speed up virtual-to-physical address translation for both executable instructions and data. The data cache is usually organized as a hierarchy of more cache levels (L1, L2, etc.; see also multi-level caches below). However, a TLB cache is part of the memory management unit (MMU) and not directly related to the CPU caches. 10. What is DMA cache coherency? How to solve? If a CPU has a cache and external memory, then the data the DMA controller has access to (store in RAM) may not be updated with the correct data stored in the cache. Solutions  Cache-coherent systems: External writes are signaled to the cache controller which performs a cache invalidation for incoming DMA transfers or cache flush for outgoing DMA transfers (done by hardware)  Non-coherent systems: OS ensures that the cache lines are flushed before an outgoing DMA transfer is started and invalidated before a memory range affected by an incoming DMA transfer is accessed. The OS makes sure that the memory range is not accessed by any running threads in the meantime. 11. What is position dependent code and position independent code in Linux? The code within a dynamic executable is typically position-dependent, and is tied to a fixed address in memory. Shared objects, on the other hand, can be loaded at different addresses in different processes. Position-independent code is not tied to a specific address. This independence allows the code to execute efficiently at a different address in each process that uses the code.
  • 5. Linux Interview Essentials – Part III (Memory management) Emertxe Information Technologies Position independent code is recommended for the creation of shared objects. 12. What is swapping? Explain with details Swapping is a mechanism in which a process can be swapped temporarily out of main memory to a backing store, and then brought back into memory for continued execution. Backing store is a usually a hard disk drive or any other secondary storage which fast in access and large enough to accommodate copies of all memory images for all users. It must be capable of providing direct access to these memory images. Major time consuming part of swapping is transfer time. Total transfer time is directly proportional to the amount of memory swapped. Let us assume that the user process is of size 100KB and the backing store is a standard hard disk with transfer rate of 1 MB per second. The actual transfer of the 100K process to or from memory will take