Monday, September 28, 2015

KERNEL - 2

KERNEL INTERVIEW QUESTIONS AND ANSWERS

PAGE - 2



11..What are the main functions of kernel?
The kernel is primarily responsible for four main functions:
System memory management
Software program management
Hardware management
Filesystem management

12..Why do we need kernel services to open a file?
This is required because fi le -system - specific information is maintained in the kernel. File - system - specifi c data structures are maintained in the kernel and is accessed only in the processor privileged mode; the reason for this is consistency and uninterrupted execution


13..What is  kernel  synchronization mechanism?
The Linux kernel implements many synchronization mechanisms that are applicable in different situations on different kernel control paths. Some of these synchronization mechanisms are
Semaphore
Atomic operations
Disabling interrupts locally or globally
Spin locks

14..What is Spin Lock?
The third and most commonly used synchronization technique used everywhere
inside the kernel is spin locks . It is used to synchronize data access when kernel
control paths on two or more CPUs try to access the same memory region simultaneously.

15..What happens in the linux kernel space?
The received msg structure and the necessary data structure gets copied to kernel space by copy_from_user and verify iovec.

It creates sk_buff and uses memcpy_from_iovec to copy the msg ’ s iovec to
the data area of sk_buff .

It searches the nl_table with the sock that has the same pid as the current
process.

It enqueues the sk_buff in the socket ’ s receive queue and then dequeues
each sk_buff in the receive queue.

It extracts the family and type from the sk_buff ; and based on the family and
type values, it checks the rtnetlink_link table for calling the appropriate doit
function, which takes the appropriate action

16..What are the debuggers available in  kernel?
There are different debuggers available to debug a Linux kernel such as kdb, gdb, lkcd , and so on. lkcd is a Linux kernel crash dump analyser. This tool can generate kernel crash dumps and can save it on the specified location, and the crash can be used to analyze the cause of kernel crashes 

No comments: