What is Unix ?
The
UNIX operating system is a set of programs that act as a link between the
computer and the user.
The
computer programs that allocate the system resources and coordinate all the
details of the computer's internals is called the operating system or kernel.
Users
communicate with the kernel through a program known as the shell. The shell is
a command line interpreter; it translates commands entered by the user and
converts them into a language that is understood by the kernel.
Unix
was originally developed in 1969 by a group of AT&T employees at Bell Labs,
including Ken Thompson, Dennis Ritchie, Douglas McIlroy, and Joe Ossanna.
There
are various Unix variants available in the market. Solaris Unix, AIX, UP Unix
and BSD are few examples. Linux is also a flavour of Unix which is freely
available.
Several
people can use a UNIX computer at the same time; hence UNIX is called a
multiuser system.
A
user can also run multiple programs at the same time; hence UNIX is called
multitasking.
Unix Architecture:
Here is a basic block diagram of a UNIX system:
The
main concept that unites all versions of UNIX is the following four basics:
Kernel: The kernel is the heart of the operating system. It interacts with hardware and most of the tasks like memory management, tash scheduling and file management.
Shell: The shell is the
utility that processes your requests. When you type in a command at your
terminal, the shell interprets the command and calls the program that you want.
The shell uses standard syntax for all commands. C Shell, Bourne Shell and Korn
Shell are most famous shells which are available with most of the Unix
variants.
Commands and
Utilities:
There are various command and utilities which you would use in your day to day
activities. cp, mv, cat and grep etc. are few examples of commands and
utilities. There are over 250 standard commands plus numerous others provided
through 3rd party software. All the commands come along with various optional
options.
Files and
Directories:
All data in UNIX is organized into files. All files are organized into
directories.
Explain Karnel?
Kernel: the kernel is the
master program that provide file related activities, process scheduling, memory
management, and various other operating system functions through system calls.
In other words we can say that it control the resources of the computer system,
allocate them to different users and to different tasks.
The
major portion of the kernel is written in C language. Therefore, it is easy to
understand, debug, and enhance it. As it is written in C language, therefore,
it is portable in nature.
As you can see in the diagram that it is written or placed between hardware and utility program (Like shells, editors, vi or sed) so it work between the two. Moreover, the kernel maintains various data structure to manage the processes. Each process has its own priority. A higher priority process is execute first than the lower priority process.
Kernel is divided into two parts:
1. Process management
2. File management
The
primary task of the process management is to manage the memory management
activities and process related activities at different states of the execution
– creation/deletion of processes, scheduling of the processes and provision of
mechanism for synchronization, communication and deadlock handling of the
processes.
Where
as the task of the file management is to manage the file related activities.
Since Unix is such kind of operating system which treats the I/O devices as a
file. Therefore each I/O devices has its own file, known as device drivers, to
derive it. The file management pat of the kernel handles these device drivers
and store these files in the directory “/dev” under root directory. If we
attach any new I/O device to the Unix
than it is necessary to create a file for that device in “/dev” directory. Then
we write down its characteristics; such as its type (character oriented or
block oriented), address of the driver program, memory buffer reserved for the
device and some other, in that specific file.
Explain Shells?
Shells: In Unix we cannot
directly deals with kernels. It is the shell, one of the utility program, that
starts up the kernel when the user logs in. the shell sends a prompt symbol.
The shell prompt waits for input from users.
Now
when you type a command and press Enter
key, the shell obtained your command, execute it if possible and display the
prompt symbol again in order to receive your next command. That is why the
shell is also called as the Unix system command interpreter.
Moreover,
when we want to access the hardware, we will request for the shell, the shell
will request to kernel, and finally the kernel will request to hardware.
Basically the shell handles the user interaction with the system. Some built in
commands are part of shell and the remaining commands are separated programs
stored else where.
There are three types of shells that are widely used and are exist in the Unix OS:
Bourne shell: This shell was
designed by Stephan Bourne of Bell’s Lab. It is most powerful an most widely
used shell. The prompt symbol of Bourne shell is $ (Doller) sign.
The C Shell: the C shell was
developed at University of California. It is designed by Bill Joy. C shell gets
its name from its programming language, which resembles the C programming
language in syntax. The prompt symbol of C shell is Percent (%) sign.
Korn Shell: Like Bourne shell,
the Korn shell was also developed at Bell’s Lab of AT & T. This shell gets
its name from its inventor David Korn of Bell’s Lab.
Moreover,
the shells provide the meta characters like *, [ ], ? and so on. For better
searching of files.
Explain programs?
A program is refereed to as a process while the kernel is running it. The Kernel can run the same shell program(or any other program) simultaneously for many users on a Unix System, and each running copy of the program is a separate process. The Shell is also a program that the UNIX Kernel runs for the user. As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile(which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt $ to the user, indicating that it is waiting for further commands.UNIX File Protections
File protection (also known as access rights)
enables the user to set up a file so that only specific people can read,
write/delete, and execute it. Write and delete privilege are the same on a UNIX
system since write privilege allows someone to overwrite a file with a
different one.
UNIX file permissions are defined according to
ownership. The person who creates a file is its owner.
In addition, there is a concept known as a group.
Members of a group have special privileges to see each other's files. We
generally create groups as the members of a single lab - the students,
technicians, postdocs, visitors, etc who work for a given PI.
Only
the owner of a file can change the protection on a file. To determine the owner
and the current protections of a file, type the command ls -l filename (-l is
for long) or just ls -l to get a listing of all files in the current directory.
$
ls -l
total
2514
-rw-r--r-- 1 browns02 staff 366163 Jul 29 15:06 distrib.tar.Z
-rw-r--r-- 1 browns02 staff 15721 Jul 29 15:06 input_file
drwxr-xr-x 3 browns02 staff 512 Jul 29 15:14 Phrap
-rw-r--r-- 1 browns02 staff 878231 Jul 29 15:06
RepeatMasker050599.tar.Z
The
username of the owner is shown in the third column. The owner of the files
listed above is browns02.
The
access rights for these files is shown in the first column. This column
consists of 10 characters known as the attributes of the file. The possible
attributes are: d, r, w, x, and -
r
indicates read permission
w
indicates write (and delete) permission
x
indicates execute permission
-
indicates no permission for that operation
The
first charcter in the attribute string indicates if a file is a directory (d)
or a regular file (-)
the
next 3 characters give the file permissions for the owner of the file
the
middle 3 characters give the permissions for members of the owner's group
the
last 3 characters give the permissions for everyone else (the world)
To change the protections on a file use the
chmod (change mode) command. [Beware, this is a confusing command.]
First you have to decide for whom you want to
change the access permissions. Your choices are:
the
file owner (u) (presumably yourself)
the
members of your group (g)
others
(o) (ie. the whole world)
or
all 3 classes at once (a)
Next you have to decide if you are adding (+),
removing (-), or setting (=) some permissions.
Taken all together, it looks like this:
$ chmod u=rwx g+r o-x myfile.txt
This
will set the owner to have read, write, and execute; add the permission for
member of the group to read; and remove the permission for others to execute
the file named myfile.txt.
The
default file protection assigned to new files is -rw-r--r-- .
That
is to say the owner can manipulate the files freely (read and write
permission), those in the group can read them, but not write (or delete), and
the world can also read them. If you feel you need to alter this default file
protection then use this command to set the file privilages so no one else can
see your files:
chmod go-r *.*
(or
set whatever privileges you want)
Directory Structure:
Unix
uses a hierarchical file system structure, much like an upside-down tree, with
root (/) at the base of the file system and all other directories spreading
from there.
A
UNIX filesystem is a collection of files and directories that has the following
properties:
It
has a root directory (/) that contains other files and directories.
Each
file or directory is uniquely identified by its name, the directory in which it
resides, and a unique identifier, typically called an inode.
By
convention, the root directory has an inode number of 2 and the lost+found
directory has an inode number of 3. Inode numbers 0 and 1 are not used. File
inode numbers can be seen by specifying the -i option to ls command.
It
is self contained. There are no dependencies between one filesystem and any
other.
The
directories have specific purposes and generally hold the same types of
information for easily locating files. Following are the directories that exist
on the major versions of Unix:
Directory Description
/ This is the root directory which
should contain only the directories needed at the top level of the file
structure.
/bin This is where the executable files are
located. They are available to all user.
/dev These are device drivers.
/etc Supervisor directory commands, configuration
files, disk configuration files, valid user lists, groups, ethernet, hosts,
where to send critical messages.
/lib Contains shared library files and sometimes
other kernel-related files.
/boot Contains files for booting the system.
/home Contains the home directory for users and
other accounts.
/mnt Used to mount other temporary file systems,
such as cdrom and floppy for the CD-ROM drive and floppy diskette drive,
respectively
/proc Contains all processes marked as a file
by process number or other information that is dynamic to the system.
/tmp Holds temporary files used between system boots
/usr Used for miscellaneous purposes, or can be
used by many users. Includes administrative commands, shared files, library
files, and others
/var Typically contains variable-length files such
as log and print files and any other type of file that may contain a variable
amount of data
/sbin Contains binary (executable) files, usually for
system administration. For example fdisk and ifconfig utlities.
/kernel Contains kernel files.
In Unix, how do I change the permissions for a file?
You
can change file permissions with the chmod command. In Unix, file permissions,
which establish who may have different types of access to a file, are specified
by both access classes and access types. Access classes are groups of users,
and each may be assigned specific access types. The access classes are
"user", "group", "other", and "all".
These refer, respectively, to the user who owns the file, a specific group of
users, the other remaining users who are not in the group, and all three sets
of users. Access types (read, write, and execute) determine what may be done
with the file by each access class.
There
are two basic ways of using chmod to change file permissions:
Symbolic
method
The
first and probably easiest way is the relative (or symbolic) method, which lets
you specify access classes and types with single letter abbreviations. A chmod
command with this form of syntax consists of at least three parts from the
following lists:
Access
Class Operator Access Type
u
(user) + (add access) r (read)
g
(group) - (remove access) w (write)
o
(other) = (set exact access) x (execute)
a
(all: u, g, and o)
For
example, to add permission for everyone to read a file in the current directory
named myfile, at the Unix prompt, you would enter:
chmod a+r myfile
The a
stands for "all", the
+ for "add", and
the r
for "read".
Synchronizing UNIX
files?
Using cp, tar, and rsync
File
synchronization is the process of adding, changing, or deleting a file in one
location, and having the same file added to, changed, or deleted at another
location.
This
article covers three utilties, cp, tar, and rsync, that can aid with
synchronization of UNIX files. While cp and tar commands have limited
synchronization abilities,
rsync
provides you with the full range of options; however, all three have their
place.
The Boot Procedure?
Bootstrapping
is the process of starting up a computer from a halted or powered-down
condition. When the computer is switched on,
it
activates the memory-resident code which resides on the CPU board. The normal
facilities of the operating system are not available
at this stage and the computer must 'pull
itself up by its own boot-straps' so to speak. This procedure therefore is
often referred to
as
bootstrapping, also known as cold boot. Although the bootstrap procedure is
very hardware dependent, it typically consists of the following steps:
The
memory-resident code
Runs
self-test.
Probes
bus for the boot device
Reads
the boot program from the boot device.
Boot
program reads in the kernel and passes control to it.
Kernel
identifies and configures the devices.
Initializes
the system and starts the system processes.
Brings
up the system in single-user mode (if necessary).
Runs
the appropriate startup scripts.
Brings
up the system for multi-user operation.
What is inode in UNIX OS?
All
UNIX files have its description stored in a structure called inode. The inode
contains info about the file-size,
its location, time of last access, time of
last modification, permission and so on. Directories are also represented
as
files and have an associated inode. In addition to descriptions about the file,
the inode contains pointers to the
data
blocks of the file. If the file is large, inode has indirect pointer to a block
of pointers to additional data blocks
(this
further aggregates for larger files). A block is typically 8k.
Inode
consists of the following fields:
File
owner identifier
File
type
File
access permissions
File
access times
Number
of links
File
size
Location
of the file data
Describe the terms spooling and buffering. [HSEB 2060]?
Spooling: It is referred as
Simultaneous Peripheral Operation Online. It means to put jobs in a buffer, a
special area in memory
or
on a disk where a device can access them when it is ready. Spooling is useful because
devices access data at different rates.
The
spooling technique is used in multiprogramming environment to offer first
chance to the program of higher priority and reduce processor
idle
time. Each application output files are spooled to separate disk file called
spool files and spooling system make queue for output
process.
The most common spooling application is print spooling.
Buffering: Buffering is the
name given to the technique of transferring data into temporary storage prior
to processing or output,
thus
enabling the simultaneous operation of devices.
Swapping:
The swapping is a memory management technique applied by Operating systems.
Swapping is a technique in which high priority
process
is swap in main memory and low priority process from main memory to swap out.
When high priority process is completed, low priority
process
is swap in again.
What is hit ratio ?
The
performence of memory is frequently mesuread in terms
of
quntity is called hit ratio.when the cpu needs to find
the
word in the cache,if the word is found in the cache
then
its proudes a hit.if the word is not found in the
cache,it
is in main memory as counted miss.the ratio of
number
of hits is divided by the total cpu refrence of
memory
is called hit ratio.
Types of Operating Systems?
An
operating system is the single most important software when you run a computer,
it is what takes care of pretty much everything on a computer
system,
while the majority of computers we see happen to be using one ‘type’ of
operating system performing the same functions,
operating
systems can be branched into several different types as well.
Batch Processing
Operating System
In a batch processing operating system interaction between the user and processor is limited or there is no interaction at all during the execution of work. Data and programs that need to be processed are bundled and collected as a ‘batch’ and executed together. ExampleIBM's OS360
Batch
processing operating systems are ideal in situations where:
-
There are large amounts of data to be processed.
-
Similar data needs to be processed.
-
Similar processing is involved when executing the data.
The
system is capable of identifying times when the processor is idle at which time
‘batches’ maybe processed. Processing is all performed automatically without
any user intervention.
Real-time Operating
System
A real-time operating system processes inputs simultaneously, fast enough to affect the next input or process. Real-time systems are usually used to control complex systems that require a lot of processing like machinery and industrial systems.
Example Windows CE, RTLinux
Single User Operating
System
A
single user OS as the name suggests is designed for one user to effectively use
a computer at a time. Example MS Dos
Multi-Tasking
Operating System
In
this type of OS several applications maybe simultaneously loaded and used in
the memory. While the processor handles only one application
at
a particular time it is capable of switching between the applications
effectively to apparently simultaneously execute each application. This type of
operating system is seen everywhere today and is the most common type of OS,
the Windows operating system would be an example.
Multi-User Operating
System
This type of OS allows multiple users to simultaneously use the system, while here as well, the processor splits its resources and handles one user at a time, the speed and efficiency at which it does this makes it apparent that users are simultaneously using the system, some network systems utilize this kind of operating system.
Example of multi-user OS include Unix server & thin client.
Distributed Operating
System
In
a distributed system, software and data maybe distributed around the system,
programs and files maybe stored on different storage devices
which
are located in different geographical locations and maybe accessed from
different computer terminals.
While
we are mostly accustomed to seeing multi-tasking and multi-user operating
systems, the other operating systems are usually used in
companies
and firms to power special systems.
What is an Operating System? Explain all the four types of OS?
An
operating system (commonly abbreviated OS and O/S) is the software component of
a computer system that is responsible for the management and coordination of
activities and the sharing of the limited resources of the computer.
There
are 4 types of operating system which is explained below:-
i. Batch Operating
System:-A
batch system is one in which jobs are bundled together with the instructions
necessary to allow them to be processed without intervention. The basic
physical layout of the memory of a batch job computer is shown below:
Monitor
(permanently resident)
User
Space
(compilers,
programs, data, etc.)
The
monitor is system software that is responsible for interpreting and carrying
out the instructions in the batch jobs. When the monitor starts a job, the
entire computer is dedicated to the job, which then controlls the computer
until it finishes.
1. Advantages of
batch systems move much of the work of the operator to the
computer
increased
performance since it was possible for job to start as soon as the previous job
finished
2.
Disadvantages turn-around time can be
large from user standpoint
more
difficult to debug program
due
to lack of protection scheme, one batch job can affect pending jobs (read too
many cards, etc)
a
job could corrupt the monitor, thus affecting pending jobs
a
job could enter an infinite loop
ii. Multiprogramming
Operating System:-
As machines with more and more memory became available, it was possible to
extend the idea of multiprogramming (or multiprocessing) as used in spooling
batch systems to create systems that would load several jobs into memory at
once and cycle through them in some order, working on each one for a specified
period of time. There are different type of Multiprogramming Operating System,
some main stream are discussed below:-
a. Multitasking
Operating System:-
A running state of a program is called a process or a task.multitasking allows
the computer system to more reliably guarantee each process a regular
"slice" of operating time. It also allows the system to rapidly deal
with important external events like incoming data, which might require the
immediate attention of one or another process. So, multitasking operating
system is a type of multiprogramming operating system which can perform several
process simultaneously.The earliest multitasking OS available to home users was
the AmigaOS. All current major operating system support this feature.
b. Multi-user
Operating System:-
A multi-user operating system allows for multiple users to use the same
computer at the same time and/or different times. Linux,Unix,Windows OS are
some example of multitasking operating system.
c. Multiprocessing
Operating System:-
An operating system capable of supporting and utilizing more than one computer
processor.Linux,Unix,Windows OS are some example of multitasking operating
system.
d. Real Time
Operating System:-
It is an OS where there are a number of possibly unrelated external activities
needed to be controlled by a single processor system. In such systems a
hierarchical interrupt system was coupled with process prioritization to ensure
that key activities were given a greater share of available process time.
iii. Network
Operating System:-
A network operating system (NOS) is software that controls a network and its
message (e.g. packet) traffic and queues, controls access by multiple users to
network resources such as files, and provides for certain administrative
functions, including security.
The
upper 5 layers of the OSI Reference Model provide the foundation upon which
many network operating systems are based. 6WINDGate,Cisco IOS,BSD are some of
the example of NOS.
iv. Distributed
Operating System:- Distributed
systems are very much like traditional operating systems. First, they act as
resource managers for the underlying hardware, allowing multiple users and
applications to share resources such as CPUs, memories, peripheral devices, the
network, and data of all kinds. Second, and perhaps more important, is that
distributed systems attempt to hide the intricacies and heterogeneous nature of
the underlying hardware
by
providing a virtual machine on which applications can be easily executed.
Features of unix operating system?
The
UNIX Operating System is available on machines with a wide range of computing
power, from microcomputers to mainframes, and on different
manufacture's
machines. No other operating system can make this claim. We see the reasons of
popularity and success of UNIX.
The reasons are
Portability:
The
system is written in high-level language making it easier to read, understand,
change and, therefore move to other machines. The code
can
be changed and complied on a new machine. Customers can then choose from a wide
variety of hardware vendors without being locked in with
a
particular vendor.
Machine-independence:
The
System hides the machine architecture from the user, making it easier to write
applications that can run on micros, mins and mainframes.
Multi-User Operations:
UNIX
is a multi-user system designed to support a group of users simultaneously. The
system allows for the sharing of processing power and
peripheral
resources, white at the same time providing excellent security features.
Hierarchical File
System:
UNIX
uses a hierarchile file structure to store information. This structure has the
maximum flexibility in grouping information in a way
that
reflects its natural state. It allows for easy maintenance and efficient
implementation.
UNIX shell:
UNIX
has a simple user interface called the shell that has the power to provide the
services that the user wants. It protects the user
from
having to know the intricate hardware details.
Pipes and Filters:
UNIX
has facilities called Pipes and Filters which permit the user to create complex
programs from simple programs.
Utilities:
UNIX
has over 200 utility programs for various functions. New utilities can be built
effortlessly by combining existing utilities.
Software Development Tools:
UNIX
offers an excellent variety of tools for software development for all phases,
from program editing to maintenance of software,
What are features of the operating system in a computer?
1. Program Execution
2. Handling Input/Output Operations
3. Manipulation Of File System
4. Error Detection And Handling
5. Resource Allocation
6. Accounting
7.
Information And Resource Protection
What Are The Functions Of An Operating System?
There
are many functions of an operating system.
There are two main things that it does however, and these are: Managing
the software and hardware, and providing an interface, which the installed
applications can work with, without having to be programmed to know how the
hardware works.
Both computers and mobile phones use operating systems in order to work. They work in different ways as they have different features involved.
The
hardware and software on a desktop computer include memory, the processor, disk
space and more, so it has quite a lot to deal with. On a mobile phone, this can be the screen,
key or touch pad, address book, dialler, network connection and the battery.
The operating system is the main aspect of a device, and is very important to its overall function. Without it, the computer or phone would not be able to work.
There are many other functions that an operating system has. It also takes care of task management, and basically multitasks, by running many programs at once, without slowing it down.
It also looks after the data within the device and through the use of discs and memory sticks or cards. It needs to know where they are stored within the system and how to read and write them.
It also has to control the devices plugged into the system. These are sometimes known as peripherals and can include printers, a mouse, and a keyboard.
It provides a user interface for the user to interact with the device easily. These are all graphics based now, so the user can understand what each button will do, which once clicked upon, is then translated into codes for the computer to make sense of.
An
operating system is able to deal with security aspects and use passwords to
protect it.
Context Switches?
The
scheduler maintains a queue of executable threads for each priority level.
These are known as ready threads. When a processor becomes available, the
system performs a context switch. The steps in a context switch are:
Save
the context of the thread that just finished executing.
Place
the thread that just finished executing at the end of the queue for its
priority.
Find
the highest priority queue that contains ready threads.
Remove
the thread at the head of the queue, load its context, and execute it.
The
following classes of threads are not ready threads.
Threads
created with the CREATE_SUSPENDED flag
Threads
halted during execution with the SuspendThread or SwitchToThread function
Threads
waiting for a synchronization object or input.
Until threads that are suspended or blocked become ready to run, the scheduler does not allocate any processor time to them, regardless of their priority.
The
most common reasons for a context switch are:
The
time slice has elapsed.
A
thread with a higher priority has become ready to run.
A
running thread needs to wait.
When
a running thread needs to wait, it relinquishes the remainder of its time
slice.
Why Bourne Shell?
now
that you find yourself on your own, cozy slice of a Unix system, with your own
shell and all its capabilities, is there any real reasonto use Bourne Shell
rather than using the whole range of your shells capabilities?
Well,
it depends. Probably, there isn't. For the most part of course, you are using
Bourne Shell by using the whole potential of your shell.
your
shell is probably that similar to the Bourne Shell. But there is one thing you
might want to keep in mind: someday, you might want
to
write a script that you might want to pass around to other people. Of course
you can write your script using the full range of options
that
your shell offers you; but then it might not work on another machine with
another shell. This is where the role of Bourne Shell as the Latin of Unix
command shells comes in -- and also where it is useful to know how to write
scripts targeted specifically at the Bourne
Shell.
If you write your scripts for the Bourne Shell and nothing but the Bourne
Shell, chances are far better than equal that your script
will
run straight out of the mail attachment (don't tell me you're still using boxes
to ship things -- come on, get with the program) on
any
command shell out there.
Salient Features Of Unix
The Salient features
of unix are :
1. Popularity : The unix operating system have wide range of computing power
from microcomputers, mainframes and different manufacture’s machine.
2. Portability : It is easier to
read, understand, change and move to other machines because it is written in
high-level language. The code can be changed and complied on a new machine.
Users can then choose from a wide
variety of hardware vendors without being locked in with a particular vendor.
3.
Machine-independence : The system is machine-independent. So , it is easier to
write applications that can run on micros, mins and mainframes because the
system hides the machine architecture from the user.
4. Multi-User
Operations :
UNIX is a multi-user system designed to support a group of users
simultaneously. The system allows for the sharing of processing power and
peripheral resources, white at the same time providing excellent security
features.
5. Hierarchical File
System : UNIX uses a hierarchile file structure to
store information. This structure has the maximum flexibility in grouping
information in a way that reflects its natural state. It allows for easy
maintenance and efficient implementation.
6. UNIX shell : UNIX has a simple
user interface called the shell that has the power to provide the services that
the user wants. It protects the user from having to know the intricate hardware
details.
7. Pipes and Filters
:
UNIX has facilities called Pipes and Filters which permit the user to create
complex programs from simple programs.
8. Utilities : UNIX has over 200
utility programs for various functions. New utilities can be built effortlessly
by combining existing utilities.
9. Software
Development Tools :
UNIX offers an excellent variety of tools for software development for all
phases, from program editing to maintenance of software.
What is vieditor?
There are many ways to edit files in Unix and for me one of the best ways is using screen-oriented text editor vi. This editor enable you to edit lines in context with other lines in the file.
Now a days you would find an improved version of vi editor which is called VIM. Here VIM stands for Vi IMproved.
The vi is generally considered the de facto standard in Unix editors because:
It's usually available on all the flavors of Unix system.
Its implementations are very similar across the board.
It requires very few resources.
It is more user friendly than any other editors like ed or ex.
You can use vi editor to edit an existing file or to create a new file from scratch. You can also use this editor to just read a text file.
Starting the vi Editor:
There are following way you can start using vi editor:
Command |
Description |
vi filename |
Creates a new file if it already does not exist, otherwise opens
existing file. |
vi -R filename |
Opens an existing file in read only mode. |
view filename |
Opens an existing file in read only mode. |
What is Mutual Exclusion?
It is one of the characteristics of deadlock. When semaphores are used or mutual exclusion, the semaphore has an initial value of 1, and P() is called before the critical section, and V() is called after the critical section as shown below :
semaphore-> P();-critical section semaphore-> V();-remainder section
let us suppose that one process A is already executing its critical section then it implies that semaphore value at that time is zero. If process B now tries to enter this critical section , it cannot enter the critical section because it will have to wait before semaphore becomes greater than zero. This is possible only when process A executes its signal operation; after executing its critical section.
Explain kill() command?
The kill command only terminates processes specified by process-id when a specific background process needs to be killed, you must usually run ps to find the process-id and then re type it as an argument to kill. Killing process is dangerous and care must be taken to kill the right processes.
Eplain fork()command?
The 'fork()' call is used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. It return the p_id of child process and creating child process return itself is zero.
Access Control
exit - terminate a shell (see "man sh" or "man csh")
logout - sign off; end session (C shell and bash shell only;)
passwd - change login password
rlogin - log in remotely to another UNIX system
ssh - secure shell
slogin - secure version of rlogin
yppasswd - change login password in yellow pages
Communications
mail - send and receive mail
mesg - permit or deny terminal messages and talk requests
pine - send and receive mail
talk - talk to another logged-in user
write - write to another logged-in user
Programming Tools
as - assembler, specific to each machine architecture
awk - pattern scanning and processing language
bc - online calculator
cc - C compiler
csh - C shell command interpreter
dbx - source-level debugging program
f77 - Fortran compiler
gdb - GNU Project debugger
gprof - display profile of called routines
kill - kill a process
ld - the UNIX loader
lex - generate lexical analysis programs
lint - check C source code
make - maintain large programs
maple - symbolic mathematics program
math - symbolic mathematics program
nice - run a command at low priority (see "man nice" or "man csh")
nohup - run a command immune to hangups
pc - Pascal compiler (xlp on ADS)
perl - Popular script interpreter
prof - display profile data
python - Python programming language
sh - Bourne shell command interpreter
yacc - generate input parsing programs
xcalc - graphical calulator under x
Documentation
apropos - locate commands by keyword lookup
find - locate file (i.e. find . -name *.tex -print)
info - start the info explorer program
man - find manual information about commands
whatis - describe what a command is
whereis - locate source, binary, or man page for a program
Editors
emacs - screen-oriented text editor
pico - screen-oriented text editor (renamed called nano)
sed - stream-oriented text editor
vi - full-screen text editor
vim - full-screen text editor ("vi-improved")
File
and Directory Management
cd - change working directory
chmod - change the protection of a file or directory
chown - change owner (or group) of a file or directory
chgrp - change group of a file or directory
cmp - compare two files
comm - select/reject lines common to two sorted files
cp - copy files
crypt - encrypt/decrypt files (CCWF only)
diff - compare the contents of two ASCII files
file - determine expand files
ln - make a link to a file file type
grep - search a file for a pattern
gzip - compress or
ls - list the contents of a directory
lsof - list of open files
mkdir - create a directory
mv - move or rename files and directories
pwd - show the full pathname of your working directory
quota - display disk usage and limits
rm - delete (remove) files
rmdir - delete (remove) directories
stat - status of file (i.e. last access)
sync - flush filesystem buffers
sort - sort or merge files
tar - create or extract archives
tee - copy input to standard output and other files
tr - translate characters
umask - change default file protections
uncompress - restore compressed file
uniq - report (or delete) repeated lines in a file
wc - count lines, words, and characters in a file
File Display and Printing
cat - show the contents of a file; catenate files
fold - fold long lines to fit output device
head - show first few lines of a file
lpq - examine the printer spooling queue
lpr - print a file
lprm - remove jobs from the printer spooling queue
more - display a file, one screen at a time
less - like more with more features
page - like "more", but prints screens top to bottom
pr - paginate a file for printing
tail - show the last part of a file
zcat - display a compressed file
xv - show print, manipulate images
gv - show ps and pdf files
xpdf = shopw pdf files (use gv)
File Transfer
ftp - transfer files between network hosts
rsync - fast and flexible sync between computers
scp - secure version of rcp
Miscellaneous
alias - define synonym commands
chquota - change disk quota on ACITS UNIX systems
chsh - change default login shell
clear - clear terminal screen
echo - echo arguments
pbm - portable bitmap manipulation programs
popd - pop the directory stack (C shell only)
pushd - push directory on stack (C shell only)
script - make typescript of terminal session
setenv - set an environment variable (C shell only)
stty - set terminal options
News/Networks
netstat - show network status
rsh - run shell or command on another UNIX system
ssh - secure-shell version of rsh
Process Control
bg - put suspended process into background
fg - bring process into foreground
jobs - list processes
^y - suspend process at next input request
^z - suspend current process
Status Information
clock - determine processor time
date - show date and time
df - summarize free disk space
du - summarize disk space used
env - display environment
finger - look up user information
history - list previously issued commands
last - indicate last login of users
lpq - examine spool queue
manpath - show search path for man pages
printenv - print out environment
ps - show process status
pwd - print full pathname of working directory
set - set shell variables (C shell, bash, or ksh)
spend - lists year-to-date ACITS UNIX charges
stty - set terminal options
time - timing programs
top - list top cpu processes
uptime - show system load, how long system has been up
w - show who is on system, what command each job is executing
who - show who is logged onto the system
whois - Internet user name directory service
whoami - who owns the shell
Image Processing
gimp - photoshop type image processing program
xfig - drawing program
xv - image viewer
xvscan - scan picture
xpaint - paint program
kpaint - kde paint program
Sound
mplayer - mpg player
realplay - realaudio player
timidity - midi to wav converter and player
xmms - mp3 player
Text Processing
abiword - open source word processor
addbib - create or extend bibliographic database
col - filter reverse line feeds
diction - identify wordy sentences
diffmk - mark differences between files
dvips - convert TeX DVI files into PostScript
explain - explain phrases found by diction program
grap - pic preprocessor for drawing graphs
hyphen - find hyphenated words
ispell - check spelling interactively
latex - format text in LaTeX (based on TeX)
pdfelatex - latex with pdf output
latex2html - Latex to html
lookbib - find bibliography references
macref - make cross-reference listing of nroff/troff macro files
ndx - create a subject-page index for a document
neqn - format mathematics with nroff
nroff - format text for simple display
pic - make simple pictures for troff input
psdit - filter troff output for Apple LaserWriter
ptx - make permuted index (not on CCWF)
refer - insert references from bibliographic databases
roffbib - run off bibliographic database
sortbib - sort bibliographic database
spell - find spelling errors
ispell - interactive spell checker
style - analyze surface characteristics of a document
tbl - format tables for nroff/troff
tex - format text
tpic - convert pic source files into TeX commands
wget - grab webpage
X windows
grabmode - info on screen: i.e. "1152x864" 51.213kHz/56.59Hz
import - grab window (i.e. import ppm:- >out.ppm)
xdpyinfo - number of colors
xkill - kill xwindow
xlock - lock screen
xterm - xterminal
xwininfo - information on open window
Web
html2ps - html to ps
latex2html - latex to html translator
lynx - text based webbrowser
netscape - webbrowser
sitecopy - sitecopy is for easily maintaining remote web sites.
weblint - html sytax and style checker
What is threading ?
Native threads
A thread implementation that is supported by a unix kernel. For example, Linux's native threads are created with the clone() system call without the COPYVM flag set.
Threading Library
A user-space library and API that provides user-level access to native or user level threads. For example, pthreads (also known as Posix Threads) is the most popular threading library. Some Unix flavors (Solaris and UnixWare) also have an older API to their native threads. This API is called Unix International (UI) threads, and uses the thr_ prefix.
How threading use?
1. pthread_create()
2. Forking creates two processes, each having a separate thread of control. Creating a thread creates an extra thread of control within a single process.
3. No - it is generally harder to get threaded applications right than it is to get separate processes right. And by quite a large margin
(DNS) Domain Name Service
Domain name services resolves names to the ip addresses of clients and vice verse. Domain name system provides a convenient way of finding computer systems in network based on its name and ip address . With increased internet usage and globalization of companies setting up of DNS servers has become a major responsibility of system administrators worldwide .
NIS / NIS+
Network Information Service (formerly known as Yellow Pages) provides account data (names, passwords, etc.) in a relatively convenient, but insecure manner. The data is moved across the network in it's native fashion, meaning usernames go across as clear text, and the password hashes are sent without any additional protection (thus if you use shadow passwords to protect the passwords, using NIS negates that rather quickly). NIS+ provides an additional layer of security in the form of DES encryption (56 bits) which will prevent any casual attackers, but not a determined attacker. NIS+ has traditionally been a pain to setup, however there has been much work on it in the last few year so installation and configuration is much easier then in past.
Page replacement techniques
In a computer operating system that uses paging for virtual memory management, page replacement algorithms decide which memory pages to page out (swap out, write to disk) when a page of memory needs to be allocated. Paging happens when a page fault occurs and a free page cannot be used to satisfy the allocation, either because there are none, or because the number of free pages is lower than some threshold.
When the page that was selected for replacement and paged out is referenced again it has to be paged in (read in from disk), and this involves waiting for I/O completion. This determines the quality of the page replacement algorithm: the less time waiting for page-ins, the better the algorithm. A page replacement algorithm looks at the limited information about accesses to the pages provided by hardware, and tries to guess which pages should be replaced to minimize the total number of page misses, while balancing this with the costs (primary storage and processor time) of the algorithm itself.
The page replacing problem is a typical online problem from the competitive analysis perspective in the sense that optimal deterministic algorithm is known.
Features of operating system?
The features of the operating systems are totally dependent on the type of software. Every operating system differs from each other in some features while there are some features which are common in all operating systems.
Some of the features of operating systems are detailed here.
Software and hardware management
The operating system is the bridge between computer hardware and software and makes the communication between them possible. Also communication between different softwares in the computer is also taken care by operating system.
Constant API
Application Program Interface (API) is a software that allows different applications that run on a computer to work on other computers also. But they should have same operating system. So it is very vital to have consistent API in the operating system.
Execution of programs
Programs running in the computer are completely dependent on the operating system. But program execution is a tough process. The multitasking and multithreading features of the operating system are dependent upon the type of program execution feature of O.S.
Interruptions
Interruption may happen at any time while using the computers. So the operating system should allow and handle many numbers of interrupts. Whenever an interruption occurs, the operating system should respond to it by saving and stopping the current execution and work on the new execution. This is the most hard-hitting process for the operating system.
Managing memory
The operating system provides the memory for the programs that are executed at any moment. So the operating system should have good memory allocation facility to execute the programs smoothly. The prioritization and allocation of memory to the applications running should be taken care by the operating systems.
Networking
Today computers are nothing without internet connection or some network connection. This is the age of networking. So if computers are connected to a network, the there should be definitely communication between one computer and another. So the operating system is what makes it possible for one computer to communicate with other computers.
Security
Security is the important feature that should be looked for in an operating system. An operating system in the computer takes care of all security issues of computer and data in it. Log in passwords, firewall settings, and every such aspect related to security depends on the ability of the operating system. Some of the computers in network may involve in file sharing, and other data sharing. So it is important in such cases to have powerful secured operating systems.
Different betweenmultitasking & multiprogramming
Multiprogramming is a method of running several different programs in a computer apparently at the same time.
Usually on a mainframe - the computer has a number of programs loaded into memory and the operating system switches quickly between them, processing a little bit of each one in turn. The high speed of the processor makes it seem like more than one program is being run at the same time.
On a PC it is usually called multitasking.
-multitasking is the process which occur when more than one task(job) are executed by CPU at a time....-.Multitasking should not be confusing with multiple program where by in multiprogram more than one program(task) are in the mein memory but each one are executed by CPU at different time...It is impossible CPU to running more than one program at the same time