The files of information in appropriate format are known as file. Each and every application programs such as ms-word, ms-excel, notepad need to store information and retrieve main requirement for application program with related with file are storage space, easy access to categories file, to provide security to file etc. so , different terminologies like file naming, file attributes, file type, file structure, file access are used.
The essential requirements for long term information storage are:-
1. It must be possible to store very large amount of information.
2. The information must survive the termination of the process using it.
3. Multiple processes must be able to access the information concurrently.
To fulfill this requirement the information is stored in logical units called file. Any process can read / write the file and create new one when necessary files are managed by a part of operating system called as file system. Some example of file system is. Fat, fat16, fat 32, ntfs (net technology file system), ext2, ext3, ext 4 etc
Files are an abstraction mechanism. They provide the way to store information and read it back later but this process is shielded from user. Hiding the details of how and where the information is store and how the disk actually works. The exact rules of file naming vary from system to system, but all current operating system allows string of letters as legal filenames frequently, digits and special characters are also permitted. Many file system support names as long as 255 characters.
Many operating system support too part filenames, with the two part separated by a period. In ms-dos, file name has 1-8 character and extension depends on user.
The main purpose of extension is to categorize a file.
Files can be structured in any of several ways. Three common possibilities are shown below. The file schedule in figure 1 is an unstructured sequence of bytes. Here, operating system does not know about content of file just operating system take it as collection of bytes. Any remaining must be imposed by user level programs. User program can out anything they want in files and name them any way that is convenient. The operating system does not help, but is also does not get in the way.
In the model of fig B a file is in a sequence of fixed length records each with some internal structure. The control idea to this model is that the read operation returns one read and the write operation overwrites or appends one record. In third kind of structure a file consists of a tree of record and not necessarily all the same length, each consisting o key field in a fixed position in the record. The tree is sorted in the key field to allow rapid searching for a particular key.
Every file has its name and date. In edition operating system associates some extra information with each files, these extra items are called file attribute. The list of attributes varies from system.
Files exist to store information and allow it to be retrieved later. Different systems provide different operations to allow storage and retrieval. Some of the file operations are given below.
1. Create: – the file is created with no data. The purpose of the call is to announce that the file is coming and to set some of the attributes.
2. Delete: – When the file is no longer needed, it has to be deleted to free up the memory.
3. Open: – it opens before using file; a process must open the file.
4. Close: – when all access to file are finished, the file should be closed. To free up internal table space containing file attributes and disk address.
5. Read: – It is used to read the data from file. The caller must specify how much data is needed and must provide a buffer to put them in.
6. Write: – It is used for writing data to the file.
7. Append: – to append some content of the end of file already created.
8. Seek: – for random access file, to specify from where to take the data.
9. Get attribute: – processes often need to read file attributes to do their work. This call is mode to get the attribute of the file.
10. Set attributes: – it sets the attributes to file.
11. Rename: – to change name of file.
To keep track of the files, directories or folders. They are used with simply are collecting of files are in some system file itself.
*types of directory systems
1. Single hierarchy directory system
2. Two level directory system
3. Hierarchical directory system
When the files are organized in directory tree, it uses two ways to specify the filenames with paths. In fact method, each file is given an absolute path, name consisting of the path from the root directory to the file. For example, /usr/wrc/dct means that, the root directory contains sub directory wrc and it contains sub directory wrc. Which contain the file dct Absolute path names always starts at the root directory and they are unique. In UNIX, components of the path are separated by / and in ms dos components are separated by \.
The other kind of name is relative path name. This is used conjunction with the concept of the working directory. A user can designate one directory as working directory as the current working directory, in which case all path names not beginning at the root directory are taken relative to the working directory. If current working directory is /usr/wrc, then the file whose absolute path is /usr/wrc/dct can be represented simply as dct.
Some of the directory operations are described below:-
1. CREATE: – a directory is created. It creates empty space to put files and sub-directory mkdir is used in UNIX.
2. DELETE: – a directory is deleted only empty directory can be deleted to perform this operation, the directory must be empty.
3. OPENDIR: – directory can be read. To list all the files in a directory, this operation is performing. Before read directory. It must open similar to opening and reading files.
4. CLOSEDIR: – when the display has been read, it should be closed to free up internal table space.
5. READDIR: – this call returns the next entry in an open directory.
6. RENAME: – directory can be renamed.
7. LINK: – linking is a technique that allows a file to appear in more than one directory. This system call specifies on existing file and a path name, and creates a link from the existing file to the name specified by path.
8. Unlink: – a directory entry is removed if the file being unlinked is only present in one directory.
Implementations of files
Implementation is concern with how files and directories are stored, how disk space is managed and how to make everything work efficiently and reliably. The most important issue in implementing file stages is keeping track of which disk blocks go with which file various methods are used in different operating system. Some of the methods are given below:-
a. Contiguous allocation
b. Linked list allocation
It is to make sure the data and files are not read and modified by unauthorized person. The protections include technical, managerial, legal and political issues. The term protection mechanism refers to the specific operating system mechanism used to safe guard information in the computer.
Mechanism vs. policy
In contest of protection of data in computer, system, policy refers to whose data are to be protected from whom and mechanism refers to the way in which the data are protected from unauthorized user.
The policy contains all the information about authorized user in table and mechanism contains detail how the authentication is provided for authorized user and how the information is protected.
The mechanism is more complex than the policy in some system, protection is enforced by a program called reference monitor.
The thing that to be protected in computer system may either is hardware or software. The common name of this thing is object. The object have name and set of operations that process are allowed to carry fact on it. For example, read and write are two operations appropriate to file. The operating system must have way or mechanism to prohibit processes from accessing objects that are not authorized to access.
A domain is a set of pairs. Each pair specifies an object and some subject of the operation that can be performed on it. A right in this computer means permission to perform one of the operations.
Above figures shows three domains showing the objects in each domain and the right available on each object. Here, printer 1 is in two domains at the same time. It is also possible to be same object in different domains with different rights in each one. At every instant of time, each process runs in same protection domains. In other hands, there are same collections of objects it can access, and per each object it has some set of rights. Processes can also switch from domains to domains during execution. The rules for domain switching are highly system dependent.
Let us describe an example of UNIX operating system. In UNIX, the domain of a process is defined by its wid and gid. Here wid means user id and gid means group is. Given any combination, it is possible to make a complete list of all objects that can be accessed, and whether they can be accessed for reading, writing or executing two processes with the same combination will have access to exactly the same set of objects. Processes with different values will have access to a different set of iles, although there will be considerable overlap in must access.
The implementation belongs to object and domains are kept non matrix form. The rows being the domains and columns being the objects as shown in figure above
In above matrix, these are many blank elements so it makes the memory wastage. This can be improved in ACL.
Access control list:-
The matrix containing all objects and domains is very large and occupy more space. Most domain have no access at all to most objects, so storing a very large, mostly enough, matrix is a waste of disk space to avoid this problem, the new technique is used in which only non empty element are taken. A technique consists of associating with each object a list containing all the domains that may access the object and how. This list is called Access Control List (ACL).
Let us take an example of UNIX how ACL works. In UNIX the domain is specified by a pair. Let us now assume that we have four users (i.e. wids) David, subash, sita, gita. Who belongs to group (gid) system, staff, students and student respectively. Suppose that some files have following ACLS:
File 0: (David,*, rwx)
File 1: (David, system, rwx)
File 2: (David, *, rw-), (subash, staff, rw-), (sita,*, rw-)
File 3: (*, student, r–)
File 4: (gita,*, —), (*, student–)
Each ACL entry, in parenthesis, specifies a wid, a gid and the allowed accessing. An * means all wids and gids file0 can be read, written, executed by any process with wid = David and gid system. A process that has wid= David and gid = staff can access file0 but not file 1. The file 2 can be read or written by processes with wid=David & gid= staff. It can also have read or write accessing to wid= sita and any gid. Similarly, file3 have access only to read for any wid having wid = gita and any gid have no access and any wid and gid student have only read.
In reality, UNIX provides three bit rwx, per file for the owner’s, the owner’s group and others. Therefore, it uses nine bits. The owner of an object can change its ACL at any time.
Different allocation algorithm is used for variable or dynamic storage allocation.
1. First fit: – The memory manager scan list of segments until it finds the first hole that is big enough to hold the requirement. In this method, the search begin for the hole starting at first block and ends as soon as the block large enough to held the requirement is found.
2. Best fit: – In this method, all the available memory blocks are searched, the block that is best swited to implement is selected.
3. Next fit: – It is advancement of first fit. It work the same ways as first, except that is start searching the list from the place where it lefts off last time, instead of always at the beginning as first does.
4. Worst fit:- In this method, an incoming process is placed in the hole which leaves the maximum amount of unused space .i.e. Current largest hole, i.e. it always takes the largest available hole.
- Introduction to operating system Operating System: An operating system is a collection of system...
- Input and Output system The process of giving input to computer and giving output...
- Introduction to Processes in operating system Early computer system allowed any one program to be...
- Operating System Structure operating system structure: An operating system might have many structure....
- [info] Why can’t windows ( notepad ) display Linux text files properly? Windows text editors like notepad cannot display the text files...