Lesson 9
Lesson 9
Lesson 9
Note : The user can only view up-to-the System Programs he can’t see System
Calls.
files.
interrupt.
5. File Modification – For modifying the contents of files we use this. For
for loading programs and libraries. It is one of the essential stages for
implemented by the operating system to ensure the security and integrity of the
protection:
Access control: The operating system uses access control lists (ACLs) to
Encryption: The operating system can use encryption to protect sensitive data
System updates and patches: The operating system must be kept up-to-date
with the latest security patches and updates to prevent known vulnerabilities
prevent unauthorized access to the system, protect sensitive data, and ensure
users might safely share a common logical name space such as directory or files.
Role of Protection:
defines the uses of resources in the computer system. Some policies are defined
at the time of design of the system, some are designed by management of the
system and some are defined by the users of the system to protect their own
files and programs. Every application has different policies for use of the
resources and they may change over time so protection of the system is not only
should also design the protection mechanism to protect their system against
something will be done and policies determine what will be done. Policies are
changed over time and place to place. Separation of mechanism and policy is
5. Prevents malware and other security threats from infecting the system
6. Allows for safe sharing of resources and data among users and
applications
measures
4. Can create a false sense of security if users are not properly educated
measures.
manage files and directories on a storage device. Some common types of file
systems include:
5. APFS (Apple File System): A new file system introduced by Apple for
2. Data protection: File systems often include features such as file and
disk.
operating systems.
2. Disk space overhead: File systems may use some disk space to store
The name of the file is divided into two parts as shown below:
● name
system‘s job is to keep the files organized in the best way possible.
A free space is created on the hard drive whenever a file is deleted from it. To
reallocate them to other files, many of these spaces may need to be recovered.
Choosing where to store the files on the hard disc is the main issue with files
one block may or may not be used to store a file. It may be kept in the disk’s
non-contiguous blocks. We must keep track of all the blocks where the files are
partially located.
Author C Append
Close
Usual
File type Function
extension
C, java, pas,
Source Code Source code in various languages
asm, a
Word
wp, tex, rrf, doc Various word processor formats
Processor
FILE DIRECTORIES
The collection of files is a file directory. The directory contains information about
the files, including attributes, location, and ownership. Much of this information,
● Name
● Type
● Address
● Current length
● Maximum length
● Protection information
● Create a file
● Delete a file
● List a directory
● Rename a file
● Naming: It becomes convenient for users as two users can have same
name for different files or may have different name for same file.
SINGLE-LEVEL DIRECTORY
● Naming problem: Users cannot have the same name for two files.
● Path name: Due to two levels there is a path name for every file to
● Now, we can have the same file name for different users.
The 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.
FILE ALLOCATION METHODS
Continuous Allocation
A single continuous set of blocks is allocated to a file at the time of file creation.
Thus, this is a pre-allocation strategy, using variable size portions. The file
allocation table needs just a single entry for each file, showing the starting block
and the length of the file. This method is best from the point of view of the
individual sequential file. Multiple blocks can be read in at a time to improve I/O
performance for sequential processing. It is also easy to retrieve a single block.
For example, if a file starts at block b, and the ith block of the file is wanted, its
next block in the chain. Again the file table needs just a single entry for each file,
showing the starting block and the length of the file. Although pre-allocation is
possible, it is more common simply to allocate blocks as needed. Any free block
can be added to the chain. The blocks need not be continuous. An increase in file
fragmentation because only one block at a time is needed but there can be
internal fragmentation but it exists only in the last disk block of the file.
Disadvantage
● If the pointer of any disk block is lost, the file will be truncated.
Indexed Allocation
It addresses many of the problems of contiguous and chained allocation. In this
case, the file allocation table contains a separate one-level index for each file:
The index has one entry for each block allocated to the file. The allocation may
improves locality. This allocation technique supports both sequential and direct
access to the file and thus is the most popular form of file allocation.
Disk Free Space Management
Just as the space that is allocated to files must be managed, so the space that is
not currently allocated to any file must be managed. To perform any of the file
table. The following are the approaches used for free space management.
1. Bit Tables: This method uses a vector containing one bit for each block
on the disk. Each entry for a 0 corresponds to a free block and each 1
that that particular block is free and 1 implies that the block is already
occupied. A bit table has the advantage that it is relatively easy to find
one or a contiguous group of free blocks. Thus, a bit table works well
as small as possible.
sequentially and the list of the numbers of all free blocks is maintained
error. When a trap occurs, the CPU transfers control to the kernel and
executes a trap handler. The trap handler checks the type of trap and
system call handler. The system call handler checks the type of system
allocating memory.
3. Traps and system calls are similar in that they both involve transferring
privileged operations.
developing operating systems and writing programs that interact with them.
On the off chance that Operating System (OS) is secured, how does the program
request administrations from OS? Client programs can’t call capacities inside the
causes an exemption, switches CPU mode to Kernel mode, and starts the
To request specific help from OS, the client program places esteem in machine
TRAP guidance, which changes CPU mode to advantaged mode and moves
OS checks solicitation, and performs it, utilizing the dispatch table to pass
administration has been played out, OS returns control to the program, bringing
In many operating systems, the fork system call is an essential operation. The
fork system call allows the creation of a new process. When a process calls the
fork(), it duplicates itself, resulting in two processes running at the same time.
The new process that is created is called a child process. It is a copy of the
parent process. The fork system call is required for process creation and enables
It develops an entirely new process with a distinct execution setting. The new
process has its own address space, and memory, and is a perfect duplicate of
Operating System
● Process: In an operating system, a process is an instance of a program
● Parent Process: The process that uses the fork system call to start a
parent process’s beginning point and can go on running after the fork.
● Child Process: The newly generated process as a consequence of the
fork system call is referred to as the child process. It has its own
process.
makes changes to the shared memory, it enables the parent and child
● Return Value: The fork system call’s return value gives both the parent
Process Creation
When the fork system call is used, the operating system completely copies the
parent process to produce a new child process. The memory, open file
descriptors, and other pertinent properties of the parent process are passed
down to the child process. The child process, however, has a unique execution
The copy-on-write method is used by the fork system call to maximize memory
use. At first, the physical memory pages used by the parent and child processes
are the same. To avoid unintentional changes, a separate copy is made
The return value of the fork call can be used by the parent to determine the
execution path of the child process. If it returns 0 then it is executing the child
process, if it returns -1 then there is some error; and if it returns some positive
concurrency.
● Code reuse: The child process inherits an exact duplicate of the parent
process, including every code segment, when the fork system call is
used. By using existing code, this feature encourages code reuse and
overhead is minimised since parent and child processes share the same
system call its own memory area and set of resources. System stability
in its entirety, including all of its memory, which increases memory use.
● Duplication of Resources: When a process forks, the child process
inefficiencies.