[ CnUnix ] in KIDS 글 쓴 이(By): HellCat ((void*)0) 날 짜 (Date): 1994년04월22일(금) 02시29분23초 KST 제 목(Title): re: locking sync. using pthread_mutex_t with thread is totally different from sync. with processes. first, posix thread is not finalized yet as far as I know. Currently, I only have access to draft 6 of Pthreads or POSIX threads. Sync. within threads under the same process is relatively straight forward but when it goes over process boundary, it seems to me that it needs lots of caution. If it is just for file I/O among diff. processes, I would just recommend Advisory File locking (not even mandatory locking) unless it needs to be broken down to threads. Playing with pthread_mutex, there are just too many things for a simple job to worry about if it is among processes not threads. - e.g. priority of scheduling, process-shared attribute, aync-safe ...icing.. Also, I think Inter-process mutexes are very inefficient yet - at least on system I have - using lock table seems to be way faster and easier than using Inter-process attributed Mutex; it would be different story if you are willing to change your code to use threads under A process and use Intra-process attribute Mutex. Well..it's again all based on what kinda appl. you're dealing with; even on single processor system, threading can be very helpful for I/O parralleism..async. computation...windowing.. But on the matter of file locking...I would definitely go with FILE lock table usage..even inside thread. Maybe because I'm beginner on threads ... --- if (t_snddis(KIDS[i].fd, (struct t_call *)NULL) == -1) { t_error("날 죽여라!!"); longjmp ((jmp_buf) HELL, -1); } |