[go: up one dir, main page]

0% found this document useful (0 votes)
172 views10 pages

UNIX Case Study PDF

The document provides an overview of the Unix operating system, including its history, architecture, components and basic commands. It discusses what Unix is, the different types of Unix like Solaris, Linux and MacOS, the layered architecture and key concepts of Unix like kernel, shell, commands, files and directories. It also covers Unix system calls, header files, user interfaces and popular shells like Bourne, C and Korn shells.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views10 pages

UNIX Case Study PDF

The document provides an overview of the Unix operating system, including its history, architecture, components and basic commands. It discusses what Unix is, the different types of Unix like Solaris, Linux and MacOS, the layered architecture and key concepts of Unix like kernel, shell, commands, files and directories. It also covers Unix system calls, header files, user interfaces and popular shells like Bourne, C and Korn shells.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

PROGRAMMING LAB- IV

Submitted By
AKASH KUMAR CHOUDHARY – 1714110106
Roll No. - 14
A Report on

“Unix Operating System”


In partial fulfilment of the requirement
For the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER ENGINEERING
Under the Guidance of
Dr. S.S.Dhotre

DEPARTMENT OF COMPUTER ENGINEERING


BHARATI VIDYAPEETH
(DEEMED TO BE UNIVERSITY),
COLLEGE OF ENGINEERING, PUNE- 43
2019-20
What is UNIX?
UNIX is an operating system which was first developed in the 1960s, and has been
development ever since. It is a stable, multi-user, multi-tasking system for servers,
desktops and laptops. UNIX is highly portable across hardware since it is written in C
language.
UNIX allows only needed modules to be loaded in memory (modularity).It has an
inverted tree like file structure, with files and directories created within the file
structure. Each file can be protected using read, write and execute permissions for
the user, group and others (security). UNIX uses TCP/IP protocol. CAD/CAM
applications best perform in a UNIX system, with its varied support for graphic cards.
UNIX systems also have a graphical user interface (GUI) similar to Microsoft
Windows which provides an easy to use environment. However, knowledge of UNIX
is required for operations which are not covered by a graphical program, or when
there is no windows interface available, for example, in a telnet session.

Types of UNIX
There are many different versions of UNIX, although they share common similarities.
The most popular varieties of UNIX are Sun Solaris, GNU/Linux, and MacOS X. Here
in the School, we use Solaris on our servers and workstations, and Fedora Core Linux
on the servers and desktop PCs.

History of UNIX
 1969: Ken Thompson, Dennis Ritchie started working on a multi-user OS on
PDP-7, Bell Labs.
 1970: OS named as UNIX
 1973: OS rewritten in C
 1975: First Version of Berkeley Software Distribution (BSD)
 1982: AT&T announced UNIX System III, first public release.
 1983: AT&T announced UNIX System V, the first supported release.
 1984: Berkeley releases 4.2BSD, includes TCP/IP. X/Open formed
 1984: System V Release 2 introduced. 1,00,000 installations worldwide.
 1986: 4.3BSD released, including internet name server. Installed base
2,50,000
 1987: System V Release 3 introduced. Around 7, 50,000 installations.
 1988: Open Software Foundation formed.
 1989: System V Release 4 ships unifying System V, BSD 1.2 million
installations.
Layered Architecture:
UNIX is a layered operating system. The innermost layer is the hardware that
provides the services for the OS. The operating system, referred to in UNIX as the
kernel, interacts directly with the hardware and provides the services to the
user programs. Most well written user programs are independent of the
underlying hardware, making them readily portable to new systems.

Layered Architecture of the UNIX System You can have many users logged into a
system simultaneously, each running many programs. It's the kernel's job to keep
each process and user separate to regulate access to system hardware, including
CPU, memory, disk and other I/O devices.
The main concept that unites all the versions of Unix is the following four basics −
 Kernel − The kernel is the heart of the operating system. It interacts with the
hardware and most of the tasks like memory management, task 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 the most famous shells which are available with most of the Unix
variants.
 Commands and Utilities − There are various commands and utilities which you can
make use of 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 options.
 Files and Directories − All the data of Unix is organized into files. All files are then
organized into directories. These directories are further organized into a tree-like
structure called the filesystem.
UNIX System Calls
The UNIX operating system has two separable parts: the kernel and the service programs.
User programs interact with the kernel through a set of standard system calls. These system
calls request services to be provided by the kernel. Such services would include accessing a
file: open close, read, write, link, or execute a file; starting or updating accounting records;
changing ownership of a file or directory; changing to a new directory; creating, suspending,
or killing a process; enabling access to hardware devices; and setting limits on system
resources. The kernel provides control of file system, CPU scheduling, memory management,
and other operating system functions through system calls. System calls de fine the
programmer interface to operating system; the set of systems programs commonly available
defines the user interface. System calls also provide the interface between a running program
and the operating system. The C language allows system calls to be made directly. Typical
system calls are:

Header Files:
Header files define how a system call works. A header file contains a definition of the system
call, and the parameters (variables) required by the call, and the parameters returned by the
system call.

UNIX User Interface


In the last few years, there has been extensive work to improve the user interface to UNIX.
The most dramatic effort has been the addition of windowing interfaces on top of UNIX such
as Xwindows, Sun tools, Next Step, Motif, Open Look, etc. These windowing interfaces do not
change UNIX itself but are built on top of UNIX to provide a more intuitive interface to UNIX.
Each of the different user interfaces has some advantages and some disadvantages. Currently
intensive development effort is being done on all of these Graphical User Interfaces (GUIs).
Even with all of these efforts, UNIX is weak in the end-user interface area.
UNIX Shell
The shell is your interface to the operating system. It acts as a command interpreter; it takes
each command and passes it to the operating system. It then displays the results of this
operation on our screen. An interpreter operates in a simple loop: It accepts a command,
interprets the command, executes the command, and then waits for another command. The
shell displays a "prompt," to notify us that it is read y to accept your command.
Each shell command consists of a command name, followed by command options (if any or
desired) and command arguments (if any o r desired). The command name, options, and
arguments, are separated by a blank space. A program is referred to as a process while the
kernel 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 as a
separate process. Many basic shell commands are actually subroutines built in to the shell
program. The commands that are not built in to the shell require the kernel to start another
process to run them.
When you execute a non built-in shell command, the shell asks the kernel to create a new sub
process (called a "child" process) to perform the command. The child process exists just long
enough to execute the command. The shell waits until the child process finishes before it will
accept the next command. There are several shells in widespread use. The most common
ones are described below.
 Bourne shell (sh)
Original UNIX shell written by Steve Bourne of Bell Labs. Available on all UNIX
systems. Does not have the interactive facilities provided by modern shells such as the
C shell and Korn shell. The Bourne shell does provide an easy to use language with
which you can write shell scripts.

 C shell (csh)
Written at the University of California, Berkley. As it name indicates, it provides a C
like language with which to write shell scripts.

 Korn shell (ksh)


Written by David Korn of bell labs. It is now provided as the standard shell on UNIX
systems. Provides all the features of the C and TC shells together with a shell
programming language similar to that of the original Bourne shell.

 TC Shell (tcsh)
Available in the public domain. It provides all the features of the C shell together with
EMACS style editing of the command line.

 Bourne Again Shell (bash)


Public domain shell written by the Free Software Foundation under their GNU
initiative. Ultimately it is intended to be a full implementation of the IEEE POSIX Shell
and Tools specification. Widely used within the academic community. Provides all the
interactive features of the C shell (csh) and the Korn shell (ksh).Its programming
language is compatible with the Bourne shell (sh).
Basic Commands
1. pwd — When you first open the terminal, you are in the home directory of your user. To
know which directory you are in, you can use the “pwd” command. It gives us the absolute
path, which means the path that starts from the root.

2. ls — Use the "ls" command to know what files are in the directory you are in. You can see
all the hidden files by using the command “ls -a”.

3. cd — Use the "cd" command to go to a directory. For example, if you are in the home
folder, and you want to go to the download folder, then you can type in “cd Downloads”.
Remember, this command is case sensitive, and you have to type in the name of the folder
exactly as it is.

4. mkdir & rmdir — Use the mkdir command when you need to create a folder or a
directory. Use rmdir to delete a directory. But rmdir can only be used to delete an empty
directory.

5. rm - Use the rm command to delete files and directories. Use "rm -r" to delete just the
directory.
6. touch — The touch command is used to create a file. It can be anything, from an empty txt
file to an empty zip file. For example, “touch new.txt”.

7. man — To know more about a command and how to use it, use the man command. It
shows the manual pages of the command.

8. cp — Use the cp command to copy files through the command line. It takes two arguments:
The first is the location of the file to be copied, the second is where to copy.

9. mv — Use the mv command to move files through the command line. It takes the two
arguments, just like the cp command.

10. locate — The locate command is used to locate a file in a Linux system, just like the
search command in Windows. Using the -i argument with the command helps to ignore the
case (it doesn't matter if it is uppercase or lowercase). So, if you want a file that has the word
“hello”, it gives the list of all the files in your Linux system containing the word "hello" when
you type in “locate -i hello”. If you remember two words, you can separate them using an
asterisk (*). For example, to locate a file containing the words "hello" and "this", you can use
the command “locate -i *hello*this”.
Memory Management

UNIX Memory Management Policies

 Swapping

1. Easy to implement

2. Less system overhead

 Demand Paging

1. Greater flexibility
Swapping
 The swap device is a block device in a configurable section of a disk
 Kernel allocates contiguous space on the swap device without fragmentation.
 It maintains free space of the swap device in an in-core table, called map.
 The kernel treats each unit of the swap map as group of disk blocks.
 As kernel allocates and frees resources, it updates the map accordingly

Demand Paging

 Not all page of process resides in memory

 Locality

 When a process accesses a page that is not part of its working set, it incurs a page fault.

 The kernel suspends the execution of the process until it reads the page into memory
and makes it accessible to the process.

Interrupts:
Interrupts are signal that are sent across IRQ (Interrupt Request Line) by a hardware or
software. Interrupts allow devices like keyboard, serial cards and parallel ports to indicate
that it needs CPU attention. Once the CPU receives the Interrupt Request, CPU will
temporarily stop execution of running program and invoke a special program called Interrupt
Handler or ISR (Interrupt Service Routine).
The Interrupt Service or Interrupt Handler Routine can be found in Interrupt Vector table
that is located at fixed address in the memory. After the interrupt is handled CPU resumes the
interrupted program. At boot time, system identifies all devices, and appropriate interrupt
handlers are loaded into the interrupt table.
The following are two ways of requesting CPU attention:
1. Interrupt based
2. Polling based
All Linux based OS are interrupt driven. When we press a key on keyboard, keyboards says to
CPU that a key has been pressed. But CPU can be busy processing some stuff from RAM,
System Clock, NIC card, may be video or PCI bus. In that case Keyboard places a voltage on
IRQ line assigned to that hardware, here in this case [Keyboard]. This change in voltage
serves as request from device saying that device has a request that needs processing.
IRQ number determines the priority of the interrupt that needs to be handled by the CPU. A
small IRQ number value means higher priority. For example if CPU receives interrupt from
Keyboard and system clock simultaneously. CPU will serve System Clock first since it has IRQ
number 0.
Hardware Interrupts
All of the above discussed scenarios are example of Hardware interrupts.
Hardware interrupts are further classified into two major categories:
1. Non-maskable interrupts [NMI]: As the name suggests these types of interrupts
cannot be ignored or suppressed by the CPU. MNI’s are send over separate interrupt
line and it’s generally used for critical hardware errors like memory error, Hardware
traps indicating Fan failure, Temperature Sensor failure etc.
2. Maskable interrupts: These interrupts can be ignored or delayed by CPU. The
Interrupt Mask Register masks the interrupts being triggered on external pins of cache
controller. Setting a bit by writing a 0, disables the interrupt triggering on the pin
Software Interrupts
These interrupts are generated when the CPU executes an instruction which can cause an
exception condition in the CPU [ALU unit] itself. For example, divide a number by zero which
is not possible, it will lead to divide-by-zero exception, causing the computer to abandon the
calculation or display an error message.
The file /proc/stat is also a file part of the /proc filesystem, which has information about
system kernel statistics, also holds some interrupt information.

Applications of UNIX OS:


1. Supercomputers:The top 500 supercomputer list as of June 2018 is now populated
100% by Linux powered systems. Prior to the rise of Linux, it was essentially all
proprietary Unix. There was a time when macos X, and even microsoft windows were
represented on the list, but all non-Linux systems have been blasted out of the bottom
of the list.
2. Mobile devices: Android, an OS based on the Linux kernel, is the most popular mobile
OS in the world, powering phones, tablets and various smart devices, and its market
share continues to grow over time
3. Internet services: The largest scale web, email, file transfer and storage, and online
commerce services typically run on Linux or other Unix platforms.
4. Databases: The largest, fastest databases in the world run on Linux or other Unix
platforms.
5. Automotive electronics: Navigation, entertainment and security systems are
increasingly based on embedded Linux.
6. Movie scene rendering: Motion picture studios use large Linux systems to run multi-
week CGI rendering jobs.
7. Netbooks, laptops and desktop computers: The chromebook is a popular, zero
maintenance netbook running Linux. And of course, ordinary users can run Linux on
their laptops or desktops.

References:
1. Unix.org
2. http://marketshare.hitslink.com/operating-system-market-
share.aspx?qprid=8&qpcustomd=0
3. http://marketshare.hitslink.com/operating-system-market-
share.aspx?qprid=8&qpcustomd=0
4. www.studymafia.org

You might also like