Re: Re: Question about "fd" token

From: ÀîºêÁÁ (lihongliang070_at_tom.com)
Date: Fri Jun 05 2009 - 22:33:39 PDT

  • Next message: ÀîºêÁÁ: "Re: Re: Question about "fd" token"
    Hello professor:
    
    There is a problem which has been puzzling me all the time when I read the code of BLCR, Everytime I met with those part of the code I just try to understand it , but still can not understand it very well. Now I think it¡¯s time to consult you about the ¡°Cr_barrier¡±.
    
    For example: code section in cr_dump_self:
    
        /* Now use vmadump to write out the state for the thread.
           ALL threads call this and serialization is done within */
       ...
        bytes = cr_freeze_threads(proc_req, 0, i_am_leader);
        if (bytes < 0) {
    	result = (int)bytes;
    	...	
    cr_barrier_notify(&proc_req->vmadump_barrier);
    	goto out;
        }
        CR_KTRACE_LOW_LVL("thread finished vmadump");
    
        /* Need a barrier here to ensure all threads write their regs before the next
         * write to the file.
         */
        if (cr_barrier_enter(&proc_req->vmadump_barrier)) {
    	CR_KTRACE_LOW_LVL("process finished vmadump");
        }
    
    It seemed to use cr_barrier_enter to ensure all threads write their regs before the next write to the file. Why can not a thread continue to write before all threads write their regs just through invoking this function? I know it use semaphore & condition Variables ? Can you help me to understand how it works? 
    
    I will be very greateful if you can introduce more about ¡°barrier¡± to me systematially . Please forgive me if you think it as an excessive demand. Thank you.
     
    
    

  • Next message: ÀîºêÁÁ: "Re: Re: Question about "fd" token"