|
一、学习笔记
1.多任务系统分为两类:非抢占式多任务、抢占式多任务
2.进程主动挂起自己的操作叫做让步
3.进程分为:I/O消耗型、处理器消耗型
4.调度策略在进程相应迅速和最大系统利用率之间寻找平衡
5.Linux采用两种不同的优先级范围:nice值、实时优先级,nice值越大优先级越低。任何实时进程的优先级都高于普通的进程。
6.linux内核不是将数据结构塞入链表而是将链表节点塞入数据结构
7.操作链表:
链表增加节点
list_add(srtuct list_head *nes,struct list_head *head)
节点添加到表尾
list_add_tail(struct list_head *new,struct list_head *head
删除节点
list_del(struct list_head *entry)
移动和合并节点
list_move(struce list_head *list,struct list_head *head
检查链表是否为空
list_empty(struct list_head *head
连接两个链表
list_splice(struct list_head *list,struct list_head *head
连接并初始化两个链表
list_splice_init(struct list_head *list,struct list_head *head)
遍历链表最简单的方法是使用list_for_each()宏
list_for_each_entry()的安全版本只能保护在循环体中删除数据。如果此时从其它地方并发进行删除或是由任何并发的链表操作则必须锁定链表
用Markdonw写东西好累。。。。还是记事本好 ~_~ 好难过不开心
8、队列操作
linux内核通用队列实现称为kfifo
创建队列
int kfifo_alloc(struct kfifo *fifo,unsigned int>
推入数据到队列
unsigned int kififo_in(struct kfifo *fifo,const void *from,unsigned int len)
摘取数据
unsigned int kfifo_out(struct kfifo *fifo,void *to,unsigned int len
重置kfifo
static inline void kfifo_reset(struct kififo *fifo)
撤销分配队列
void kfifo_free(struct kfifo *fifo)
9.映射
映射要支持的三个操作:
Add(key,value)
Remove(key)
value=Lookup(key)
初始化一个idr
void>
查找UID
void *idr_find(struct>
删除UID
void>
撤销idr
void>
10、时间复杂度
O(g(x))---------------------------名称
1----------------------------------恒量
logn-------------------------------对数的
n----------------------------------线性的
n^2--------------------------------平方的
n^3--------------------------------立方的
2^n--------------------------------指数的
n!--------------------------------阶乘
二、实验操作
-S的作用是在启动时冻结CPU
-s的作用是为 gdb tcp:1234 创建了一个gdb server
|
|
|