| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5948 人关注过本帖
标题:计算机2
只看楼主 加入收藏
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
结帖率:98.63%
收藏
 问题点数:0 回复次数:10 
计算机2
内核如何跟踪它是否能够被抢占?

回想一下,可知系统中的每个进程都有一个特定于体系结构的 struct thread_info 实例。

该结构也包含了一个抢占计数器(preemption counter )

<asm-arch/thread_info.h>

struct thread_info {
...
        int preempt_count;        /* 0  =>  可抢占, <0 =>  Bug */
...
}

preempt_count 为零,则内核可以被中断, 否则不行。

该值只能通过 dec_preempt_count , inc_preempt_count 两个函数对计数器减1 或 加 1。

每次内核进入重要区域,需要禁止抢占时,都会调用inc_preempt_count。

退出该区域时,调用dec_preempt_count 将抢占计数器减1


[ 本帖最后由 madfrogme 于 2012-10-11 18:27 编辑 ]
搜索更多相关主题的帖子: 计算机 counter 计数器 如何 
2012-10-09 22:37
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
进程的入队和离队都比较简单,

只需以 p->prio 为索引访问 queue 数组 queue[p->prio] ,

即可获得正确的链表,将进程加入链表或从链表删除即可, 新进程总是排列在每个链表的末尾

kernel/sched.c

struct rt_prio_array {
    DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1); /* include 1 bit for delimiter */
    struct list_head queue[MAX_RT_PRIO];
};


[ 本帖最后由 madfrogme 于 2012-10-11 18:27 编辑 ]

The quieter you become, the more you can hear
2012-10-09 22:50
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
实时进程与普通进程有一个根本的不同之处: 如果系统中有一个实时进程且可以运行,

那么调度器总是会选中它运行, 除非有另一个优先级更高的进程

The quieter you become, the more you can hear
2012-10-09 23:01
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
内核线程没有自身的用户空间内存上下文, 可能在某个随机进程地址空间的上部执行,

其 task_struct->mm 为 NULL, 从当前进程“借来”的地址空间记录在 active_mm

The quieter you become, the more you can hear
2012-10-09 23:08
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
1. One thing that segmentation can do that paging can't, and that's set the ring level.

2. GRUB sets a GDT up for you.


[ 本帖最后由 madfrogme 于 2012-10-10 17:15 编辑 ]

The quieter you become, the more you can hear
2012-10-10 16:12
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

The quieter you become, the more you can hear
2012-10-10 16:43
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
Note for the %'d one to work you must have already set your locale as in the following example:

#include <locale.h>
#include <stdio.h>

int main(void)
{
    setlocale(LC_ALL,"");
    printf("%'d\n",1234);
}

$ ./a.out
1,234

The quieter you become, the more you can hear
2012-10-11 17:26
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
Any separate partition that you want

automatically mounted upon boot

 needs to be specified in the /etc/fstab

The quieter you become, the more you can hear
2012-10-17 14:25
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 

ARP spoofing attack

Generally, the goal of the attack is to

associate the attacker's MAC address with the IP address of a target host,

so that any traffic meant for the target host will be sent to the attacker's MAC instead.

The quieter you become, the more you can hear
2012-10-19 14:27
madfrogme
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:21
帖 子:1160
专家分:1106
注 册:2009-6-24
收藏
得分:0 
The popen function accepts as its first argument a string containing a shell command, such as lpr.

Its second argument is a string containing either the mode argument r or w.

If you specify r, the pipe will be open for reading; if you specify w, it will be open for writing.

The quieter you become, the more you can hear
2012-10-23 23:45
快速回复:计算机2
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016428 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved