Operating Systems and Linux I
Operating Systems and Linux I
MIS Group
Indian Institute of Management Calcutta
What does an Operating System do?
I/O modules: Moves data between the computer and its external
environment, such as disks, data communication equipments,
and terminals.
MAR 1
PC
2
MBR Instruction
IR Instruction
I/O AR Instruction
I/O BR
Execution
Data
Data
Data
Data
n -2
Buffers n -1
Input-Output Module
Interrupts
Two cases:
Writing to disk initiated by P1 might finish before P2 completes
calculations.
Registers
Cache
Main Memory
Magnetic tape
Cache
Objectives of an O.S.
Convenience of use of the computer
Utilities
Programmer
Operating System
Access to I/O devices Each I/O device has its own set of
Instructions and control signals. O.S. hides these details to provide a
common interface to the user/programmer.
Operating System Services
Controlled access to files- nature of I/O device (disk drive, tape
drive) and structure of the data stored in the files in the storage medium. In
the case of multiple users accessing the processor concurrently, proper
protection mechanisms have to be used.
System access- For shared or public systems, the O.S. controls access
to the system as a whole and to specific system resources. Access system
provides protection of resources, and data from unauthorised users, and
resolves resource conflicts
Serial Processing
From 1940s to mid-1950s
Programmer interacted with the hardware
Programs in machine code were loaded via the input device (card
reader)
In case of any error, they were indicated with lights
Associated problems:
TOTAL 40 s
P1, P2, P3 Run Run Run Wait Run Run Run Wait
Any Advantage?
Multiprogramming/Multitasking: Some Figures
Processes
Memory management
System structure
Processes
A process is
Program code
Program code
context
context
data
data
Process Control Block
Identifier: A unique integer associated with a process
State : A currently executing process is in running state
Priority : Priority level relative to other processes
Program counter : Address of the next instruction of the
program to be executed.
Memory pointers: pointers to the program code and data
associated with the process, and any shared memory blocks
Context data: Data in the registers in the processor during
process execution.
I/O status information: outstanding I/O requests, I/O devices
allocated to the process, a list of files is use by the process, etc.
Accounting information: amount of processor time, etc.
Key responsibilities of Resource management
10 20 30
Kernel
Application Programs
Shell
UNIX commands and
libraries
Utilities
System call
interface
bash
H/W
who
Kernel
wc
vi
Traditional Unix Kernel
User programs
Libraries
User level
Kernel level
Hardware control
Kernel level
Hardware level
Hardware
Some Basic Characteristics of Linux
Multi-user System
Multiprogramming/Multitasking system
Characteristics:
Hierarchical structure
Consistent treatment of file data
Ability to create, modify and delete files
Dynamic growth of files
Protection of file data
Treating peripheral devices (terminals, tapes, etc.) as files
Linux File System Layout (RedHat)
Directory Structure of Linux File System
Directory Content
Common programs, shared by the system, the system administrator and
/bin
the users.
The startup files and the kernel, vmlinuz. In recent distributions also grub
/boot data. Grub is the GRand Unified Boot loader and is an attempt to get rid
of the many different boot-loaders we know today.
Contains references to all the CPU peripheral hardware, which are
/dev
represented as files with special properties.
Most important system configuration files are in /etc, this directory
/etc
contains data similar to those in the Control Panel in Windows
/home Home directories of the common users.
/initrd (on some distributions) Information for booting. Do not remove!
Library files, includes files for all kinds of programs needed by the
/lib
system and the users.
Directory Structure of Linux File System
Directory Content
Every partition has a lost+found in its upper directory. Files that were saved during
/lost+found
failures are here.
/misc For miscellaneous purposes.
/mnt Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
/net Standard mount point for entire remote file systems
/opt Typically contains extra and third party software.
A virtual file system containing information about system resources. More information
/proc about the meaning of the files in proc is obtained by entering the command man proc in
a terminal window.
The administrative user's home directory. Mind the difference between /, the root
/root
directory and /root, the home directory of the root user.
/sbin Programs for use by the system and the system administrator.
/tmp Temporary space for use by the system.
/usr Programs, libraries, documentation etc. for all user-related programs.
Storage for all variable files and temporary files created by users, such as log files, the
/var mail queue, the print spooler area, space for temporary storage of files downloaded from
the Internet, or to keep an image of a CD before burning it.
Mounting of file systems
etc usr
usr
tom harry
Types of files in a Linux System
Regular files : they contain normal data, for example text files, executable files
or programs, input for or output from a program and so on.
Directories: files that are lists of other files.
Special files: Devices treated as files, used for input and output. They exist
in /dev.
Links: a system to make a file or directory visible in multiple parts of the
system's file tree.
(Domain) sockets: a special file type, similar to TCP/IP sockets, providing
inter-process networking protected by the file system's access control.
Named pipes: act more or less like sockets and form a way for processes to
communicate with each other, without using network socket semantics.
Permissions of a file
Read
Write
execute
Listing files in a Linux System
The -l option to ls displays the file type, using the first character of each input line:
psdg/Documents> ls l
total 8
-rw-rw-r-- 1 psdg faculty 31744 Feb 21 17:56 samplefile1.doc
lrw-rw-r-- 1 psdg faculty 41472 Feb 21 17:56 samplefile2
drwxrwxr-x 2 psdg faculty 4096 Feb 25 11:50 os-course/
crw-rw-r-- 1 psdg faculty 41472 Feb 21 17:56 /dev/tty00
Symbol Meaning
- Regular file
d Directory
l Link
c Special file
s Socket
p Named pipe
User Accounts
login nmes
passwords
user id
group id
Home directory