You are on page 1of 6

BT0037 – 01

Marks –30
LINUX OPERATING SYSTEMS

No of Credit: 2 Book ID: B0 337

Q.1 Bring out the advantages of Linux Operating systems.

Ans. Today Linux is being incorporated into many ST/IT environments as a part of improvements
in efficiency, security and cost savings. There are so many advantages of Linux operating
systems as follows:-

• Linux provides an excellent return on investment as it is freely downloadable.


• It can be put to work on desktop. It can be put to work as server platform: it is fast, secure,
stable, scalable and robust. It supports multiple processor computers; large amount of system
memory, choice of modern journaling file systems was previously available only with
expensive computer platforms. It aims to ensure that the data remains intact on disk despite a
system crash, power outage or other mishap.
• Linux supports creation of large RAID arrays and configuration of logical volume
management.
• Linux has low entry and deployment cost barrier. Maintenance costs are also less as it works
well with variety of PCs.
• Linux appeals to wide hardware and software industry audience.
• Linux provides royalty free development platform for cross platform development.
• Many UNIX operating systems require 500 MB or more, where as Linux can be run on as
little as 150 MB of space and can run on as little as 2MB of RAM
• Full multitasking- Multiple tasks can be accomplished and multiple devices can be accessed
at the same time.
• Virtual memory- Linux can use a portion of the hard drive as virtual memory, which
increases the efficiency of the system by keeping active processes in RAM and placing less
frequently used of inactive portions of memory on disk. Virtual memory also utilizes all
system’s memory and doesn’t allow memory segmentation to occur. Built in networking
support- Linux uses standard TCP/IP protocols, including Network File System and Network
Information Service.
• Shared libraries- Each application, instead of keeping its own copy of software, shares a
common library of subroutines it can call at runtime. This saves a lot of hard drive space on
your system.
Q.2 Match the Symbols with their respective file types:

Symbol File Names


- Named pipe
d Directory
l (i.e) L Special File
c Link File
s Socket
P Named pipe

Ans. These are symbols with their respective file types:


Symbol Meaning
- Regular file
d Directory
l (i.e) L Link
c Special File
s Socket
P Named pipe

Q.3 What is i-node number? Which all information will be present in i-node of a file?
Ans. In Linux file system each file is represented by an i-node which is a kind of serial number
containing information about the actual data that makes up a file: to whom this file belongs,
and where is it located on the hard disk.
These are the information’s present n the i-node:-
• Owner and group owner of the file.
• File type (regular, directory,…).
• Permissions on the file.
• Date and time of creation, last read and change.
• Date and time this information has been changed in the i-node.
• Number of links to this file.
• File size.
• An address defining the actual location of the file data
The only information not included in an i-node, is the file name and directory. These are stored
in the special directory file.
Q.4 Which alias of ls command is used to set different colors to files based on there type?
What does following color code signify?
Color File Type
Blue ?
Red ?
White ?
Pink ?
Cyan ?
Yellow ?
Green ?
Flashing Red ?
Ans. The command color-ls is for alias of ls command used to set different colors to files based on
there type.
The following color codes signify these file type:-

Color File Type


Blue Directories
Red Compressed
archives
White Text files
Pink Images
Cyan Links
Yellow Devices
Green Executables
Flashing Red Broken links

Q.5 Explain the concept of Hard-Link and Soft-Links with help of a Block diagram.

Ans. Hard link: Associate two or more file names with the same i-node. Hard links share the
same data blocks on the hard disks, while they continue to behave as independent files.
There is an immediate disadvantage: hard links can’t span across partitions, because
i-node numbers are only unique within a given partition.

Soft link: Soft link or symbolic link, a small file that is a pointer to another file. A symbolic
link contains the path to the target file instead of a physical location on the hard disk. Since i-
nodes are not used in this system, soft links can span across partitions.

Hard disk

Hard and Soft link mechanism


BT0037 – 02
Marks –30

LINUX OPERATING SYSTEMS

Q.1 Name different file permissions that can be assigned to a UNIX file? Interpret the meaning of
following commands:

 $ chmod 776
 $ chmod u+rw, g-w, o-x

Ans.File access permissions refer to the permissions associated with a file. There are three types
of file permissions:
• Command for all permission to the file owner:
$ chmod u+rwx
• Read permission: This allows a user to list the content of a directory.
Command for read permission to the file owner:
$ chmod o+r
• Write permission: This allows a user to
o Copy files to the directory
o Remove files from the directory
o Rename the files in the directory
o Make a sub directory
o Remove a sub directory from the directory
o Move file to and from the directory.

Command for write permission to the file owner:


$ chmod u+w
• Execute permission: This allows a user to:
o Display the contents of a directory file from within the directory
o Change to the directory
o Display a file in the directory
o Copy a file from the directory
Command to Execute permission:
$ chmod u+x
 $ chmod 776:- This command shows that only read & write permission is given to
the other users and read, write and execute permission is given to the file owner &
group.
 $ chmod u+rw, g-w, o-x :- This command shows that read and write permission is
given to file owner, write permission is removed from group users and execute
permission is removed from other users.
Q.2 Change the permissions of a file called: manipal.txt for all three types of users (user, group
and others) according to following data:
Ans. There are two methods for changing the permissions of any file.
1. By Symbolic mode we change the permission of file called ‘manipal.txt’ according to
the data:

$ chmod u+rwx, g+rx, o+r manipal.txt

By Absolute mode we can change the permission of this file as:

$ chmod 761 manipal.txt

Q.3 Explain the terms:

 Sticky bit mode


User: read , write, execute  SUID
Group: read, execute  SGID
Others : read only
Ans. Sticky bit mode: After execution of a job, the command is kept in the system memory.
Originally this was a feature used a lot to save memory, but these days memory is inexpensive, so it
is not used anymore for its optimizing capabilities on single files. When applied to an entire
directory, however the sticky bit has a different meaning. In that case, a user can only change files in
this directory when she is the user owner of the file or when the file has appropriate permissions.
This feature is used on directories like /var/tmp, that have to be accessible for everyone, but where it
is not appropriate for users to change or delete each other’s data. The sticky bit is indicated by a t at
end of the file permission field:
The sticky bit is set using the command chmod o+t directory. The historic origin of the “t”
is in UNIX save text access feature.

SUID: It stands for set user ID. It is represented by the character s in the user or group
permission field. When this mode is set on an executable file, it will run with the user and group
permission on the file instead of with those of the user issuing the command, thus giving access to
system resources.
SGID: It stands for set group ID. In this special case every file created in the directory will
have the same group owner as the directory itself (while normal behavior would be that neew files
are owned by the users who create them). This way, users don’t need to worry about file ownership
when sharing directories. This is the standard way of sharing files in UNIX.

Q.4 Explain the following commands functions with an example each:

 bg
 fg
 kill
Ans. Bg: The ‘bg’ command is used to reactivate a suspended program in the background.

Fg: The ‘fg’ command is used to put a job back in foreground.

Kill: The ‘kill’ command is used to end a process.


Q.5 Describe the complete fork-execute life cycle of a process with a block diagram
Ans. A new process is created because an existing process makes an exact copy of itself. This
child process has the same environment as its parent, only the process ID number is different.
This procedure is known as forking.
After the forking process, the address space of the child process is overwritten with
the new process data. This is done through an exec call to the system.
The fork-and- exec mechanism thus switches an old command with a new, while the
environment in which the new program is executed remains the same, including
configuration of input and output devices, environment variables and priority. This
mechanism is used to create all UNIX processes, so it also applies to the Linux operating
system. Even the first process, init, with process ID 1, is forked during the boot procedure in
the so-called bootstrapping procedure.
This scheme illustrates the fork-and-exec mechanism. The process ID changes after
the fork procedure:

Fork- and- exec mechanism

You might also like