Arganzheng's Blog

stay hungry, stay foolish

BDB事务共享区域

最后我们来看一下事务共享区域。 首先仍然是每个进程都有的一个数据结构__db_txnmgr{}: /* * The transaction manager encapsulates the transaction system. It contains * references to the log and lock managers as well as the state that keeps * track of the shared memory region. */ struct __db_txnmgr { /* These fields need to be protected for multi-threaded support. */ ...

MPOOL共享内存

2009-5-6 星期三 晴朗 在BDB中所有的共享内存都定义为XXX_REGION{}结构。 比如MPOOL缓冲区,每一个进程有自己的缓存数据结构DB_MPOOL{}: /* * DB_MPOOL -- * Per-process memory pool structure. */ struct __db_mpool { /* These fields need to be protected for multi-threaded support. */ db_mutex_t *mutexp; /* Structure lock. */ /* List of pgin/pgout routin...

BDB日志共享区域

这一次我们对日志共享区域进行分析。 每个进程都有一个DB_LOG{}数据结构: /* * DB_LOG * Per-process log structure. */ struct __db_log { /* These fields need to be protected for multi-threaded support. */ db_mutex_t *mutexp; /* Mutex for thread protection. */ DB_ENTRY *dbentry; /* Recovery file-id mapping. */ #define DB_GROW_SIZE 64 ...

BDB锁共享区域

这一次我们以锁共享区域分析。 /* * The lock table is the per-process cookie returned from a lock_open call. */ struct __db_locktab { DB_ENV *dbenv; /* Environment. */ REGINFO reginfo; /* Region information. */ DB_LOCKREGION *region; /* Address of shared memory region. */ DB_HASHTAB *hashtab; /* ...

如何确保C库可以正确被C++客户端程序调用

上学期在Linux下打算用C写一个FTP,使用Stevents写的一些C库函数,结果发现在链接的时候老是说找不到那些C库函数,后来才发现我虽然用C来编写代码,但是我在编译的时候却是使用了C++编译器,结果由于Stevents的C库没有考虑给C++客户端使用,所以就找不到了。后来改成用C编译器就没有问题了。 gcc -g -O2 -D_REENTRANT -o ftpClient utility.o ftpClient.o /home/forrest/Projects/socket/unpv13e/libunp.a -lpthread 有些同学会觉得奇怪,C++不是包含C吗,难道要是C被C++调用还需要作什么处理吗?答案是是的。原因在C++为了支持重载在编译期间...

×