当前位置:首页 » 服务器技术
开发技术指南» 文章正文
    引言: CPU在内核中运行时并不是处处不可抢占的,内核中存在一些空隙,在这时进行抢占是安全的,内核抢占补丁的基本原理就是将SMP可并行的代码段看成是可以进行内核抢占的区域。
 

 

 ·solaris 补丁管理器    »显示摘要«
    摘要:使用最新补丁更新系统,有助于避免出现可用性、安全性和数据完整性风险。solaris 补丁管理器由 sun 推出,可以降低补丁管理工作的复杂性并减少时间消耗,从而降低此类风险。 solaris 补丁管理器是统一的补丁管理解决方案,提供的工具可以帮助您选择并安装补丁,提供的进程可以帮助您保持系统的补丁状态并尽量延长开机时间。 solaris 补丁管理器有两种版本,它们都基于相同的补丁分析引擎: ......
 ·linux网络自动补丁机(1)    »显示摘要«
    摘要:笔者是一个red hat linux系统管理员,管理着网络中几十台redhat linux 9主机。对于linux这样的开放式系统,和其他私有操作系统(windows/solais)相比, 发行商的短期支持策略使得网管经常需要上相应的网站看,是否有补丁,是否有了bug 修复,是否需要升级。千万不要报侥幸心理,否则一个shell脚本就可能拿下你的网站。套用一句名言:你的服务器永远可能在第二天被黑客接......


Linux操作系统内核抢占补丁的基本原理
上一页   ...reschedule: call symbol_name(schedule) # test jmp ret_from_sys_call include/asm/hw_irq.h: ... #ifdef config_preempt #define bump_contex_switch_lock \ get_current \ "incl 4(%ebx)\n\t" #else #define bump_contex_switch_lock #endif #define save_all \ 硬件中断保护入口现场 "cld\n\t" \ "pushl %es\n\t" \ "pushl %ds\n\t" \ "pushl %eax\n\t" \ "pushl %ebp\n\t" \ "pushl %edi\n\t" \ "pushl %esi\n\t" \ "pushl %edx\n\t" \ "pushl %ecx\n\t" \ "pushl %ebx\n\t" \ "movl $" str(__kernel_ds) ",%edx\n\t" \ "movl %edx,%ds\n\t" \ "movl %edx,%es\n\t" \ bump_contex_switch_lock # 硬件中断的入口禁止内核抢占 include/linux/spinlock.h: #ifdef config_preempt #define switch_lock_count() current->preempt_count #define in_ctx_sw_off() (switch_lock_count().counter) 判断当前进程的抢占计数 是否非零 #define atomic_ptr_in_ctx_sw_off() (&switch_lock_count()) #define ctx_sw_off() \ 禁止内核抢占 do { \ atomic_inc(atomic_ptr_in_ctx_sw_off()); \ 当前进程的内核抢占计数增1 } while (0) #define ctx_sw_on_no_preempt() \ 允许内核抢占 do { \ atomic_dec(atomic_ptr_in_ctx_sw_off()); \ 当前进程的内核抢占计数减1 } while (0) #define ctx_sw_on() \ 允许并完成内核抢占 do { \ if (atomic_dec_and_test(atomic_ptr_in_ctx_sw_off()) && \ current->need_resched) \ preempt_schedule(); \ } while (0) #define spin_lock(lock) \ do { \ ctx_sw_off(); \ 进入自旋锁时禁止抢占 _raw_spin_lock(lock); \ } while(0) #define spin_trylock(lock) ({ctx_sw_off(); _raw_spin_trylock(lock) ? \锁定并 测试原来是否上锁 1 : ({ctx_sw_on(); 0;});}) #define spin_unlock(lock) \ do { \ _raw_sp
...   下一页
 ·opensuse补丁教程 (kernel 2.6.x)    »显示摘要«
    摘要:什么是内核 内核是 linux 系统的核心,提供硬件抽象层、磁盘及文件系统控制、多任务并发管理等底层功能的系统部件。 什么是补丁 linux 内核是由 kernel 小组 (http://www.kernel.org) 维护的,他们在首页提供最新稳定版的内核源代码下载地址。这是原始的纯净内核代码。 如上所述,出于种种原因,一般要对原始内核进行修改。而修改源代码的工作是由打补丁实现的,每......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE