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.

deadlock - Small openmp programm freezes sometimes (gcc, c, linux) -


just write small omp test, , not work correctly times:

#include <omp.h> int main() {   int i,j=0; #pragma omp parallel   for(i=0;i<1000;i++)   { #pragma omp barrier     j+= j^i;   }   return j; } 

the usage of j writing threads incorrect in example,

  • there must nondeterministic value of j

  • i have freeze.

compiled gcc-4.3.1 -fopenmp a.c -o gcc -static

run on 4-core x86_core2 linux server: $ ./gcc , got freeze (sometimes; 1 freeze 4-5 fast runs).

strace:

[pid 13118] futex(0x80d3014, futex_wake, 1) = 1 [pid 13119] <... futex resumed> )       = 0 [pid 13118] futex(0x80d3020, futex_wait, 251, null <unfinished ...> [pid 13119] futex(0x80d3014, futex_wake, 1) = 0 [pid 13119] futex(0x80d3020, futex_wait, 251, null                                                <freeze> 

why have freeze (deadlock)?

try making private each loop has it's own copy.

now have more time, try , explain. default variables in openmp shared. there couple of cases there defaults make variables private. parallel regions not 1 of them (so high performance mark's response wrong). in original program, have 2 race conditions - 1 on , 1 on j. problem 1 on i. each thread execute loop number of times, since being changed each thread, number of times thread executes loop indeterminate. since threads have execute barrrier barrier satisfied, come case hang on barrier never end, since not threads execute same number of times.

since openmp spec states (omp spec v3.0, section 2.8.3 barrier construct) "the sequence of worksharing regions , barrier regions encountered must same every thread in team", program non-compliant , such can have indeterminate behavior.


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 -