Tuesday, December 22, 2009

PThread RWLock

For thread synchronization, use of mutex (mutual exclusion) is a very common. Mutex doesn't provide more advanced synchronization, when one thread is locking a mutex, another thread can't acquire it until it has been released. It's very expensive syncronization for some case.

POSIX threading library provide another high level synchronization, a RWLock (read and write lock), when locking in read mode, another thread can acquire the read lock (shared lock) but not with the write lock, with write lock, another thread can't acquire the lock until it has been unlocked (exclusive lock). This clear, with a RWLock mechanism, we can't avoid expense of mutex when we try only to read. No inconsistency effect when some thread try to read the same protected data.

The POSIX functions for RWLock operation:

Lock initialization
pthread_rwlock_init()

Lock in read mode
pthread_rwlock_rdlock()
pthread_rwlock_tryrdlock()

Lock in write mode
pthread_rwlock_wrlock()
pthread_rwlock_trywrlock()

Release lock
pthread_rwlock_unlcok()

Monday, December 21, 2009

Don't feel so good

I don't feel so good today, maybe because my sleep isn't enough last night or got a fever, i don't have much spirit for coding the TCT right now. Anty call me, she complain about my internet activity and told that i always make her feel stupid. Wiwin still wait. I'm sorry for you all, my bad.

Sunday, December 20, 2009

Lazy for writing

I admit, i have been too lazy to update my blog. Here some news that i need to tell:

  • I'm learning the CONFIG_PREEMPT_RT patch for realtime Linux task.

  • I'm writing TCT simple database library, at this time my only option is SQLite, since the simple library is currently in heavy development, by me, alone, with no good theory of database system.

  • And the coolest thing that I already got new home at Pulo Asem, there are some hot girls there, I'm enjoying that place for this time.


That's all, i'll try to update my blog just in time. This night in Office, with Dwi and Gunarto, Gunarto play Facebook Pooker and Dwi is sleeping.