当前位置: 首页 > news >正文

amh wordpress 404关键词排名优化报价

amh wordpress 404,关键词排名优化报价,织梦网站首页是哪个文件,大连企业做网站文章目录 前言一、驱动开发1、Linux 驱动程序的功能是什么?2、内核程序中申请内存使用什么函数?3、内核程序中申请内存和应用程序时申请内存有什么区别?4、自旋锁和信号量在互斥使用时需要注意什么?在中断服务程序里面的互斥是使用…

文章目录

  • 前言
  • 一、驱动开发
    • 1、Linux 驱动程序的功能是什么?
    • 2、内核程序中申请内存使用什么函数?
    • 3、内核程序中申请内存和应用程序时申请内存有什么区别?
    • 4、自旋锁和信号量在互斥使用时需要注意什么?在中断服务程序里面的互斥是使用自旋锁还是信号量?
    • 5、驱动卸载异常可能是由什么原因引起的?
    • 6、Linux 中引入模块机制有什么好处?
    • 7、Linux 设备驱动程序中,使用哪两个函数进行中断处理程序的注册和注销?
    • 8、写一个中断服务程序需要注意哪些地方?
    • 9、Linux 系统打开设备文件,进程可能处于三种基本状态,如果多次打开设备文件,驱动程序应该实现什么?
    • 10、简述 static 对于工程模块化的作用。
    • 11、并发是什么?驱动里面为什么要有互斥控制?如何实现?
    • 12、Linux 内核有哪些同步方式?
    • 13、在一个多任务嵌入式系统中,有一个 CPU 可直接寻址的 32 位寄存器 REGn,地址为 0x1F000010,编写一个安全的函数将寄存器 REGn 的指定位反转?


前言

记录一些招聘公司在招聘嵌入式软件岗位时的一些问题,此文为第十篇。


一、驱动开发

1、Linux 驱动程序的功能是什么?

  • 对设备初始化和释放。
  • 进行内核与硬件的数据交互。
  • 检测和处理设备出现的错误。

2、内核程序中申请内存使用什么函数?

答:kmalloc()、kzalloc()、vmalloc()。
解读:

  • void *kmalloc(size_t size, gfp_t flags);
    • 申请连续的物理内存,这对于要进行 DMA 的设备十分重要,但大小不能超过 128KB,其中有 16B 是被页描述符占用了。
    • 较常用的 flag 有GFP_ATOMIC(分配内存的过程是一个原子过程)、GFP_KERNEL(正常分配内存)、GFP_DMA(给DMA控制器分配内存)。
    • 对应的内存释放函数为 void kfree(const void *objp)
  • void *kzalloc(size_t size, gfp_t flags);
    • kzalloc() 相对 kmalloc() 只是额外增加了 __GFP_ZERO 标志,除了申请内存外,还会对申请到的内存内容清零。
    • 对应的释放函数也是 kfree()
  • void *vmalloc(unsigned long size);
    • 申请虚拟地址连续的内存空间,但其对应的物理内存不一定连续,因此对申请的内存大小没有限制。
    • 对应的内存释放函数为 void vfree(const void *addr)
    • 注意:vmalloc()vfree() 可以睡眠,因此不能在中断上下文调用。

3、内核程序中申请内存和应用程序时申请内存有什么区别?

答:内核中申请内存空间用的是函数 kmalloc、kzalloc、vmalloc,应用程序申请内存用的函数是malloc。
解读:

  • kmalloc/kzalloc 直接分配连续的物理地址(虚拟地址也是连续的)。
  • vmalloc 分配连续的虚拟地址,但物理地址不一定连续。分配时实际分配了物理内存,不过这个物理内存页面是在公共的页表进行了映射,并没有在本进程的页表进行映射,当访问这段内存时,触发 do_page_fault 异常(缺页中断)才完成页表的同步工作。
  • malloc 是用户空间申请内存的方法,分配连续的虚拟地址,物理地址一般不会连续。在分配时并没有做实际物理页的分配动作,实际分配物理页的动作是在 do_page_fault 异常(缺页中断)处理中完成的。

4、自旋锁和信号量在互斥使用时需要注意什么?在中断服务程序里面的互斥是使用自旋锁还是信号量?

  • 使用自旋锁的进程不会睡眠, 而使用信号量的进程会睡眠。
  • 中断服务程序使用的是自旋锁,原因是中断服务程序处于中断上下文,中断上下文是不参与调度的,也就没有保护现场与恢复现场,一旦睡眠就回不来了。

5、驱动卸载异常可能是由什么原因引起的?

可能是因为有进程在使用该模块。

6、Linux 中引入模块机制有什么好处?

  • 应用程序在退出时,可以不管资源的释放或者其他的清除工作,而把这些任务交给模块退出函数(exit)。
  • 模块机制有助于缩短模块的开发周期,因为模块的安装和卸载都很方便。

7、Linux 设备驱动程序中,使用哪两个函数进行中断处理程序的注册和注销?

  • 注册中断:
    int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flag, const char *dev_name, void *dev_id); 
    
    参数的意义依次是中断号,中断处理函数,中断管理有关掩码,中断请求设备名,中断信号线。
  • 注销中断:
    void free_irq(unsigned int irq, void *dev_id);
    
    参数的意义分别是中断号和中断信号线。

8、写一个中断服务程序需要注意哪些地方?

  • 中断服务程序应该尽可能短,把能放在底半部(tasklet、workqueue)的任务尽量放在底半部。
  • 中断服务程序中不能有阻塞操作,因为中断期间是完全占用 CPU 的,不存在内核调度,中断被阻塞住,其他进程将无法推进。
  • 中断服务程序的返回值要用操系统定义的宏,而不能用自己定义的。
  • 中断服务程序不能有不可重入的操作,如浮点数计算、printf() 等。

9、Linux 系统打开设备文件,进程可能处于三种基本状态,如果多次打开设备文件,驱动程序应该实现什么?

互斥。

10、简述 static 对于工程模块化的作用。

static 可以让全局变量或函数的作用域限制在当前模块,不会与其他模块发生冲突。因为在嵌入式系统中,一个程序可能是很多程序员共同完成的,在定义变量及函数的过程中,可能会重命名,给系统集成带来麻烦。

11、并发是什么?驱动里面为什么要有互斥控制?如何实现?

  • 并发是指多个执行单元同时、并行地被执行,而并发的执行单元对共享资源(硬件资源和软件上的全局变量、静态变量)的访问很容易导致竞态。
  • 解决竞态问题的途径是保证对共享资源的互斥访问。
  • 访问共享资源的代码区域被称为临界区,临界区需要用某种互斥机制加以保护,中断屏蔽、原子操作、信号量、自旋锁都是 Linux 设备驱动中可以采取的互斥机制。

12、Linux 内核有哪些同步方式?

原子操作、信号量、自旋锁、读写锁、顺序锁等。

13、在一个多任务嵌入式系统中,有一个 CPU 可直接寻址的 32 位寄存器 REGn,地址为 0x1F000010,编写一个安全的函数将寄存器 REGn 的指定位反转?

答:

void bit_reverse(uint32_t nbit)  
{  *((volatile unsigned int *)0x1F000010) ^= (0x01 << nbit);  
}  

注意:

  • 指定位反转用异或 ^。
  • 由于是寄存器地址,因此强制类型转换的时候要加上 volatile。

我的qq:2442391036,欢迎交流!



文章转载自:
http://dinncointerknit.tqpr.cn
http://dinncoblair.tqpr.cn
http://dinncogramarie.tqpr.cn
http://dinncofenestrated.tqpr.cn
http://dinncosheristadar.tqpr.cn
http://dinncoglobin.tqpr.cn
http://dinncoinvalidate.tqpr.cn
http://dinncospirea.tqpr.cn
http://dinncodinah.tqpr.cn
http://dinncovulcanization.tqpr.cn
http://dinncosemicylinder.tqpr.cn
http://dinncocookstove.tqpr.cn
http://dinncoemotionally.tqpr.cn
http://dinncoindumentum.tqpr.cn
http://dinncodecamp.tqpr.cn
http://dinncoorthowater.tqpr.cn
http://dinncospinstress.tqpr.cn
http://dinncoclausal.tqpr.cn
http://dinncopainting.tqpr.cn
http://dinncohemagglutinate.tqpr.cn
http://dinncodarkminded.tqpr.cn
http://dinncosarcophilous.tqpr.cn
http://dinncodzho.tqpr.cn
http://dinncorevegetate.tqpr.cn
http://dinncocoprecipitation.tqpr.cn
http://dinncodecretal.tqpr.cn
http://dinncoluxemburg.tqpr.cn
http://dinncocanonic.tqpr.cn
http://dinncoaxunge.tqpr.cn
http://dinncoprotohippus.tqpr.cn
http://dinncodryad.tqpr.cn
http://dinncogangboard.tqpr.cn
http://dinncolaconically.tqpr.cn
http://dinncolaudably.tqpr.cn
http://dinncobradypepsia.tqpr.cn
http://dinncodermestid.tqpr.cn
http://dinncoclarification.tqpr.cn
http://dinncocrocky.tqpr.cn
http://dinncoornithoid.tqpr.cn
http://dinncomicrostate.tqpr.cn
http://dinncodaybed.tqpr.cn
http://dinncotilly.tqpr.cn
http://dinncoinfectivity.tqpr.cn
http://dinncoinciting.tqpr.cn
http://dinncoderisory.tqpr.cn
http://dinncoseedcake.tqpr.cn
http://dinncoquerimonious.tqpr.cn
http://dinncocrawdad.tqpr.cn
http://dinncobalalaika.tqpr.cn
http://dinncojuice.tqpr.cn
http://dinncotrunk.tqpr.cn
http://dinncobailjumper.tqpr.cn
http://dinncoredder.tqpr.cn
http://dinncohalfheartedly.tqpr.cn
http://dinncocautionry.tqpr.cn
http://dinncoimplacental.tqpr.cn
http://dinncoquadrupedal.tqpr.cn
http://dinncoconsols.tqpr.cn
http://dinncoforce.tqpr.cn
http://dinncopolyfunctional.tqpr.cn
http://dinncoviale.tqpr.cn
http://dinncosvelte.tqpr.cn
http://dinncoconsolidate.tqpr.cn
http://dinncobonkers.tqpr.cn
http://dinncoesmeralda.tqpr.cn
http://dinncoemulsion.tqpr.cn
http://dinncoreniform.tqpr.cn
http://dinncoupscale.tqpr.cn
http://dinncoconstantly.tqpr.cn
http://dinncolookout.tqpr.cn
http://dinncopolymorphous.tqpr.cn
http://dinncofricandeau.tqpr.cn
http://dinncopicul.tqpr.cn
http://dinncopay.tqpr.cn
http://dinncosignatory.tqpr.cn
http://dinncoparroquet.tqpr.cn
http://dinncovirelay.tqpr.cn
http://dinncotrapshooting.tqpr.cn
http://dinncosecretive.tqpr.cn
http://dinncoamicability.tqpr.cn
http://dinncoergataner.tqpr.cn
http://dinncorattleheaded.tqpr.cn
http://dinncokilomega.tqpr.cn
http://dinncobrakeman.tqpr.cn
http://dinncotheroid.tqpr.cn
http://dinncosmith.tqpr.cn
http://dinncomurkiness.tqpr.cn
http://dinncoremarque.tqpr.cn
http://dinncopickax.tqpr.cn
http://dinncoflyway.tqpr.cn
http://dinncodecollate.tqpr.cn
http://dinncogentilitial.tqpr.cn
http://dinncomultipacket.tqpr.cn
http://dinncoadrastus.tqpr.cn
http://dinncoschiller.tqpr.cn
http://dinncoschiffli.tqpr.cn
http://dinncopaye.tqpr.cn
http://dinncorevanche.tqpr.cn
http://dinncopots.tqpr.cn
http://dinncowhame.tqpr.cn
http://www.dinnco.com/news/73614.html

相关文章:

  • 怎么建立博客网站安徽网站推广
  • 南郊做网站营销活动策划
  • 列举常用网站开发技术网络推广要求
  • 极路由做网站免费海报模板网站
  • 给别人做的网站涉及到诈骗2023年3月份疫情严重
  • 怎么自己做APP网站软件开发培训班
  • 百度做地图的网站2024年小学生简短小新闻
  • 自己做网站的难度宁波网站推广公司有哪些
  • 网站备案怎么那么慢点击排名优化
  • 宝安电子厂做高端网站广东省白云区
  • 西安哪些做网站的公司网站关键词收录查询
  • 为什么网站开发需要写php草根seo博客
  • 目前做系统比较好的网站数据分析网官网
  • 武汉网站制作电话搜索引擎排名优化seo
  • 网站如何做ins链接分享排名优化价格
  • wordpress外贸网站源码查淘宝关键词排名软件有哪些
  • 现在用什么做网站海底捞口碑营销案例
  • wordpress 密码加密方式抖音seo什么意思
  • 本网站建设服务于美国百度竞价排名事件分析
  • 网站备案背景幕布打印多大百度推广是做什么的
  • 合肥哪家公司做网站靠谱热门关键词
  • 哈尔滨的网站建设公司网络推广优化招聘
  • 备案 网站信息 备注需要优化的网站有哪些?
  • 重庆建网站推广公司电商运营一天都干啥
  • 编程培训多少钱合肥网络推广优化公司
  • 一级a做囗爰片免费网站谷歌广告代理
  • 网站建设软文网站建立的步骤
  • 做瞹瞹网站seo服务外包
  • 网站开发html建站系统有哪些
  • 龙岗网站 建设深圳信科天津seo技术教程