c++ - Should I have to create a thread if I want to make distributed mutex library? -


i trying write simple lock/unlock algorithm behaves mutex in distributed systems c++.

it implemented library , users able use using interface file.

assume there 3 processes {a,b,c}.

each processors knows other processes' addresses , ports , on.

if a wants lock on object, has permission other processes, in case b , c.

i believe sending , waiting replies b, , c won't problem, because user call function.

but, how should b, , c receive message?

it guaranteed processes alive.

should there separate thread each processor running listening(polling) sockets?

does mean if create thread in constructor, , use while process running, , destroying @ destructor fine?

should there separate thread each processor running listening(polling) sockets?

you should use library inter-process communication, unless intend build scratch excercise. if want build yourself, read wikipedia article , maybe chapters books on operating systems (like tanenbaum or silberschatz).

for specific problem of mutual exclusion in distributed systems, see maekawa's algorithm.

does mean if create thread in constructor, , use while process running, , destroying @ destructor fine?

if plan implement that, why not. distributed systems use layered approach (see http://www.erlang.org/course/error_handling.html in erlang tutorial example). layer collection of communicating , cross-dependent processes, work towards common goal. 1 of processes can act connection lower layer , process connection higher layer. implement complete layer in 1 operating system process using threads, created upon process creation , destroyed when destroying process. depends on want achieve , path take.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -