Linux device drivers学习笔记(1)

1、   对于LDD3上所介绍的技术:休眠,唤醒,阻塞和非阻塞操作,异步通知这一系列的操作所针对的对象都是进程。所以,在讨论驱动程序时,需要将现在的思路换一换,现在写程序的思路还停留在前后台系统中,即使在有操作系统的情况下也是如此。所以,要学习Linux下多进程和多线程的编程,伴随而来的是进程之间的通信问题,同步问题,调度问题……记录一下,fork可以创建子进程,子进程与父进程共享代码段,但是数据段和堆栈段是重新申请的。申请后的数据段和堆栈段会复制父进程的数据段和堆栈段。所以,在fork后的第一时间,父子进程是代码、数据相同的两个进程。但是fork函数的返回值不同,这样可以通过返回值的不同进入不同的分支,完成不同任务,从此父子进程并发的执行,数据段和堆栈中的信息也会发生不同的变化。创建子进程付出的是内存空间的消耗。但如果程序处理的好的话,可以增加CPU的效率和系统的吞吐量。

2、 “硬件+附属于软件的数据结构+附属于软件的操作方法”三者构成了设备。

3、  关于Linux中断处理的顶半部和底半部。

顶半部是指通过request_irq注册的中断例程,在顶半部的执行时间应该尽可能短,并且需要有一定的注意事项。所谓的中断底半部是被中断顶半部调度的进程或者是任务。底半部运行时,所有的中断都是打开的,可以被新的中断打断。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux Device Driver (3edtion)原版 1. An Introduction to Device Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 The Role of the Device Driver 2 Splitting the Kernel 4 Classes of Devices and Modules 5 Security Issues 8 Version Numbering 10 License Terms 11 Joining the Kernel Development Community 12 Overview of the Book 12 2. Building and Running Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Setting Up Your Test System 15 The Hello World Module 16 Kernel Modules Versus Applications 18 Compiling and Loading 22 The Kernel Symbol Table 28 Preliminaries 30 Initialization and Shutdown 31 Module Parameters 35 Doing It in User Space 37 Quick Reference 39 3. Char Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 The Design of scull 42 Major and Minor Numbers 43 Some Important Data Structures 49 ,ldr3TOC.fm.4587 Page v Thursday, January 20, 2005 9:30 AMvi | Table of Contents Char Device Registration 55 open and release 58 scull’s Memory Usage 60 read and write 63 Playing with the New Devices 70 Quick Reference 70 4. Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Debugging Support in the Kernel 73 Debugging by Printing 75 Debugging by Querying 82 Debugging by Watching 91 Debugging System Faults 93 Debuggers and Related Tools 99 5. Concurrency and Race Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Pitfalls in scull 107 Concurrency and Its Management 107 Semaphores and Mutexes 109 Completions 114 Spinlocks 116 Locking Traps 121 Alternatives to Locking 123 Quick Reference 130 6. Advanced Char Driver Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 ioctl 135 Blocking I/O 147 poll and select 163 Asynchronous Notification 169 Seeking a Device 171 Access Control on a Device File 173 Quick Reference 179

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值