Re: Question about "fd" token

From: Paul H. Hargrove (PHHargrove_at_lbl_dot_gov)
Date: Thu Jun 18 2009 - 23:59:50 PDT

  • Next message: Cacre Marco, IT: "checkpoint / restart gtkfb gui application"
    In "test_and_set_bit(0, &var)" the "0" is NOT a value to set. It tells
    which bit in var should be set to 1. There is also a
    test_and_clear_bit() which assigns "0" to the specified bit. Both of
    these calls return the previous value of the bit they write to. So, each
    call to test_and_set_bit(0, &var) sets bit number 0 of var and returns
    its previous value. As used in the code you are quoting from, this means
    that the first task to call "!test_and_set_bit(0,&var)" for a given
    "var" returns 1 (because the bit was 0 before) while every call after
    the first returns 0 (because the bit is now 1, and remains 1). One could
    achieve the same thing with "!atomic_swap(&var,1)", where this time the
    "1" IS the value to assign to var.
    
    In the older BLCR version you mention, we were only able to deal with
    single-process checkpoints. In more current versions we are able to deal
    multi-process checkpoints and the "proc_req" is, as you have guessed,
    the structure that holds the per-process information in a checkpoint or
    restart request. So, each "req" includes portions that are independent
    or common to all processes, and a list of "proc_req" structures that
    contain the per-process information (which was contained in "req" when
    we only dealt with single processes).
    
    -Paul
    
    ����� wrote:
    > Hello, Professor:
    >
    > How can we ensure information can be dumped only once or per process ?
    >
    > For example :
    >
    > the file header about scope & version , we need to write just once.
    >
    > Resources that are shared among the threads (such as memory mappings
    > and file descriptors) are written out only once, by the first thread.
    > we write it to the file per process.
    >
    > I see the code in dump_self.c , not the way I supposed to be.
    >
    > down(&req->serial_mutex);
    >
    > if (!test_and_set_bit(0, &req->done_header)) {
    >
    > result = cr_save_file_header(req, dest_filp);
    > ...
    > }
    > up(&req->serial_mutex);
    >
    > there are many bool variable in the structure "req" and "proc_req" ,
    > like done_header, but every time a thread come to execute the code
    > section above, they can enter and do "cr_save_file_header", for
    > "done_header" is set to "0" again...
    >
    > By the way, In the early version of BLCR, there is just one structure
    > "req"(instanse of that struct, for convenience). In the later version,
    > "proc_req" is introduced. Once I supposed structure "proc_req" is used
    > to handle something per process. But now it seems not right. Please
    > tell me the main goal of the introducion of "proc_req"?
    >
    > Thank you very much
    >
    >
    >
    >
    >
    >
    >
    > ===============================================
    > ��������һ������TOM�������ɣ���������1.5G������ʲô��
    > <http://bjcgi.163.net/cgi-bin/newreg.cgi?%0Arf=050602>
    > ===============================================
    >
    
    
    -- 
    Paul H. Hargrove                          PHHargrove_at_lbl_dot_gov
    Future Technologies Group                 Tel: +1-510-495-2352
    HPC Research Department                   Fax: +1-510-486-6900
    Lawrence Berkeley National Laboratory     
    

  • Next message: Cacre Marco, IT: "checkpoint / restart gtkfb gui application"