locking - Peterson's algorithm using disk instead of memory -


i implement disk based peterson's algorithm mutual exclusion between processes running on 2 separate servers having access same storage.

there several problems find opinion of

1) can safely write single byte disk without impacting other bytes?

i concerned when writing disk, sector, or block (of 4k example) written down, way overwriting other process settings (see next point may benefit out of it, if case.)

should write these bytes next each other or should write each of them in beginning of block know storage write in 1 shot?

2) how can detect crash of server in critical section?

does make sense use 'expected timeout' in stead of 'true' in place of flag? of course way using 'long' instead of 'byte' store flag. assuming both servers having synchronized time. p0 process store instead of 'true' timestamp when p1 process took on in case p0 fails complete. not 100% sure safely write 'long' value without having partially read other server...

i hope these concerns clear, , not making fundamental mistake trying use algorithm.

any thoughts? thank interest or time read it.


Comments