Re: locking shared memory pages

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

 



--- "Om.Turyx" <om.turyx@xxxxxxxxx> wrote: 

> Vincenzo Mallozzi wrote:
> > Hi,
> > from the kernel point of view, how can I
> > understand if
> > a memory page is locked?
> > I'll explain better my question by means of an
> > example.

> Even with the example I could not really get what
> you are asking. But 
> let me try....


> > I've two or more threads that, obviously, share
> > some
> > memory regions (so some memory pages). It can
> > happens
> > that one of these threads locks a memory page.

> I assume you mean kernel threads. Or did you mean
> two threads of execution?

I mean user threads. Threads created by means of
library such as "pthread_create" for C or "new Thread"
for Java and so on. 


> > there a way to view that this page is locked by
> > looking at the struct page fields of this memory
> page?

For locked I refer, for example, to a variable for
which one of these threads calls a lock method (C) or
a syncronize method (Java).
Is already valid your dissertation?

> If the page is locked in memory for some Disk I/O,
> you can check the 
> status by testing using page->flags for PG_locked.
> from page-flags.h,
> /*...
> * During disk I/O, PG_locked is used. This bit is
> set before I/O and
> * reset when I/O completes. page_waitqueue(page) is
> a wait queue of all 
> tasks
> * waiting for the I/O on this page to complete.
> */
> > Is there a way to understand if another thread is
> > trying to access to this locked page?
> 
> If you intend to use one page as a shared resource,
> you will have to 
> implement your own locking mechanism for serializing
> the access I think


I need to know if a page is locked by viewing at the
page parameters.
Further, I need to understand if some threads are in a
deadlock state waiting for a lock to be released by
one of they. Have you an idea? Have you heard about an
already existing method or tool?

> 
> HTH,
> Om

I hope I've now well explained the problem.
Very very thanks.
Vincenzo.

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux