algorithm in linux C.