Sunteți pe pagina 1din 8

02745022

Info 3400: Assignment 3


[1a]
The operating systems (DOS, Win95/98, WinNT/2000/XP) maintain certain properties
associated with every file and directories in addition to the file contents (data inside the file).
7 File Attributes are:

Nameonly information kept in human-readable form

Identifierunique tag (number) identifies file within file system

Typeneeded for systems that support different types

Locationpointer to file location on device

Sizecurrent file size

Protectioncontrols who can do reading, writing, executing

Time, date, and user identificationdata for protection, security, and usage monitoring

[1b]
A Single Level Directory is the simplest directory structure, simplest form of logical
organization: one global or root directory containing all the files.

Advantage:

all files are contained in the same directory, which is easy to support and
understand

Disadvantages:

when the number of files increases or when there is more than one user, all files
must have unique names since all files are in the same directory

As the number of files increases, difficult to remember unique names


(global namespace: unpractical in multiuser systems)

no systematic organization, no groups or logical categories


Of files that belong together

A Single - Level Directory


Structure

Tree Structured Directories are like branches in a tree and files are like leafs. The tree
has a root, which is a directory. Which in turn has a list of files. A file is either a
regular file, or a subdirectory. A subdirectory can have either files or other
subdirectories. All directories and files have names, Separator, Pathname, and Search Paths.
A user can access a file by specifying the files absolutepath name or relative path name.

This structure in effect provides an arbitrary directory level.

Types of path names:

Absolute path name

begins at the root and follows a path down to the specified file, giving the
directory names on the path

Relative path name

defines a path from the current directory

Creating a new file is done in current directory


Creating a new subdirectory is done in current directory e.g. mkdir <dir-name>
Delete a file , e.g. rm file-name
Deletion of directory done by :->Option 1 : Only delete if directory is empty
Option 2: delete all files and subdirectories under directory

Advantage:

Efficient Searching

with a tree-structured directory system, users can access, in addition to their files,
the files of other users.

Grouping Capability

When reference is made to a file the Current working directory is searched if


the file is not found, directories in the user defined searchpath will be searched.

Disadvantages:

Do not allow sharing of files

How to delete a non-empty directory?

Approach 1: Will not delete a directory unless it is empty(MS DOS)

Approach 2:Provide the option to delete all the files and subdirectories(UNIX rm
command with r option)

[1c] A cycle graph is a graph that consists of a single cycle, or in other words, some
number of vertices(directories)connected in a closed chain containing a single cycle
through all nodes.

To prevent cycles from being created we can perform the following steps:
Allow only links to file not subdirectories.
Every time a new link is added use a cycle detection algorithm to
determine whether it is ok.

If links to directories are allowed, we have a simple graph structure


Need to ensure that components are not traversed twice both for
correctness and for performance, e.g. search can be nonterminating.
File Deletion - reference count can be non-zero
Need garbage collection mechanism to determine if file can be
deleted.

[1d]
In file protection the File owner/creator should be able to control:-

What can be done- What type of access is permitted: There are five possible
actions that can be performed on a file:read,write,execute,delete,and some combination of
thefour.

By whom

-Who is allowed to access the file .

[2]
In Linked Allocation each file is a linked list of disk blocks.
Blocks may be scattered anywhere on the disk.

Each node in list can be a fixed size physical block or a contiguous collection
of blocks.Allocate as needed and then link together via pointers.

Disk space used to store pointers, if disk block is 512 bytes, and pointer (disk
address) requires 4 bytes, user sees 508 bytes of data.
Pointers in list not accessible to user.

Simple - need only starting address.

Free-space management system - space efficient.


Can grow in middle and at ends. No estimation of size necessary.
Suited for sequential access but not random access.
Directory Table maps files into head of list for a file.
Mapping - <Q, R>
Block to be accessed is the Qth block in the linked chain of blocks
representing the file.
Displacement into block = R + 1
Slow - defies principle of locality.
Need to read through linked list nodes sequentially to find the record of
interest.
Not very reliable
System crashes can scramble files being updated.

While in Indexed Allocation it brings all pointers together into the index block
Need index table.
Supports sequential, direct and indexed access.
Dynamic access without external fragmentation, but have overhead of index block.
Mapping from logical to physical in a file of maximum size of 256K words and
block size of 512 words. We need only 1 block for index table.
Mapping - <Q,R>
Q - displacement into index table
R - displacement into block
Mapping from logical to physical in a file of unbounded length.
Linked scheme Link blocks of index tables (no limit on size)
Multilevel Index

E.g. Two Level Index - first level index block points to a set of second
level index blocks, which in turn point to file blocks.
Increase number of levels based on maximum file size desired.
Maximum size of file is bounded.

[2B]
When you switch the PC on, control is passed to a small program on the motherboard called the
BIOS, The Basic Input/OutputSystem is the lowest level interface between the computer and
peripherals and it performs integrity checks on memory and seeks instructions on the Master
Boot Record (MBR) on the floppy drive or hard drive.

When a boot device is found, the first-stage boot loader is loaded into RAM and
executed.This boot loader is less than 512 bytes in length (a single sector), and its job is
to load the second-stage boot loader.
The stage 1 boot loader is the Master Boot Record (MBR)which points to the boot loader
(GRUB or LILO: Linux boot loader).

When the second-stage boot loader is in RAM and executing, a splash screen is commonly
displayed.This second stage boot loader usually GRUB or LILO will then ask for the OS label
which will identify which kernel to run and where it is located (hard drive and partition
specified).
The installation process requires the creation/identification of partitions and where to install the
OS. GRUB/LILO are also configured during this process.

When the images are loaded, the second-stage boot loader passes control to the kernel
image and the kernel is decompressed and initialized.

At this stage, the second-stage boot loader checks the system hardware, enumerates the attached
hardware devices, mounts the root device, and then loads the necessary kernel modules.
The first thing the kernel does is to execute init program.

Init is the root/parent of all processes executing on Linux.

The first processes that init starts is a script /etc/rc.d/rc.sysinit

Based on the appropriate run-level, scripts are executed to start various processes to run
the system and make it functional.

[2C]

The Linux Init Processes

The Linux Init Processes process is the last step in the boot procedure and identified by process
id "1". The Init Processes is responsible for starting system processes as defined in the
/etc/inittabfile. The Init typically will start multiple instances of "getty" which waits for console
logins which spawn one's user shell process.
Upon shutdown, init controls the sequence and processes for shutdown.
A point to note is that the init process is never shut down.
The Init is a user process and not a kernel system process although it does run as root.
[2D]
There are numerous needs for logs/ logging data, some are:
Determine if there are errors in a system or application
Debugging purposes
Keeping a history of what was done
Audit trail for security purposes and accountability
And to ensure what the application set out to do are completed and if not, determine
why?
To capture output from applications so that they can be analyzed immediately or at a
later date.
[2E]
There is a need for log rotation because log files can get rather large and cumbersome over
time.When A log file grows without bound, unless an action is taken this can cause problems.
Problems with growing log files are:

Larger files are harder to manipulate.

File systems run out of space.

The information you log may constitute personal data.

A solution to this generic problem of log file growth is log rotation..

{This involves the regular (nightly or weekly, typically) moving of an


existing log file to some other file name and starting fresh with an empty
log file. After a period the old log files get thrown away.}

[2F]Describe how the Linux logrotate works ?


Linux provides a command[rotatelog - rotates files when they reach a certain
trigger size] to rotate these logs so that you don't have current log information mixed with
older irrelevant data.Generally logrotate runs automatically on a timed basis, but it can also be
run manually.

When executed, logrotate will take the current version of the log files and add a ".1" to
the end of the filename.
Then any other previously rotated files are sequenced with ".2," ".3," etc. The larger the
number after a filename, the older the log is.
You can configure the automatic behavior for logrotateby editing the
/etc/logrotate.conffile.

S-ar putea să vă placă și