INTRODUCTION

Ê
Ê
Ê
Ê
Ê
Ê

UNIX based operating system.
Multiuser, multiprocessing, multithreaded OS.
Developed by Linus Torvalds in 1991.
Also used as Server OS.
Open Source software.
Monolithic Kernel Architecture.

CHARACTERISTICS
Ê Kernel written in ͚C͛ language
Ê Files & folders organized in single rooted
inverted tree structure.
Ê Hardware devices represented logically as
files.
Ê Multiple users can execute commands
concurrently from pseudo terminals.
Ê LINUX security model based around security
of files.

EVOLUTION
Ê Initially developed by LINUS TORVALDS in
1991.
Ê As open source became world wide project.
Ê Sep ͛91, Linux 0.01 released.
Ê Oct ͚91, Linux 0.02 released.
Ê X window system ported in 1992.
Ê Tux the penguin adopted as mascot in 1996.

SYSTEM HIERARCHY
Õ - logged in person 
- command interpreter
Interface b/w user & kernel 
- resource manager,
foundation on which utilites
and applications rely. 

- physical devices
including registers & data
paths

users
shell
kernel
H/W

FILE SYSTEM HIERARCHY
Ê
Ê
Ê
Ê
Ê
Ê
Ê
Ê
Ê

° - called as root. It is at top of hierarchy.
Ñ contains the kernel and boot related files.
Ñ contains all commands.
Ñ contains sytem configuration files & folders.
Ñ contains device nodes.
 Ñ home directory of root user.
 Ñ home directory of normal users.
 Ñ contains system binaries.
Ñ automatic mount point for foreign file
system.

FILE SYSTEM HIERARCHY
Ê  Ñ manual mount point for foreign file
system.
Ê  Ñ contains temporary files used by
system.
Ê  Ñ contains variable informations such as
sytem logs.

ÿROCESS
Ê An executing program with several components
and properties like pid, priority, file descriptors,
security credentials etc .
Ê ͚ ͛ is 1ST boot process with pid 1.
Ê Every process has a parent except ͚init͛.
Ê ÿrocess tree hierarchy is maintained.
Ê Linux supports multiprocessing.
Ê System processes known as § .

ÿROCESS STATES
Ê ë   Ñ process already running or waiting
for its turn to run.
Ê  Ñ waiting for an event to occur or a
signal to arise and wake it up.
Ê  Ñ process has been stopped.
Ê    Ñ halted process for some reason. It
sounds like dead process.

ÿROCESS SCHEDULING ALGO
Ê Linux uses pre-emptive scheduling.
Ê Each process is allowed to run for a small amount of
time and when this time has expired another process is
selected to run and the original process is made to wait
for a little while until it can run again.
Ê This small amount of time is known as a ÷  .
Ê Linux uses priority based scheduling algorithm to
choose between the current processes in the system.
Ê While switching it saves the state of the current
process, then restores back when required.
Ê it keeps information in the ÷ ÷÷ for each process

CONTD.
Ê ÿ  Ñ i) Round Robin
ii) First In First Out FIFO)
Ê ÿë ë Ñ ranges from 0 Ñ 139
0 Ñ 99 called static range allocated to real-time tasks.
100 Ñ 139 called dynamic range and is allocated to
conventional processes.
static priority higher than dynamic one.
Ê Ñ chunk of time given to process to run.
Higher a process͛s priority bigger time slice it gets.
Minm time slice 10 ms, default 200 ms and maxm time
slice is 300 ms.

INTERÿROCESS COMMUNICATION
Ê ÿrocesses communicate with each other and
with kernel to coordinate their activities.
Ê Linux supports a number of interprocess
communication mechanisms.
Ê  and  are two of them.
Ê Linux also supports  ÿmechanisms.

SIGNAL
Ê Oldest IÿC mechanism used.
Ê Used to signal asynchronous events.
Ê Could be generated by keyboard interrupt or an error
condition.
Ê No of supported signal limited to word size of
processor.
Ê ÿrocesses can send signal to processes with same uid
or gid.
Ê E.g. : ÿ - causes a process to halt its execution. 
Ñ causes a process to exit.

ÿIÿES
Ê Denoted by ͚ü͛
Ê Unidirectional byte streams.
Ê Connects std. output from one process into the std.
input of another process.
Ê Shell sets up pipes b/w processes.
Ê Implemented using two file data structures pointing at
same VFS inode and containing pointers to file
operation routine.
Ê E.g. : ü counts all files and directories in current
directory.

System V IÿC Mechanism 
  : Ê Allow processes to write messages, which will
be read by reading processes.
Ê Linux maintains list of message queue.
Ê Linux restricts number and length of message.
Ê If no room for message then process will be
added to message͛s write wait queue.

CONTD..  
:Ê Location in memory whose value can be tested
and set by any process.
Ê Test and set operation is atomic.
Ê Used to implement critical regions.
Ê Deadlock occurs when a process alters the value
of semaphore as it enters the critical region but
fails to leave region.
Ê Linux maintains lists of adjustments to
semaphore array to protect against deadlock.

CONTD..  
:Ê Allows one or more processes to communicate
via memory that appear in their virtual address
space.
Ê ÿages of virtual memory is referenced by page
table entries.
Ê Access to shared memory areas is controlled via
keys and access rights checking. Once the memory
is being shared, there are no checks on how the
processes are using it.

ÿHYSICAL DEVICES 
ëë§:Ê Read one character at a time.
Ê Read or write without buffering. E.g.-system͛s
serial ports /dev/cua0 and /dev/cua1.
Ê Accessed as files.
Ê System calls are used to open, read, write and
close those files.
Ê Entry of device driver in  
vector of 

÷÷ data structure.

CONTD..
*  :Ê Read or written in multiple of block size typically
512 or 1024 bytes.
Ê Entry of devices in Y  
vector of 

÷÷ data structure.
Ê Device drivers provide class specific interfaces to
the class. E.g. a SCSI device driver has to provide
interfaces to the SCSI subsystem which the SCSI
subsystem uses to provide file operations for this
device to the kernel.
Ê E.g. Ñ SCSI and IDE devices.

CONTD..
Ê
Ê
Ê

Ê  

:ÿhysical device that sends and receives packet of data such
as Ethernet card.
Represented by  
data structure.
§ 
data structure contains information about the
device and the addresses of functions that allow the
various supported network protocols to use the device's
services.
common network devices are:
/dev/ethN Ethernet devices
/dev/slN SLIÿ devices
/dev/pppN ÿÿÿ devices

I/O USING DMA
Ê Allows transfer of data to or from memory without
intervention of processor.
Ê DMA controller has 8 DMA channels.
Ê Each channel has 16 bit address and count register.
Ê DMA channels are not shareable.
Ê Linux tracks the usage of the DMA channels using a
vector of    data structures one per DMA
channel). The    data structure contains just
two fields, a pointer to a string describing the owner of
the DMA channel and a flag indicating if the DMA
channel is allocated or not.
Ê Some devices have a fixed DMA channel.

I/O USING ÿOLLING AND INTERRUÿTS
Ê ÿ  the device usually means reading its status
register every so often until the device's status changes
to indicate that it has completed the request.
Ê An   driven device driver is one where the
hardware device being controlled will raise a hardware
interrupt whenever it needs to be serviced.
Ê Device driver registers the address of an interrupt
handling routine and the interrupt number that it
wishes to own.
Ê Interrupts entries in /proc/interrupts file.

MEMORY MANAGEMENT
Ê LINUX supports virtual memory.
Ê Virtual and physical memory are divided into handy sized
chunks called › 
Ê Linux on Alpha AXÿ systems uses 8 Kbyte pages and on Intel
x86 systems it uses 4 Kbyte pages. Each of these pages is
given a unique number; the page frame number ÿFN).
Ê A virtual address is composed of two parts; an offset and a
virtual page frame number. If the page size is 4 Kbytes, bits
11:0 of the virtual address contain the offset and bits 12
and above are the virtual page frame number.
Ê To translate the virtual page frame number into a physical
one the processor uses › ÷ .

ÿAGE TABLE
ÿ contains the following information:
Ê . This indicates if this page table entry is
valid
Ê     that this entry
is describing
Ê      . This describes how
the page may be used. Can it be written to? Does
it contain executable code? 
- The page table is accessed using the virtual
page frame number as an offset.

SOME CONCEÿTS͙
§ §ÿ :Ê Technique of only loading virtual pages into
memory as they are accessed is known as
demand paging.
Ê Linux uses demand paging to load executable
images into a processes virtual memory.
Ê Linux uses the processes memory map in
order to determine which parts of the image
to bring into memory for execution.

CONTD͙  

ÿÿ  !
Ê To bring a virtual page into physical memory when no
free physical pages available, the operating system
discards another page from physical memory.
Ê Linux uses a  ëÕ "ëÕ#page aging
technique to fairly choose pages which might be
removed from the system. This scheme involves every
page in the system having an age which changes as the
page is accessed. The more that a page is accessed, the
younger it is; the less that it is accessed the older and
more stale it becomes. Old pages are good candidates
for swapping.

CONTD͙ 
Õ$ÿ* !
Ê Linux assumes that there are three levels of
page tables. Each ÿage Table accessed contains the
page frame number of the next level of ÿage Table.
Ê To translate a virtual address into a physical one, the
processor must take the contents of each level field,
convert it into an offset into the physical page
containing the ÿage Table and read the page frame
number of the next level of ÿage Table. This is repeated
three times until the page frame number of the
physical page containing the virtual address is found.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.