Explain File Management in An Operating System
Explain File Management in An Operating System
Student will be able : ~ To describe the following file organization techniques : a. sequential b. direct c. indexed sequential d. partitioned
Student will be able : ~ To Identify which file organization technique is appropriate for a specific device
File System
Function Applies
To organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data as well as manage the available space on the device(s) which contain it.
organizes data in an efficient manner and is tuned to the specific characteristics of the device.
used on data storage devices, such as hard disk drives, floppy disks, optical discs, or flash memory storage devices, to maintain the physical locations of the computer files.
Field
Record
File
Flat file
Report generation
Databases
Directories
Arrangement of records within files All files composed of records Modify command
Request to access record within a file
Volatility of datafrequency with which additions & deletions made. Activity of file% records processed during a given run. Size of file. Response timeamount of time user is willing to wait before requested operation is completed.
Divide
13
14
15
16
17
Easiest to implement File search: beginning until record found Optimization features may be built into system
Select key field from record and sort records by that field before storage Complicates maintenance algorithms Preserve original order when records added, deleted
computed when records are stored & again when records are retrieved.
Advantages: 1) Fast access to records. 2) Can be updated more quickly than sequential files because records quickly rewritten to original addresses after modifications 3) No preservation of records order 4) Adding, deleting records is quick
Disadvantage: 1) Several records with unique keys may generate same logical address (collision)
22
You
have been expose to FOUR types of file organization techniques. Identify which file organization technique is appropriate for a specific device Activity Duration: 30 minutes
Student will be able : ~ To describe the three types of file structure a. Unstructured (byte sequence) b. Structured (record sequence) c. Complex structure (Tree)
1.
2.
3.
29
Ant
Cow Chick
cat
dog owl
pony
hen
lamb
tiger
(c)
1 byte
(a)
1 record
(b)
Three kinds of file structure ; a. Byte sequence b. Record sequence c. Tree structured
30
The operating system does not know or care what is in the file. All it sees are BYTES. Any meaning must be imposed by user-level programs. Both UNIX and Windows use this approach. Having the operating system regard files as nothing more than byte sequences provides the maximum flexibility. User programs can put anything they want in their files and name them any way that is convenient
1 byte
Collections of bytes treated as a unit Example : employee records Operation at the level of records (read_rec, write_rec)
1 record
Read operation returns one record and the write operation overwrites or appends one record
Fig. ( b) : a file is a sequence of fixed-length records, each with some internal structure
The tree is sorted on the key field, to allow rapid searching for a particular key Example: Search keyword pony, without worrying about its exact position in the file New records can be added to the file, with the operating system, and not the user, deciding where to place them Records of variable length
Record retrieval base on key
Fig. ( c ) : a file consists of a tree of records, not necessarily all the same length, each containing a key field in a fixed position in the record
Student will be able : ~ To describe the various methods of file allocation a. Contiguous b. Linked list Non Contiguous (blocks) c. Linked list Non Contiguous (index)
Records subdivided into fields Application programs manage record structure Three methods:
1) Contiguous file allocation 2) Linked list non-contiguous (using blocks) 3) Linked list non-contiguous (using index)
Divide
Disadvantages
Difficult file expansion External Fragmentation ? poor performance - file grows too large and must be moved
Files use any available disk storage space File records stored in contiguous manner
If enough empty space
Directory level
Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk.
block
pointer
Eliminates external storage fragmentation Eliminates need for compaction Simple need only starting address No random access
Advantage
Disadvantage
Logical view.
Does not necessarily improve storage space use Larger files experience several index levels Need index table
Advantage
Disadvantage
Given the directory for Contiguous file allocation. Draw a diagram of how file management solve the problem.
File Tug_1
Exer_3 Nota Song Pict
Start 8
0 12 25 16
Length 3
4 2 6 4
Given the directory for Linked list non-contiguous (using blocks) :: Directory level file allocation. Draw a diagram of how file management solve the problem.
File Tug 1(1) 1 : Address 512 : Size 5 Next
Tug 2(1)
Tug 1(2) Nota 1(1)
4
5 6
512
512 512 : :
14
19 18
14 15 :
18 19 20
15 20
A file management system is a set of system software that provides services to users and applications in the use of files, including file access, directory maintenance and access control. The file management system is typically viewed as a system service that itself is served by the operating system, rather than being part of the operating itself. A file consists of a collection of records. If a file is to be processed as a whole, then a sequential file access is the simplest and most appropriate.
If sequential access is needed but random access to an individual file is also desired, than an indexed sequential file