OpenJDK on FreeBSD
Maho今天正式commit了 OpenJDK 的port,表面上看这是一小步,但在我看来这却是一项历史性的进步,因为终于可以不再受到之前那个 click-through 许可证的限制了(也就是说,可以几乎没有任何限制地随光盘,或者通过网站提供可用的jdk源代码和二进制版本了)。
阅读全文…为什么是RAID-Z[2]而不是RAID-5
注意:如果您熟悉RAID请不必浪费时间阅读这篇文章。
为什么用RAID-Z/RAID-Z2而不是RAID-5呢?
答案是:RAID-5有一个不可避免的问题,即它必须使用后备电源才能保证写入的正确性。这也是为什么我一直极力反对使用低档RAID卡和软件实现的RAID-5的原因。
阅读全文…1987年
1987年,菲律宾前总统访华,谈到南沙主权问题时说:“至少在地理上,那些岛屿离菲律宾更近。”
邓小平抽了口烟,说:“在地理上,菲律宾离中国也很近。”
阅读全文…一道小学数学题
很久没有shared chaos了,今天来一道小学数学题。
有一个水池,进水的速度恒定,提前接了一定时间的水;水池有若干出水口均在底部,假设所有出水口的出水速度一样(换言之,每多开一个出水口,速度即相应线性提高—-本人注)。同时打开3个出水口,水池水位在80秒后会下降到0;同时打开4个出水口,水池水位在50秒后会下降到0;问:如果同时打开8个出水口,水位需要多长时间下降到0?
参与评论fgetc()返回值是int而不是char
其实是个很简单的常识,居然搞了我半个小时……
fgetc()的返回值是int,因为这个值除了返回拿到的字符之外,还兼作错误标志。由于fgetc()允许文件中包含任意内容,所以只好增大返回值的宽度来表达。
阅读全文…一个问题请教WxWidget高手
WxClassInfo的析构函数(~WxClassInfo)死循环是什么原因?检查发现RTTI的那个链表有个环,但是不太明白这个表(从上下文看是由Register()方法维护的)为什么能出现环?
阅读全文…BeOS Reborn: Haiku
Pretty interesting project: Haiku.
It looks like that it uses a lot of FreeBSD code by creating glue between FreeBSD and BeOS API, on the other hand they are using MIT license for most of their code, making sharing code easy.
参与评论memchr(3) rewrite
I have taken some time to rewrite memchr(3) to utilize similiar algorithm as my strlen(3) did. Two different formular, however, would have a roughly 1/3 difference.
Currently I have taken an approach that when memchr(3) is trying to match a pattern of 8-bit, then consider the string as 8-bit, which uses the first formular which is expected to have uniform O(n) time complexity by reducing unnecessary branches.
This approach, however, might be bogus since if you find 7-bit character within a 8-bit string, in that case, memchr(3) would perform poorly, if there are a lot of characters having their MSB as 1.
阅读全文…GCC运行环境豁免条款再次狠狠地打了苹果的耳光
今年 1 月 27 日发表的 《GCC运行环境豁免条款 (英文版)》 再次狠狠地打了苹果的耳光。
原先的豁免条款如下:
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
Progress on LLVM clang
As some of you already know, FreeBSD, along with some other Open Source projects, is moving away from GCC due to GPLv3. From a technology perspective, this also makes sense since the (likely) candidate, BSD-style licensed, LLVM based clang, a C compiler, is making reasonably good progress.
So, what should we expect from LLVM or clang?
Here is a good comparison between GCC and clang. Despite GCC is popular, considerably more mature, and supports more languages (especially C++, which clang’s support is incomplete at this moment), clang provides cleaner AST (Abstract Syntax Tree), much more modularized (if you take a look at GCC’s history, Richard Stallman intentionally made GCC’s code not reusable in other software), provided much more information for optimizer, is much faster and use much less memory, etc.
For FreeBSD, currently, clang can compile its kernel with only very few tweaks.
阅读全文…