UNIX
OPERATING SYSTEM
What is UNIX?
▪ An operating system originally created in 1969
▪ Many groundbreaking features are provided
▪ Completely self-supporting
▪ Originally created from assembly code
▪ Rewritten in C in 1973
▪ The foundation of modern Linux and BSD operating systems
N.M.H.S. NISHSHANKA 5/15/2023 2
Why UNIX?
UNIX incorporated many special features that were new or unusual for
operating systems at the time. UNIX revolutionized the design of operating
systems, and many of its principles are used in modern operating systems such
as Windows, OS X, and Linux.
N.M.H.S. NISHSHANKA 5/15/2023 3
Features
▪ Hierarchical file system
▪ Compatible file, device and inter-process I/O
▪ Asynchronous processes
▪ System command language
▪ Supports multiple users
N.M.H.S. NISHSHANKA 5/15/2023 4
file system
There are three types of files
1. General files
▪ Binary (executable) files
▪ Plain text files
▪ Symbolic links
N.M.H.S. NISHSHANKA 5/15/2023 5
There are three types of files
2. directories
▪ Provides mapping between filenames and files
▪ Allow paths (eg /home/unnamed/Desktop)
▪ root directory (eg /)
▪ . and .. indicate current and parent directory respectively: /usr/local/.. (same as
/usr)
An important note
▪ There are no files in the directories. Instead, directories store file names and
pointers to information that describes the file.
N.M.H.S. NISHSHANKA 5/15/2023 6
There are three types of files
3. Special files
▪ Represents a specific device
▪ Read and write like normal files
▪ Unlike normal files, it interacts with connected devices
▪ Stored in the /dev directory
N.M.H.S. NISHSHANKA 5/15/2023 7
Why special files?
▪ Provides a small distinction between files and devices
▪ Devices can be accepted without having to change the two programs that
want to read/write files
▪ Devices are subject to the same security mechanisms as files
N.M.H.S. NISHSHANKA 5/15/2023 8
Removable file system
Another unique feature of the UNIX file system is removable file systems. Using
the mount system command, you can attach removable volumes to a leaf in the
file structure. There is practically no difference between a removable volume
and a permanent file system.
N.M.H.S. NISHSHANKA 5/15/2023 9
Security
Another innovation in UNIX was access control over files.
▪ File created with owner name
▪ 6 bits for read/write/execute permissions for owner and others
▪ The 7th bit can temporarily allow other users to become the owner of the
file
N.M.H.S. NISHSHANKA 5/15/2023 10
Super user
▪ Regular users have limited access to a machine in one form or another
▪ Super-user is the most privileged user of the machine, and has the ability to
perform any action
▪ The normal restrictions on the machine do not apply to the superuser
▪ Only one person should be allowed access
N.M.H.S. NISHSHANKA 5/15/2023 11
File system implementation
▪ Directories contain file names and pointers
▪ The index is called the i-number of the file
▪ The I-number refers to the information in the file in the system table
N.M.H.S. NISHSHANKA 5/15/2023 12
File information
▪ Owner's Name
▪ Security bits
▪ The physical address of the location on the disk
▪ Size
▪ Change time
▪ Number of links to the file
▪ Directory bit
▪ Special file bit
▪ "big" or "small" bit
N.M.H.S. NISHSHANKA 5/15/2023 13
File system efficiency
❑ The file system provides satisfactory performance
❑ 7621 Linear Test Program
▪ Total time 35.9 seconds, 212 lines per second
▪ Each element takes time:
• 63.5% Assembler implementation
• 20.0% disk latency
• 16.6% system overhead
N.M.H.S. NISHSHANKA 5/15/2023 14
I/O calls
▪ Eliminate differences between different devices
▪ open(name, flag) and create
▪ No user-visible automatic locks on unnecessary and insufficient files
▪ Adequate internal interlocks
▪ The files are sequential
▪ read(filep, buffer, count), write(filep, buffer, count) read(filep, buffer, count),
write(filep, buffer, count)
▪ seek(filep, base, offset)
N.M.H.S. NISHSHANKA 5/15/2023 15
Special files
▪ A unique feature of UNIX
▪ Integration for I/O devices
▪ Works like a regular file
▪ Enables read/write request device
▪ File and device I/O are treated as equally as possible
• Same syntax syntax and Meaning
• The only protection
N.M.H.S. NISHSHANKA 5/15/2023 16
What is Linux?
▪ Linux is a free operating system.
▪ An operating system is the basic software that
manages a computer.
• Windows NT
• Macintosh OS
▪ Linux is a variant of the UNIX operating system.
• Solaris
• IRIX
N.M.H.S. NISHSHANKA 5/15/2023 17
Advantages of Linux
▪ Linux Free:
• The price is zero.
• Unlimited copies are permitted.
• Read and modify the source code.
▪ Manuals are available online.
▪ Common in scientific circles.
▪ The text interface is good for batch processing and management.
N.M.H.S. NISHSHANKA 5/15/2023 18
The most popular Linux server distributors are
▪ Ubuntu Linux
▪ Linux Mint
▪ Arch Linux
▪ Deepin
▪ Fedora
▪ Debian
▪ CentOS
N.M.H.S. NISHSHANKA 5/15/2023 19
Disadvantages of Linux
▪ The text interface is not as user-friendly as Windows.
• But there is Star Office software which looks like Windows.
▪ Less commercial software is available.
• But there is more scientific software than that.
▪ More difficult to set up.
• But once set up, it's easy to manage.
N.M.H.S. NISHSHANKA 5/15/2023 20
Available software
▪ Most software for Linux is also free!
▪ The GNU project is the source of many free software: gcc, g77, emacs
▪ The workshop will focus on these text-based programs.
N.M.H.S. NISHSHANKA 5/15/2023 21
Available software
▪ Compilers: Compilers
▪ G77 (FORTRAN 77)
▪ Gcc ( C )
▪ g++ (C++)
▪ Text editors
• Emacs
▪ Typesetting Typesetting
• Troff, TeX
▪ Graphing
• Gnuplot
N.M.H.S. NISHSHANKA 5/15/2023 22