Distributed Systems: File Models
Distributed Systems: File Models
File Models
File Models- Introduction
• EXAMPLE: Fifth record from beginning, second record from the end.
Unstructured Files
• Flexibility maximized
1. Unix semantics
2. Session Semantics
3. Immutable shared-files semantics
4. Transaction-like semantics
Unix Semantics
Absolute Ordering
Client A Append(d)
read
a b a b
a b c a b c a b c d a b c d e a b c d e
a b c
t1 t2 t3 t4 t5 t6
delayed
Append(c) Append(d) read
Client B
Network Delays
Session Semantics
Append(e) a b c d e
Append(x) a b x
Close(file)
Append(y) a b c y
a b c d e
Append(z) a b c d z
Open(file) a b c d e
Close(file)
a b c d z
Append(m) a b c d e m
Close(file)
a b c d e m
Close(file)
Transaction-like semantics
• All changes occur automatically.
• Begin transaction, perform operations and end transaction.
• Partial modifications made to the shared data by a
transaction will not be visible to other concurrently
executing transaction until the transaction ends.
• The final file content is the same as if all the transactions
were run in some sequential order.
File-Sharing Semantics
Transaction-Like Semantics
(Concurrency Control)
Backward validation Forward validation
Client A Client B Client C Client D Client A Client B Client C Client D
Trans_start Trans_start
Compare reads with Compare write with
R1 R1 later reads
former writes
R2 R2
Trans_start Trans_start
W3 W3
R4 R1 R4 R1
W5 R2 Trans_start W5 R2 Trans_start
W6 W6
validation R1 validation R1
R4 R4
Commitment W7 R2 Commitment W7 R2
Trans_start Trans_start
Trans_end W9 Trans_end W9
R1 R1
R4 R4
R2 Trans_abort R2
W8 W8
Trans_end R6 Trans_restart R6
R8 R8
W8 W8
Trans_end Trans_end
Trans_abort
Abort itself or conflicting active transactions
Trans_restart
Trans_end
Tentative Tentative
based on based on
1.0 1.0
Version
1.1
Version conflict
Abort
Depend on each file system.
Version Version
Abortion is simple (later, the client A can 1.2 1.2
Decide to overwrite it with its tentative 1.0
by changing the corresponding directory) Ignore conflict Merge
Summary
• File model
– Unstructured and structured files
– Mutable and Immutable files