Case Study - Unix: Lecture Series by
Case Study - Unix: Lecture Series by
Dhindsa © 2007
Lecture Series By :
www.dhindsa.info
1
UNIX -- HISTORY
◆ AT&T
Ritchie & Thompson’s “Unics”
{Uniplexed Operating & Computing system}
• 1965 – Bell and GE joined project MAC at MIT to develop
Multics.
• Goal: Multicomputing and data sharing for a large group
of users.
YEAR - 1969
Thompson and Ken Ritchie implemented an earlier
designed file system on PDP-7.
This grew into UNIX.
File system design and idea of command interpreter
(shell) as a user process came from MULTICS
Fork idea came from Berkeley’s GENIE OS. 2
O.S. by Er. K.S.Dhindsa © 2007
UNIX -- HISTORY
3
O.S. by Er. K.S.Dhindsa © 2007
UNIX -- HISTORY
4
O.S. by Er. K.S.Dhindsa © 2007
BSD Layer Structure
5
O.S. by Er. K.S.Dhindsa © 2007
SYSTEM CALL & FILE MANIPULATION
7
O.S. by Er. K.S.Dhindsa © 2007
Design Philosophy
• Simplicity
• C language
• Time-sharing
• Simple user interface (modular and may be
replaced)
• Device independence (treat files and devices
in same manner)
• Aimed for programming environment
• Flexibility
8
O.S. by Er. K.S.Dhindsa © 2007
UNIX - Design Principles
10
O.S. by Er. K.S.Dhindsa © 2007
SHELL
•Programs such as shell and vi interact with kernel using
well defined system call procedures.
Most of what is considered the Unix
interface is really the SHELL INTERFACE
◆ The shell is equivalent to COMMAND.COM on DOS
• sh the Bourne shell (after its creator)
• ksh the Korn Shell: sh plus visual editing
• csh the C-shell: introduced C-style programming
features
• tcsh: csh plus visual editing
• bash the Bourne Again SHell: sh plus visual editing
11
O.S. by Er. K.S.Dhindsa © 2007
Role of SHELLS
• Shells provide:
– Multiple commands on a single line
– Redirection of input and output (like >>)
– Expansion of wildcard filenames
– Background execution
– Pipelines
– Script-programming facility
• Normally the shell waits for a command to complete
before prompting for another command
• Can run a job in the background and not wait for it
12
O.S. by Er. K.S.Dhindsa © 2007
PROCESS MANAGEMENT
13
O.S. by Er. K.S.Dhindsa © 2007
Process Management
14
O.S. by Er. K.S.Dhindsa © 2007
Process Management
15
O.S. by Er. K.S.Dhindsa © 2007
CPU SCHEDULING
• Every process has a scheduling priority associated with it;
larger numbers indicate lower priority.
• Negative feedback in CPU scheduling makes it difficult for a
single process to take all the CPU time.
• Process aging is employed to prevent starvation.
• When a process chooses to relinquish the CPU, it goes to
sleep on an event.
• When that event occurs, the system process that knows
about it calls wakeup with the address corresponding to the
event, and all processes that had done a sleep on the
same address are put in the ready queue to be run.
16
O.S. by Er. K.S.Dhindsa © 2007
Memory Management
17
O.S. by Er. K.S.Dhindsa © 2007
FILE SYSTEM COMMANDS
19
O.S. by Er. K.S.Dhindsa © 2007
UNIX
20
O.S. by Er. K.S.Dhindsa © 2007
UNIX Utility Programs
21
O.S. by Er. K.S.Dhindsa © 2007
UNIX Kernel
22
O.S. by Er. K.S.Dhindsa © 2007
PROCESS CONTROL -- UNIX
23
O.S. by Er. K.S.Dhindsa © 2007
USER INTERFACE IN UNIX
24
O.S. by Er. K.S.Dhindsa © 2007
PROCESS CONTROL BLOCKS
• The most basic data structure associated with processes is
the process structure.
– unique process identifier
– scheduling information (e.g., priority)
– pointers to other control blocks
• The virtual address space of a user process is divided into
text (program code), data, and stack segments.
• Every process with sharable text has a pointer form its
process structure to a text structure.
– always resident in main memory.
– records how many processes are using the text segment
– records were the page table for the text segment can be
found on disk when it is swapped. 25
O.S. by Er. K.S.Dhindsa © 2007
PAGING
26
O.S. by Er. K.S.Dhindsa © 2007
C-LISTS
27
O.S. by Er. K.S.Dhindsa © 2007
System Calls for Process Management
A file is represented by an inode — a record that
stores information about a specific file on the disk.
s is an error code
pid is a process ID
residual is the remaining time from the previous alarm
28
O.S. by Er. K.S.Dhindsa © 2007
Booting UNIX
31
O.S. by Er. K.S.Dhindsa © 2007
INTERPROCESS COMMUNICATION
32
O.S. by Er. K.S.Dhindsa © 2007
UNIX File System
33
O.S. by Er. K.S.Dhindsa © 2007
UNIX File System
The relation between the file descriptor table, the open file
description 37
O.S. by Er. K.S.Dhindsa © 2007
SECURITY IN UNIX
38
O.S. by Er. K.S.Dhindsa © 2007
O.S. by Er. K.S.Dhindsa © 2007
Lecture Series By :
www.dhindsa.info
39