Chinaunix首页 | 论坛 | 博客
  • 博客访问: 852205
  • 博文数量: 189
  • 博客积分: 4310
  • 博客等级: 上校
  • 技术积分: 1925
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-27 08:56
文章分类

全部博文(189)

文章存档

2015年(1)

2013年(2)

2012年(1)

2011年(39)

2010年(98)

2009年(48)

分类: LINUX

2009-12-21 15:42:12

Applications are laid out in virtual memory with a very large stack area. The stack, of course, is used to hold the function call history and all automatic variables created by currently active functions. The kernel, instead, has a very small stack; it can be as small as a single, 4096-byte page. Your functions must share that stack with the entire kernel-space call chain. Thus, it is never a good idea to declare large automatic variables; if you need larger structures, you should allocate them dynamically at call time.
Often, as you look at the kernel API, you will encounter function names starting with
a double underscore (__). Functions so marked are generally a low-level component
of the interface and should be used with caution. Essentially, the double underscore
says to the programmer: “If you call this function, be sure you know what you are
doing.”
Kernel code cannot do floating point arithmetic. Enabling floating point would
require that the kernel save and restore the floating point processor’s state on each
entry to, and exit from, kernel space—at least, on some architectures. Given that
there really is no need for floating point in kernel code, the extra overhead is not
worthwhile.
阅读(721) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~