Linux Device Driver Interview Questions

2023-11-17

本文转载至:http://linuxinterviewpreperation.blogspot.jp/2013/01/linux-kernel-and-device-drivers.html

                                   Linux Device Model (LDM)

Explain about the Linux Device Model (LDM)?

Explain about about ksets, kobjects and ktypes. How are they related?

Questions about sysfs.



                                       Linux Boot Sequence

Explain about the Linux boot sequence in case of ARM architecture?

How are the command line arguments passed to Linux kernel by the u-boot (bootloader)?

Explain about ATAGS?

Explain about command line arguments that are passed to linux kernel and how/where they are
parsed in kernel code?

Explain about device tree.

                                      Interrupts in Linux

Explain about the interrupt mechanims in linux?

What are the APIs that are used to register an interrupt handler?
How do you register an interrupt handler on a shared IRQ line?

Explain about the flags that are passed to request_irq().

Explain about the internals of Interrupt handling in case of Linux running on ARM.

What are the precautions to be taken while writing an interrupt handler?

Explain interrupt sequence in detail starting from ARM to registered interrupt handler.

What is bottom half and top half.

What is request_threaded_irq()

If same interrupts occurs in two cpu how are they handled?

How to synchronize data between 'two interrupts' and 'interrupts and process'.

How are nested interrupts handled?

How is task context saved during interrupt.

                                    Bottom-half Mechanisms in Linux

What are the different bottom-half mechanisms in Linux?
Softirq, Tasklet and Workqueues

What are the differences between Softirq/Tasklet and Workqueue? Given an example what you
prefer to use?

What are the differences between softirqs and tasklets?
  • Softirq is guaranteed to run on the CPU it was scheduled on, where as tasklets don’t have that guarantee. 
  • The same tasklet can't run on two separate CPUs at the same time, where as a softirq can. 
When are these bottom halfs executed?
Explain about the internal implementation of softirqs?
http://linuxblore.blogspot.com/2013/02/bottom-halves-in-linux-part-1-softirqs.html

Explain about the internal implementation of tasklets?
http://linuxblore.blogspot.com/2013/02/bottom-halves-in-linux-part-2-tasklets.html

Explain about the internal implementation of workqueues?
http://linuxblore.blogspot.in/2013/01/workqueues-in-linux.html

Explain about the concurrent work queues.


                                       Linux Memory Management 

What are the differences between vmalloc and kmalloc? Which is preferred to use in device drivers?

What are the differences between slab allocator and slub allocator?

What is boot memory allocator?

How do you reserve block of memory?
What is virtual memory and what are the advanatages of using virtual memory?

What's paging and swapping?

Is it better to enable swapping in embedded systems? and why?

What is the page size in Linux kernel in case of 32-bit ARM architecture?

What is page frame?

What are the different memory zones and why does different zones exist?

What is high memory and when is it needed?

Why is high memory zone not needed in case of 64-bit machine?

How to allocate a page frame from high memory?

In ARM, an abort exception if generated, if the page table doesn't contain a virtual to physical map for a particular page. How exactly does the MMU know that a virtual to physical map is present in the pagetable or not?

A Level-1 page table entry can be one of four possible types. The 1st type is given below: 
  • A fault entry that generates an abort exception. This can be either a prefetch or data abort, depending on the type of access. This effectively indicates virtual addresses that are unmapped.

In this case the bit [0] and [1] are set to 0. This is how the MMU identifies that it's a fault entry.

Same is the case with Level-2 page table entry.
Does the Translation Table Base Address (TTBR) register, Level 1 page table and Level 2 page table contain Physical addresses or Virtual addresses?

TTBR: Contain physical address of the pgd base
Level 1 page table (pgd): Physical address pointing to the pte base
Level 2 page table (pte): Physical address pointing to the physical page frame

Since page tables are in kernel space and kernel virtual memory is mapped directly to RAM. Using just an easy macro like __virt_to_phys(), we can get the physical address for the pgd base or pte base or pte entry.


                                           Kernel Synchronization

Why do we need synchronization mechanisms in Linux kernel?
What are the different synchonization mechanisms present in Linux kernel?
What are the differences between spinlock and mutex?
What is lockdep?
Which synchronization mechanism is safe to use in interrupt context and why?
Explain about the implementation of spinlock in case of ARM architecture.
Explain about the implementation of mutex in case of ARM architecture.
Solution

Explain about the notifier chains.
Solution
Explain about RCU locks and when are they used?

Explain about RW spinlocks locks and when are they used?

Which are the synchronization technoques you use 'between processes', 'between processe and interrupt' and 'between interrupts'; why and how ?

What are the differences between semaphores and spinlocks?

                            Process Management and Process Scheduling

What are the different schedulers class present in the linux kernel?

How to create a new process?

What is the difference between fork( ) and vfork( )?

Which is the first task what is spawned in linux kernel?

What are the processes with PID 0 and PID 1?
PID 0 - idle task
PID 1 - init  

How to extract task_struct of a particular process if the stack pointer is given?

How does scheduler picks particular task?

When does scheduler picks a task?

How is timeout managed?

How does load balancing happens?

Explain about any scheduler class?

Explain about wait queues and how they implemented? Where and how are they used?

What is process kernel stack and process user stack? What is the size of each and how are they allocated?

Why do we need seperate kernel stack for each process?

What all happens during context switch?

What is thread_info? Why is it stored at the end of kernel stack?

What is the use of preempt_count variable?

What is the difference between interruptible and uninterruptible task states?

How processes and threads are created? (from user level till kernel level)

How is virtual run time (vruntime) calculated?
Solution

                                      Timers and Time Management

What are jiffies and HZ?
What is the initial value of jiffies when the system has started?

Explain about HR timers and normal timers?

On what hardware timers, does the HR timers are based on?

How to declare that a specific hardware timers is used for kernel periodic timer interrupt used by the scheduler?

How software timers are implemented?

                                       Power Management in Linux



Explain about cpuidle framework.

Explain about cpufreq framework.

Explain about clock framework.

Explain about regulator framework.

Explain about suspened and resume framwork.

Explain about early suspend and late resume.

Explain about wakelocks.

                                          Linux Kernel Modules

How to make a module as loadable module?

How to make a module as in-built module?

Explain about Kconfig build system?

Explain about the init call mechanism.
Solution

What is the difference between early init and late init?
Early init:
  • Early init functions are called when only the boot processor is online.
  • Run before initializing SMP.
  • Only for built-in code, not modules.
Late init:
  •  Late init functions are called _after_ all the CPUs are online.

                                         Linux Kernel Debugging

What is Oops and kernel panic?
Does all Oops result in kernel panic?
What are the tools that you have used for debugging the Linux kernel?
What are the log levels in printk?
Can printk's be used in interrupt context?
How to print a stack trace from a particular function?
What's the use of early_printk( )?
Explan about the various gdb commands.

                                                  Miscellaneous

How are the atomic functions implemented in case of ARM architecture?
Solution

How is container_of( ) macro implemented?  

Explain about system call flow in case of ARM Linux.
What 's the use of __init and __exit macros?
How to ensure that init function of a partiuclar driver was called before our driver's init function is called (assume that both these drivers are built into the kenrel image)?

What's a segementation fault and what are the scenarios in which segmentation fault is triggered?

If the scenarios which triggers the segmentation fault has occured, how the kernel identifies it and what are the actions that the kernel takes? 





ARM Interview Questions:
http://linuxinterviewpreperation.blogspot.in/2013/01/arm-interview-questions.html


C Programming Interview Questions:

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux Device Driver Interview Questions 的相关文章

  • Vmware安装vmware-tools后,仍无法上网

    步骤总结 保证vmware tools安装完成 参考下文步骤一 上一步骤如遇到问题 重启vmware的操作系统 步骤总结 1 保证vmware tools安装完成 2 参考下文 步骤一 VMware Workstation虚拟机不能联网的解

随机推荐

  • HTML-div,span,form,input标签

  • 记录docker 部署nessus

    1 开启容器 docker run itd name ramisec nessus p 8834 8834 ramisec nessus 2 登录 注意是https https ip 8843 3 修改admin密码 进入容器 docker
  • 【自学】若依系统-----权限控制

    文章目录 1 数据表 2 sql查询 3 首页菜单权限核心代码 4 菜单管理功能 5 流程 1 数据表 2 sql查询
  • [算法]LeetCode 专题 -- 二分查找专题 34. 在排序数组中查找元素的第一个和最后一个位置

    LeetCode 专题 二分查找专题 34 在排序数组中查找元素的第一个和最后一个位置 难度 中等 题目描述 给定一个按照升序排列的整数数组 nums 和一个目标值 target 找出给定目标值在数组中的开始位置和结束位置 你的算法时间复杂
  • 章节一:Vue.js简介

    1 1 介绍Vue js的基本概念和历史 Vue js是一个流行的JavaScript前端框架 用于构建交互式的Web界面 它采用了组件化的开发模式 使得构建复杂的用户界面变得简单和高效 Vue js由尤雨溪 Evan You 于2014年
  • C++杂谈 inline关键字

    1 inline 用于把函数指定为内联函数 且该关键字需要与函数定义放在一起 与函数声明放在一起没有效果 2 内联函数一般只适用于比较精简的小函数 实际上内联函数是通过牺牲空间去换取时间上的效率 如果函数过于庞大会造成大量空间的浪费 所以需
  • AWS 亚马逊云良好架构框架

    根据多年来AWS的专家们积累的经验 创建了这一份AWS良好架构框架 其中包含了以下五大支柱 安全性 Security 可靠性 Reliability 性能效率 Performance Efficiency 成本优化 Cost Optimis
  • 产品经理,要有怎样的思维方式?

    一 产品经理有哪些不同的思维方式 从直接回答问题 到先搞清楚问题 一看到问题 马上就想答案 是典型的学生思维 在职场中 面对的问题都是目标不明 信息片面 用户提的问题都是经过扭曲 具有欺骗性 不可完全听信用户的话 或者解决方案是没有标准答案
  • 10没有基于策略的qos_Win10 通过Qos提高网速、解除宽带限制的方法

    win10系统电脑上网 电脑的网速变得越来越慢了 下载文件或软件都要等很久 有时还会出现掉线的问题 检查发现网络并没有什么问题 使用其他电子设备连接宽带 网速却很快 这个可能是和windows10系统保留宽带有关系 Qos 也可能和网卡驱动
  • 4.1.3 为什么技术的尽头是艺术

    最后更新2021 08 22 我们面对太多的未知 无人能精确定义所有可能和现实 我们对自己也一无所知 即使牛顿能精确计算天体运行 也无法预言人心 我们要解决的大部分现实问题都是相对于人 作用于人这种不确定生物的问题 而所有这一切都随时间在改
  • linux的TCP服务器设计C++

    服务器设计的类 myepoll h ifndef MYEPOLL H define MYEPOLL H pragma once include
  • Appscan使用教程——安全测试

    1 appscan的启动与基本配置 说明 这里也可以先点击左下角的 完全扫描配置 选项进行扫描配置 后面再具体讲扫描配置 在 起始URL 下面输入需要启动扫描的URL 如果勾选了 仅扫描此目录中或目录下的链接 如下图 则会只扫描起始URL目
  • Opencv学习笔记-----PCA原理及OpenCV实现

    一 介绍 PCA principal component analysis 就是主分量分析 是一种常用的数据分析方法 PCA通过线性变换将原始数据变换为一组各维度线性无关的表示 可用于提取数据的主要特征分量 常用于高维数据的降维 通过数据降
  • 基于复杂环境下的雷达目标检测技术(Matlab代码实现)

    欢迎关注 个人主页 我爱Matlab 点赞 评论 收藏 养成习惯 一键三连 希望大家多多支持 一起加油 语录 将来的我一定会感谢现在奋斗的自己 摘要 随着雷达技术的迅速发展 其应用领域不断拓展 现代雷达面临着更复杂的检测环境以及更多样的目标
  • sentencepiece原理和使用

    sentencepiece为字词的切分算法 在中文就是感觉就是分词 可能有bpe 还没有确定 在英文中感觉就是bpe 算法过程 拆分句子中有两个变量 一个为词表和句子的切分序列 EM算法 句子的切分序列为隐变量 开始时 随机初始化一个词表和
  • Jupyter下的tensorboard使用

    tensorflow自带的tensorboard功能强大 图像生成 参数变化等都可以进行可视化 不过这个要单独启动才行 使用方法可参考 http wiki jikexueyuan com project tensorflow zh how
  • stm32f4xx开发板的以太网芯片DP83848与LAN8742和LAN8720的区别,以及驱动程序的区别,

    在学习stm32f4xx开的的时候 大家可能遇到 demo板 有的是DP83848 有的是LAN8742 在移植st官方例程的时候 大家可能有个疑问 他们芯片特性有啥区别 以及驱动有啥区别 下面一一介绍介绍 芯片特新的区别 1 DP8384
  • 一分钟解决QT官网无法下载的问题

    QT各个版本下载官网 进去后 我们随意找到一个版本5 14 2 但是 点击安装程序网页并没有执行下载任务 这里我尝试了各种版本 都是下载不了 清华镜像也没找到我想要的版本 下面给出一种在官网下载QT安装程序的方法 1 点击Details 2
  • 专访Sun技术专家:如何理解JavaFX的应运而生

    Java One 2007大会火遍全球 受邀参加2007大会的中国程序员的数量比起往年也提升了很多 带给我们对新鲜事物的理解也有了很大的空间 在我采访Sun的工程师叶亮先生的时候 我们专门探讨了如何理解这次大会上提出的JavaFX 网上其实
  • Linux Device Driver Interview Questions

    本文转载至 http linuxinterviewpreperation blogspot jp 2013 01 linux kernel and device drivers html Linux Device Model LDM Exp