Linux Theory#
User space <-> Kernel space & Driver Interface#
- What communication method i use to communicating between User space to Kernel space.
- How do the driver/device know which application is communicating with it.
write() api in user and kernel space, what are difference in arguments. From which header write() is included.- Explain ioctl calls and its handling in kernel and user space. What are the things application is dependent on to call a particular ioctl.
- What is systemcall table
- Why and How is Devise Tree used.
- How is the device tree actually passed or accessed by the drivers.
- How is the physical device be mapped to the driver device.
- How is the platform bringup done? And what do we mean by platform devices.
Interrupts & Deferred Processing#
- How does interrupt is managed by the kernel? Describe each modules called which are done before calling isr and what are the propagation delay while interrupt is called.
- How are interrupts managed by the kernel
- What are arguments to a particular interrupt regestering function
- Top half and bottom halfs, how are the complex isr managed.
- Top halves and bottom halves
Memory Management & DMA#
- How kernel manages memory, like how malloc works
- How is the TLD used to manage physical and virtual addresses? What exactly kernel does?
- What is DMA and how does the driver handels it.
- What is DMA and how it works?
Kernel Debugging & Virtual FS#
- How will you debug kernel crash or panic?
- What is procfs and sysfs
Synchronization & Concurrency#
- Mutex semaphor explanation and difference
- Race and deadlock conditions
Boot & Init#
- Linux boot process
- What are init systems? Example systemd or any other init system
Misc Kernel / Language Concepts#
- Describe static and auto
- What is volatile used for? Can const be volatile?
- Write sudo code for character device driver
Embedded#
Communication Protocols#
- I2C Start and stop bits, the data and clock config at start and stop
- SPI lines
Programming Theory#
Concurrency & OS Concepts#
- What is the difference between Mutex and SpinLock
- What are mutex, threads, spinlocks
Data Structures#
- LinkList
- Data Structures: Stack, Queues, Heap
C Language & Memory Model#
- C Concepts: BSS, Data Segment, ReadOnly segment.
- Diff between structure and union and their sizes
- What is pass by value and pass by reference look like?
- Calculate the no. of elements inside of array if the array pointer is passed to a function.
Function Pointers & Declarations#
- Write declaration of An array of 5 pointers to a fucction. These functions are taking int arg and return int
Program Execution & Memory Layout#
- What exactly happens, what would be loaded in memory and which segments
main(){printf("Hello World")};
cc main.c
./a.out
Data Structures & Algorithms (DSA)#
Arrays & Searching#
- Get the highest and 2nd most highest number from unsorted array without sorting it.
int arr[10] = {5, 10, 15, 3, 9, 21, 7, 12, 2, 16} - Write a program to search inside of the array in 0(n/2) time complexity. Get a number from user and count the no. of times that number is present inside the array.
Bit Manipulation#
- Convert
0x12345678 to 0x34127856 using bit operators - Write a macro to toggle a given bit
- Get a number in hex and start and end range number from user. Write a function which sets the number from the start till the end bit. The program should be independent from the machine architecture.
- Count no of set bits in a number
Linked List Problems#
- Reverse a link list
- Solve the error occured(sig. fault) in the last question of 1st round.
- Write a program to find middle point of a linked list
- Implement Linklist, its structure size, padding, allocating and print list wrappers.
Memory Management#
- Assume you have a memory pool of 1G allocated using malloc(). Now, implement my_malloc() and my_free() which will operate on this 1G chunk of memory to service multiple threads in an application. Try to implement the APIs which can alloc/free in O(1) time complexity.
Multithreading#
- Write a program which has 2 threads, 1 will take input from the user and another thread will do some processing on that input.
- Program to print from 0 to 100 sequentially using 2 threads, 1st thread will print only even values and 2nd thread will print only odd values.
Debugging & Miscellaneous#
- Implement sizeof operator
- Write a program to print diamond pattern
- Print all prime numbers between 1 to 10.
- Follow up: Store the prime numbers in singly linked-list.