File Locking and File Blocking:

File Locking:


File locking enables a process to implement mutually exclusive access to a file. File locking can be implemented in the following three ways:


A file can be locked as a whole or partially.

File locking may be applied on any access or different levels. Some systems provide both read and write locks. If a file is locked for reading, other processes can read it but cannot write. If a file is locked for writing, other processes cannot read or write it.

Locks can be mandatory or advisory. In mandatory lock, operating system does not allow to access the file while it is locked. In advisory lock, locking primitives provide information about file's lock status.


File Blocking:


Block is the unit on which I/O system performs I/O operations. Usually, the block size is a multiple of disk sector size. Blocking is a method that determines how records in a. file are placed in blocks. Following are types blocking:


Fixed Blocking: In fixed blocking, the blocks are of same-size. Each block contains an integral number of records. If the record and block size is given, operating system can compute block and offset within the block of a record.

Un-spanned Blocking: It is used when records are of variable size. Multiple records can be stored in each block but a record cannot be stored in multiple blocks. It means that record size should not be greater than block size. If a record is less than the block and the next record does not fit in the remaining space, it is wasted.

Spanned Blocking: In spanned blocking, records can be stored in multiple blocks. There is no restriction on block size and block space is not wasted. In order to computer a record's location, the size of all records have to sum that precede it.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Blog Archive

Powered by Blogger.

- Copyright © 2013 Taqi Shah Blogspot -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -