C

共58篇文章。

一个不太明显的安全问题

Security

在内核里面,程序的结构大概是这样:

现在问题来了,上面这些东西的问题是什么?应该如何解决?

阅读全文…:一个不太明显的安全问题(本文约235字,阅读大致需要1分钟)

BerkeleyDB使用中的cache同步问题

Development

今天被一个程序折腾了很久。大致的流程是这样:

事件处理:

  • 打开db文件,如果已经打开,直接使用该handle
  • 获得排他锁,并读某一key对应的value
  • 根据value和一些环境信息以及事件所附带的输入计算新的value
  • 更新value,并同步文件、释放排他锁

锁的机制没有大毛病,可是数据死活不对。

阅读全文…:BerkeleyDB使用中的cache同步问题(本文约166字,阅读大致需要1分钟)

*BSD queue.h

Kernel

Derived from the ancient BSD Unix, *BSD has a set of queue related macros which are described in queue(3), and implemented in src/sys/sys/queue.h. These are primarily used in the kernel, but also useful for userland applications.

阅读全文…:*BSD queue.h(本文约100字,阅读大致需要1分钟)

AMD64 string function optimizations

Development

So time comes that we should consider whether some of our string operations is not optimial and needs some operation. NetBSD seems to have done a lot of good work to make their MD layer better, and we should take these improvements if they are proven.

David O’Brien has pointed out that we should be careful on this, however, since some micro optimizations may hinder performance in a large scenario. With this concern in mind, I will redo some more benchmarks and request for -arch@’s idea before considering commiting the patchset. Currently, the NetBSD implementation of swab(2) is proven to be slower than the GCC generated code by about 25%. I will look into the assembly code generated to see whether I can help to solve this.

阅读全文…:AMD64 string function optimizations(本文约160字,阅读大致需要1分钟)
搜索文章…(按ESC退出)