Lecture No. 04
Dated: 26-04-2025
Layered Approach
The benefit of this approach is modularity.
The system is made up of different layers.
The bottom layer is the hardware
layer and the upper layer is called the user interface
layer.
The middle (layer - M) is the operating system
1 layer which consists of data structures
and routines
which can be invoked by higher layers.
It also simplifies debugging and system verification.
Though it is less efficient as it creates overhead with each system call
.
Example
- The
operating system
1 byDijkstra
- IBM's OS/2
Micro Kernels
This method structures the operating system
1 by removing all non essential components of the kernel
and implement system
and user level
programs
.
This results into smaller (micro) kernels
which provide communication facilities between client program
and various services
also running in the user space
.
It also provides minimum process and memory management.
This provides easy of extending the operating system
1 or making it run on different hardware designs because most of the time, the kernel
doesn't need to be modified as the new services
are added to user space
and even if kernel
does need to be modified then those changes are very small.
Examples
- Mach
- MacOS X Server
- QNX
- OS/2
- Windows NT
Virtual Machines
Conceptually, a computer is made up of different layers.
- Hardware
Kernel
System programs
Application programs
Each layer has access to layers below it.
Non virtual machines
vs virtual machines
There are 2 advantages of virtual machines
despite the fact that they are hard to implement.
- They provides a robust level of security.
System development
to be done without disruptingnormal system operation
.
Java Virtual Machine
The JVM
loads, verifies and executes the java bytecode
.
Examples
Following are the examples of virtual machines
.1
- VMWare
- Virtual PC
- Virtual Box
System Design and Implementation
Design Goals
At the highest level, the design of the system will be affected by the choice of hardware
and type of system
.
Beyond this, requirements might be much harder to specify and can be divided into 2 groups.
- User goals
- System goals
An important design goal is separation of mechanism
and policies
.
Mechanism
They determine how to do something and a general mechanism is more desirable
.
Example
CPU Protection
2
Policy
Determine what will be done.
Example
Initial value in the counter
used for CPU protection
.2
This separation is important because policies can change over place or time.
Implementation
Back then, operating systems
1 were written in assembly language
but now a days, we use C
or C++
for that as the code is written faster, is more compact, easier to understand and easier to port
.
Unix / Linux Directory Structure
History
Dennis Ritchie
and Ken Thomsom
wrote UNIX
at the Bell Labs
in 1969
.
It was initially written in assembly language
and a higher level language called Bit
and was later converted to C
.
Linus Torvalds
, an undergraduate student at the University of Helsinki, Finland, wrote Linux
in 1991
.
UNIX
uses a hierarchical file system structure
consisting of a root directory
denoted as /
with other directories and files hanging under it.
A path
is separated by /
and last component of it can be either a file
or a directory
.
When you login, the system places you in home directory
(also called the login directory
) and it is referred to, by
~
or$PATH
inbash
,sh
,tsh
$path
incsh
,tcsh
The shells understand relative
and absolute paths
.
Absolute path
starts with /
meanwhile relative path
can start with either
Home Directory
(~
)Current Directory
(.
)Parent Directory
(..
)
Commonly Used Directory Structure in Linux
/
The root directory
is similar to C:\
, D:\
drive in windows
etc. But the difference here is that unlike windows
, everything is under one, singular root node
.
/bin
These are binaries
or executables
, available to all users
.
/boot
This directory contains essential files for system boot
, including kernel image
.
/dev
This directory contains all the devices which are available to Linux
.
/etc
Contains the configuration files (which are text files and are easy to edit).
Example
/etc/inittab
contains whatprocesses
will be started alongsidesystem boot
./etc/fstab
identifies file systems and their mount points./etc/passwd
is where users are defined.
/home
Every available user
is present here.
Example
If there are multiple users, say chris
and tom
then you will find
/home/chris
/home/tom
/lib
Shared libraries
and kernel modules
are stored in this directory.
These can be dynamically linked and are very similar to DLLs
in windows
.
/lost+found
Here, linux keeps files which need to be restored after a crash or when partition has not been properly unmounted before a shutdown.
/mnt
File systems can be mounted anywhere but this is the convenient place to mount temporary file systems.
/opt
Often used for storage of large applications packages.
/proc
This is a virtual directory
and doesn't exist physically.
Here, the system processes are stored.
/root
The home directory for the super user (root
).
/sbin
Utilities used for system administration such as
halt
ifconfig
fdisk
The /sbin/init.d
are scripts which are used by /sbin/init
to start the system.
/tmp
Used to store temporary files.
/usr
A shareable, read-only directory containing user applications and their support files. Key subdirectories include:
/usr/X11R6
: X Window System files./usr/bin
: user-accessible commands./usr/doc
: documentation for/usr
applications./usr/include
: C compiler header files./usr/include/g++
: C++ compiler header files./usr/lib
: libraries, binaries, and object files not directly executed by users./usr/local
: locally installed software, safe from system updates./usr/man
: manual pages./usr/share
: architecture-independent, read-only data files./usr/src
: source code for installed applications and the kernel.
/var
Contains variable data files such as
- Logs in
/var/log
- Mails in
/var/mail
- Spools in
/var/spool
References
-
Read more about CPU protection. ↩↩