Ten Years

十年一剑!
-------------------------------------------------
Operating System Research / Technique

Sunday, September 24, 2006

(HotOS'03 Note)Cosy: Develop in User-Land, Run in Kernel-Mode

Cosy: Develop in User-Land, Run in Kernel-Mode
Amit Purohit et al.
HotOS 2003

这篇文章的动机就不用说了,还是kernel crossing问题。只不过更加激进一些,将system call和相关代码一起打包,送到内核态下去了。Cosy exploits zero-copy techniques and code aggregation to achieve better performance without reducing the security.注意code aggregation,我觉得这是和multi-call等方法的差别,是其特点。

内核做了一些扩展,包括cosy_init, cosy_run, cosy_uninit
编译器做了一些扩展,Cosy-GCC,支持各种控制结构。
做了一个库,Cosy-Libbuffer management是一个重要问题。

安全方面,主要通过内核抢占防止死循环,用x86 segmentation来进行内存保护。

一个例子。原始代码:
-----------------------------------------------------------
cosy_init();

COSY_START();
ifd = open(ifile, O_RDONLY);
ofd = open(ofile, O_WRONLY);
do {
  rlen = read(ifd, buf, 4096);
  wlen = write(ofd, buf, rlen);
} while (wlen == 4096);
COSY_END();

cosy_unit();
-----------------------------------------------------------
经过编译,变成:
-----------------------------------------------------------
cosy_init();

cosy_start();
cosy_open(&ifd, ifile, O_RDONLY);
cosy_open(&ofd, ofile, O_WRONLY);
cosy_do();
  cosy_read(&rlen, ifd, buf, 4096);
  cosy_write(&wlen, ofd, buf, 4096);     /*文中是这样,我认为应该是rlen*/
cosy_while(wlen, “==”, 4096);
cosy_run();
cosy_uninit();

0 Comments:

Post a Comment

<< Home