Refine write_to_ram multithread version. Still unable to run yet.
Add multithread app