Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c - inter processes shared memory and pthread_barrier: how to be safe? -


i wanted simple solution inter processes barrier. here solution: solution

but totally lost mmap... first try, fails 1 out of ten times (segfault or deadlock).

i understand problem comes synchronization issue, can't find it. found example set mmaped memory (example), not sure mmaped pthread_barrier.

here extract of code:

#define mmap_file "/tmp/mmapped_bigdft.bin"  void init_barrier() {   pthread_barrier_t *shared_mem_barrier;   pthread_barrierattr_t barattr;   pthread_barrierattr_setpshared(&barattr, pthread_process_shared);    hbcast_fd = open(mmap_file, o_rdwr | o_creat | o_trunc, (mode_t)0600);   result = lseek(hbcast_fd, sizeof(pthread_barrier_t)-1, seek_set);   result = write(hbcast_fd, "", 1);   shared_mem_barrier = (pthread_barrier_t*) mmap(0, sizeof(pthread_barrier_t), prot_read | prot_write, map_shared, hbcast_fd, 0);   if (mpi_rank == 0) {     int err = pthread_barrier_init(shared_mem_barrier, &barattr, host_size);   }   mpi_barrier(some_communicator); } 

questions:

  • do miss in mmap initialization?
  • which operation should performed processes, , should one?

new question

which safier managing pthread barrier? or based on same mechanism?

  • shmget
  • shm_open
  • mmap
  • another one

as charles has mentioned, looks truncation what's getting you. also, should initialise attributes using pthread_barrierattr_init.

as other question, 1 process should initialisation, , processes should call pthread_barrier_wait (just mpi).

i saw other question, know why don't want use mpi. you'd single mpi barrier initialise pthread barriers, so:

if (rank == 0) {   /* create shared memory segment, initialise barrier. */ } mpi_barrier(communicator); if (rank != 0) {   /* load shared memory segment, cast pthread_barrier_t* , store.    * it's initialised */ } 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -