Re: [rvm-research] about the lock() in freelist
王晨曦 <[email protected]>
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <CAECgty-y24wfGuvBSfgUhSH89GjGrDBB=8JrVZdtHmX79poQBQ@mail.gmail.com> |
Hi,Robin Thank you very much. I understand how the lock works. I'm sorry for response so late. On Thu, Jun 11, 2015 at 9:18 AM, Robin Garner <[email protected]> wrote: > > You will see that the lock() method is inherited from the PageResource > class, which acquires a lock on the instance variable 'lock'. This > tells you that what is being locked is this specific instance of > FreeListPageResource. The only threads blocked by this lock are ones > that a) are allocating in the same space, and b) have to allocate fresh > blocks from the PageResource. Blocks are sized so as to make (b) > infrequent. > > [1] http://users.cecs.anu.edu.au/~steveb/downloads/pdf/mmtk-icse-2004.pdf 1) Yes, The lock() used in the FreeListPageResource.java/allocPages is defined in PageResouce.java private final Lock lock It's not a static object. Every space has its own pr(protected PageResource pr; ), so only the threads in the same Space (such as threads in the immix) will be synchronized by this lock. But the lock in the Map.java is defined as: private static final Lock lock = VM.newLock("Map lock"); It's a static object. So every thread no matter which Space it belongs to will be synchronized by this static lock. And the Map.lock is used to synchronize the Chunk allocate. 2) I have read the paper ,but I'm still confused about how to judge which method will be accessed concurrently by multi-threads , which method will only be accessed by the main thread. I know that , every thread start by call the function startoff() in the RVMThread.java, then these threads will run concurrently. So, every method in this path( start from startoff() ) will be accessed by multi-threads ? I'm a little confused about the architecture of jikesrvm's multi-threads model. -- ChenXi.Wang ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o