write_chunk
write_chunk(data->pat, chunk_idx, thread_num);
write_chunk(p_pat, chunk_idx, 1);
write_chunk(p_pat, chunk_idx, 0);