Re: Semaphore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Tue, Feb 21, 2012 at 6:14 PM, Dave Hylands <dhylands@xxxxxxxxx> wrote:
> Hi Santosh,
> On Tue, Feb 21, 2012 at 5:47 AM, SaNtosh kuLkarni
> <santosh.yesoptus@xxxxxxxxx> wrote:
>> A certain  kernel process has acquired a semaphore lock and meanwhile during
>> this period the process gets killed abruptly (and it has not released the
>> sem lock..//.sem down).....and the other processes cannot acquire the lock,
>> what can be done in this case.
> Normally, the semaphore would be associated with a driver of some
> type. If the process opened the driver, then regardless of how the
> process dies, the file that was opened by the process will eventually
> be closed by the kernel and the driver's release function will get
> called. This gives you the opportunity to release the semaphore. The
> driver would be responsible for tracking the state of the semaphore.
> Fundamentally the driver is responsible for cleaning up all of the
> resources that it may be using, and a semaphore is just another
> resource, like memory.
> I'm assuming that the semaphore is one which is held across multiple
> calls into the kernel, otherwise you don't have an issue in the first
> place, unless there is a bug on the kernel side of things which
> actually caused the process to terminate.

Ok, but what happens if things go wrong?
For example, it driver exists abnormally (segmentation fault or something)?
Anyway, it seems very strange that the responsibility is of a driver alone!
There is the *kernel* in the system to take care of abnormal
situation, not the exit function of a driver...

--- KostaZ

Kernelnewbies mailing list

[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux