Unix
Unix
By
Nick Gomez, Chris Rees, Brian Hernandez, Hector Rodriguez,
Chris Sosa, and Joshua Burbridge
What Is UNIX?
An operating system originally created in 1969
Provided many ground-breaking features
Completely self supporting
Originally designed in assembly code
Rewritten in C in 1973
The foundation of modern day Linux and BSD operating systems
Why UNIX?
UNIX incorporated many special features that were either new or uncommon
to operating systems of the time. UNIX revolutionized operating system design,
and many of it’s principles are used in modern operating systems, such as
Windows, OS X, and Linux.
Features
Hierarchical File System
Compatible File, Device, and Inter-Process I/O
Asynchronous Processes
System Command Language
Supports Multiple Users
The File System
Let’s see why the UNIX file system was so unique for its day!
Three Types of Files
1. Ordinary Files
Files do not exist inside directories. Rather, directories store file names and
pointers to the information that describes the file.
Three Types of Files
3. Special Files
Represents a particular device
Read from and write to like normal files
Unlike normal files, it interacts with associated devices
Stored in the /dev directory
Why Special Files?
Provides little distinction between files and devices
Programs expecting files to read/write to can also accept devices without
needing to differentiate the two
Devices are subject to the same protection mechanics that files have
Removable File System
Another unique feature of the UNIX file system is removable file systems. Using
the system command mount, you can attach removable volumes to a leaf in the
file structure. There is virtually no distinction between the removable volume
and the permanent file system.
Protection
Another innovation of UNIX was access control on files.
Files created with owner name
6 bits for read/write/execute permissions for owner and others
7th bit can allow other users to temporarily become owner of the file
Super-User
Regular users have limited access on a machine in some form or another
Super-user is the highest privileged user on the machine, able to perform
any action
Usual constraints on the machine do not apply to super-user
Should only allow one person access
Implementation Of File System
Directories contain file names and pointers
Pointer is called an i-number (index number) of the file
I-number references the information of the file in the system table
File Information
Owner name
Protection bits
Physical address of location on disk
Size
Time of modification
Number of links to file
Directory bit
Special file bit
“Large” or “small” bit
Efficiency of File System
File system provides satisfactory performance
7621 line test program
Total time of 35.9 seconds, 212 lines per second
Time taken for each element:
63.5% Assembler execution
20.0% Disk wait time
16.6% System overhead
I/O Calls
Eliminate differences between different devices
open(name, flag) and Create
No user-visible automatic locks on files, unnecessary and insufficient
Sufficient internal interlocks
Files are sequential
read(filep, buffer, count), write(filep, buffer, count)
seek(filep, base, offset)
Special Files
Unique feature of UNIX
Integral to I/O devices
Acts as ordinary file
Read/Write requests activate device
File and device I/O treated similar as possible
Same syntax and meaning
Same protection
Processes and Images
Image – execution environment
Core Image
Register Values
Open Files
Curr. Directory
Curr. state
Processes
Execution of image
Image resides in core
pID = fork(label)
Splits into two processes
Contain original image
Parent/child processes
Parent Process
Control returns from fork
Child Process
Control passed to label
Pipes
filep = pipe()
Returns file descriptor
Creates interprocess channel
Read in/execute
Creates process
Code in process replaced
Error if no children
Can contain status from further descendants
Termination
exit(status)
Terminates process
Destroys image
Closes open files
“Obliterates”
Quit signal
Force core image to be created