| PLEX86 | ||
|
SynchronizationConcurrency establishing critical sectionsNTP not starting up correctly Hello all, i am having a hard time getting ntp up and running. Right now i am trying to just set up the server machine (which will get its time from teh internet and then... Is there a way for a Linux (and in general any POSIX compliant)thread to define a critical section such that once a thread enters the critical section, it will not be swapped out until the thread leaves the critical section? I do understand the ramifications of what I am asking ---- especially the potential for mischief and abuse. The traditional way for implementing synchronization is to acquire a semaphore or mutex when an operation begins, and to release it when the operation finishes. This mechanism does not guarantee that the thread will not be swapped out ----- it merely guarantees that other threads that attempt to acquire the semaphore-mutex, while it is in use, will be blocked. To make this mechanism work in a Single Writer Multiple Reader scenario, both read and write access have to be made via the semaphore-mutex. In the case where the write operation happens somewhat rarely, it may impose unnecessary overhead on the read operation. On the other hand, if there is a way to do what I am proposing (ensuring that when a thread enters a critical section, it is not swapped out), we can perform the write operation within the critical section, and the read operations can be performed normally (i.e. without resorting to the use of semaphores or mutexes). As far as I know, usually the BEGINCRITICALSECTION macro (or call) in most of the RTOSs actually disables interrupts so you will not be disturbed while in that section. A quick google search on this yields only mutex, semaphores and conditional variables for protecting critical sections with POSIX. Thanks, Bhat
|
||||
Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||