Chinaunix首页 | 论坛 | 博客
  • 博客访问: 346402
  • 博文数量: 168
  • 博客积分: 6895
  • 博客等级: 准将
  • 技术积分: 1726
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-12 23:01
文章分类

全部博文(168)

文章存档

2011年(6)

2010年(162)

我的朋友

分类: LINUX

2010-10-04 01:52:38

    kernel developer improve our code all the time.
    When we turn a process to another, it will call function context_switch() in kernel/sched.c file. It can complete two function:
    1, it can call switch_mm() function to  rearrange virtual address to the new on in the file of include/asm/mmu_context.h.
    2, it can also call switch_to() function to turn a processor's state to another including stack information, register information, etc.
    So, kernel give us a need_resched logo to see if it is necessary to call schedule(). Kernel can call scheduler_tick() function to set the logo and try_to_wake_up() function also can do this.
    Every process can include the need_resched logo to see if it is necessary to. Kernel can visit the logo is faster than global variable so it is good.
    Before edition of 2.2 this logo is a global variable. During edition 2.2 to 2.4 is in task_struct. In edition 2.6 is in thread_info structure.
   So We can know kernel developer improve our code all the time from need_resched logo.

Reference book:
 
《Linux Kernel Design and Implementation》 written by Robert Love.
    
阅读(355) | 评论(0) | 转发(0) |
0

上一篇:10 3

下一篇:How to hack Gnu api

给主人留下些什么吧!~~