S/N Multiprocessing Multiprogramming
1 Multiprocessing refers to processing of multiple processes at same time by multiple CPUs.
Multiprogramming keeps several programs in main memory at the same time and execute them concurrently utilizing single CPU. 2 It utilizes multiple CPUs. It utilizes single CPU.
3 It permits parallel processing. Context switching takes place. 4 Less time taken to process the
jobs.
More Time taken to process the jobs.
5 It facilitates much efficient utilization of devices of the computer system.
Less efficient than multiprocessing.
FILE MANAGEMENT SYSTEM
A file is a named collection of related information that is recorded on secondary storage such as magnetic disks, magnetic tapes and optical disks. In general, a file is a sequence of bits, bytes, lines or records whose meaning is defined by the file creator and user.
File Access Mechanisms
File access mechanism refers to the manner in which the records of a file may be accessed. There are several ways to access files
• Sequential access • Direct/Random access • Indexed sequential access
Sequential access: A sequential access is that in which the records are accessed
in some sequence i.e., the information in the file is processed in order, one record after the other. This access method is the most primitive one. Example: Compilers usually access files in this fashion.
Direct/Random access
• Random access file organization provides, accessing the records directly. • Each record has its own address on the file with by the help of which it can
• The records need not be in any sequence within the file and they need not be in adjacent locations on the storage medium.
Indexed sequential access
• This mechanism is built up on base of sequential access.
• An index is created for each file which contains pointers to various blocks. • Index is searched sequentially and its pointer is used to access the file
directly.
ATTRIBUTES OF A FILE
Following are some of the attributes of a file:
➢ Name. It is the only information which is in human-readable form.
➢ Identifier. The file is identified by a unique tag(number) within file
system.
➢ Type. It is needed for systems that support different types of files. ➢ Location. Pointer to file location on device.
➢ Size. The current size of the file.
➢ Protection. This controls and assigns the power of reading, writing,
executing.
➢ Time, date, and user identification. This is the data for protection,
FILE TYPE
S/N FILE TYPE USUAL
EXTENSION
FUNCTION
1 Executable exe, com, bin Read to run machine language program
2 Object obj, o machine language not
linked
3 Source Code C, java, pas, asm, a Source code in various languages
4 Batch bat, sh Commands to the
command interpreter
5 Text txt, doc Textual data,
documents
6 Word Processor wp, tex, rrf, doc Various word processor formats
7 Archive arc, zip, tar Related files grouped into one compressed file
8 Multimedia mpeg, mov, rm For containing
audio/video information
FILE CONCEPTS
The most important function of an operating system is the effective management of information. The modules of the operating system dealing with the management of information are known as file system. The file system provides the mechanism for online storage and access to both data and programs. The file system resides permanently on secondary storage, which has the main requirement that it must be able to hold a large amount of data, permanently. The desirable features of a file system are:
➢ Minimal I/O operations. ➢ Flexible file naming facilities. ➢ Automatic allocation of file space. ➢ Dynamic allocation of file space.
➢ Unrestricted flexibility between logical record size and physical block size. ➢ Protection of files against illegal forms of access.
➢ Static and dynamic sharing of files. ➢ Reliable storage of files.
This lesson is primarily concerned with issues concerning file storage and access on the most common secondary storage medium, the disk.
A file is a collection of related information units (records) treated as a unit. A record is itself a collection of related data elements (fields) treated as a unit. A field contains a single data item.
So, file processing refers to reading/writing of records in a file and processing of the information in the fields of a record.
File operations
Major file operations are performed are as follows:
➢ Read operation: Read information contained in the file.
➢ Write operation: Write new information into a file at any point or overwriting existing information in a file.
➢ Deleting file: Delete a file and release its storage space for use in other files.
➢ Appending file: Write new information at the end of a file. ➢ Execute ➢ Coping file ➢ Renaming file ➢ Moving file ➢ Creating file ➢ Merging files ➢ Sorting file ➢ Comparing file
File Naming
Each file is a distinct entity and therefore a naming convention is required to distinguish one from another. The operating systems generally employ a naming system for this purpose. In fact, there is a naming convention to identify each resource in the computer system and not files alone.
File Sharing and Locking
The owner of a file uses the access control list of the file to authorize some other users to access the file. In a multi-user environment a file is required to be shared among more than one user. There are several techniques and approaches to affect this operation. File sharing can occur in two modes:
i. Sequential sharing
ii. Concurrent sharing.
Sequential sharing occurs when authorized users access a shared file one after
another. So, any change made by a user is reflected to other users.
Concurrent sharing occurs when two or more users access a file over the same
period of time. Concurrent sharing may be implemented in one of the following three forms:
a) Concurrent sharing using immutable files: In it any program cannot modify the file being shared.
b) Concurrent sharing using single image mutable files: An image is a view of a file. All programs concurrently sharing the file see the same image of the file. So changes made by one program are also visible to other programs sharing the file.
c) Concurrent sharing using multiple image mutable files: Each program accessing the file has its own image of the file. So many versions of the file at a time may exist and updates made by a user may not be visible to some concurrent user.
There are three different modes to share a file:
➢ Read only: In this mode the user can only read or copy the file.
➢ Linked shared: In this mode all the users sharing the file can make changes in this file but the changes are reflected in the order determined by the operating systems.
➢ Exclusive mode: In this mode a single user who can make the changes (while others can only read or copy it) acquires the file.
Another approach is to share a file through symbolic links. This approach poses a couple of problems - concurrent updating problem, deleting problem. If two users try to update the same file, the updating of one of them will be reflected at a time. Besides, another user must not delete a file while it is in use.
File locking gives processes the ability to implement mutually exclusive access to a file.
Locking is mechanism through which operating systems ensure that the user making changes to the file is the one who has the lock on the file. As long as the lock remains with this user, no other user can alter the file. Locking can be limited to files as a whole or parts of a file.
Locking may apply to any access or different levels of locks may exist such as read/write locks etc.
FILE DIRECTORIES
Collection of files is a file directory. The directory contains information about the files, including attributes, location and ownership. Much of this information, especially that is concerned with storage, is managed by the operating system. The directory is itself a file, accessible by various file management routines.
Information contained in a device directory are: • Name
• Type • Address
• Current length • Maximum length • Date last accessed • Date last updated • Owner id
• Protection information
Operation performed on directory are: • Search for a file
• Create a file • Delete a file • List a directory • Rename a file
• Traverse the file system
Advantages of maintaining directories are:
• Efficiency: A file can be located more quickly.
• Naming: It becomes convenient for users as two users can have same
name for different files or may have different name for same file. • Grouping: Logical grouping of files can be done by properties e.g. all
java programs, all games etc.
SINGLE-LEVEL DIRECTORY
In this a single directory is maintained for all the users.
• Naming problem: Users cannot have same name for two files.
TWO-LEVEL DIRECTORY
In this, separate directories for each user is maintained.
• Path name: Due to two levels there is a path name for every file to locate that file.
• Now, we can have same file name for different user. • Searching is efficient in this method.
TREE-STRUCTURED DIRECTORY
Directory is maintained in the form of a tree. Searching is efficient and also there is grouping capability. We have absolute or relative path name for a file.