RRIT OS M1
RRIT OS M1
The operating system's role in the overall computer system is studied, by considering a computer
system which can be divided roughly into four components: the hardware, the operating system,
the application programs, and the users.
Hardware provides basic computing resources such as CPU, memory, I/O devices
System & Application programs define the ways in which the system resources are used to
solve the computing problems of the users / systems. Word processors, compilers, web
browsers, database systems, video games.
Operating system controls and coordinates use of hardware among various applications
and users
Users: People, machines, other computers.
User View of computer system varies according to the interface being used.
PC: In this system the operating system is designed mostly for ease of use.
Mainframe or Minicomputer: Operating system is designed to maximize resource
utilization.
Workstation: Operating system is designed to compromise between individual usability and
resource utilization.
Handheld devices: Their operating systems are designed mostly for individual usability, but
performance per amount of battery life is important as well.
Embedded computers in home devices and automobiles: their operating systems are
designed primarily to run without user intervention.
System View: From the computer's point of view, the operating system is the program most intimately
involved with the hardware. In this context, we can view an operating system as a
i. Resource allocator:
a) Manages all resources
b) Decides between conflicting requests for efficient and fair resource use
ii. Control program:
a) Control the various I/O devices and user programs.
b) Controls execution of programs to prevent errors and improper use of the computer
DEFINING OPERATING SYSTEMS
• The common functions of controlling and allocating resources are brought together in one
piece of software called Operating System
• ―The one program running at all times on the computer‖ is the kernel. Everything else is
either a system program (ships with the operating system) or an application program.
OPERATING SYSTEMS MODULE 1
COMPUTER-SYSTEM ORGANIZATION
1. Computer-system operation
a. One or more CPUs, device controllers connect through common bus providing
access to shared memory.
b. Concurrent execution of CPUs and devices competing for memory cycles.
Page 2
OPERATING SYSTEMS MODULE 1
Interrupt
The occurrence of event is signaled by interrupt from either hardware(signal to CPU) or
software (system call)
Interrupt transfers control to the interrupt service routine generally, through the interrupt
vector, which contains the addresses of all the service routines.
Interrupt architecture must save the address of the interrupted instruction.
Incoming interrupts are disabled while another interrupt is being processed to prevent a
lost interrupt.
A trap is a software-generated interrupt caused either by an error or a user request.
An operating system is interrupt driven.
After the interrupt is serviced, the saved return address is loaded into the program
counter, and the interrupted computation resumes as though the interrupt is not occurred.
2. Storage Structure:
Main Memory:
Computer programs must be in main memory (also called random-access memory orRAM)
to be executed. Main memory is the only large storage area (millions to billions of bytes) that
the processor can access directly. It commonly is implemented in a semiconductor technology
called Dynamic Random Access Memory (DRAM). Other memory devices are
Page 3
OPERATING SYSTEMS MODULE 1
ROM, EEPROM etc. Load and store instructions are used to read and write data/instructions
between memory & processor.
Secondary storage
Extension of main memory that provides large nonvolatile storage capacity.
• Magnetic disks
Rigid metal or glass platters covered with magnetic recording material
Disk surface is logically divided into tracks, which are subdivided into sectors.
The disk controller determines the logical interaction between the device and the
computer.
Other storages include cache, CD-ROM, magnetic tapes and so on. The main differences among
the storage systems lie in speed, cost, size and volatility. The storage system can be organized in
a hierarchy according to speed and cost. Higher levels are expensive but they are fast. Down in the
hierarchy cost decreases and the access time increases.
Explain storage device hierarchy, with neat diagram.
Page 4
OPERATING SYSTEMS MODULE 1
The wide variety of storage systems in a computer system can be organized in a hierarchy as shown
above, is according to speed and cost. The higher levels are expensive, but they are fast. As we
move down the hierarchy, the cost per bit generally decreases, whereas the access time generally
increases.
CACHING
• Information in use copied from slower to faster storage device temporarily
• Faster storage (cache) checked first to determine if information is there in main memory
– If it is, information used directly from the cache (fast)
– If not, data copied to cache and used there.
I/O STRUCTURE
n Device controller transfers blocks of data from buffer storage directly to main memory without CPU
intervention
n Only one interrupt is generated per block, rather than the one interrupt per byte
Page 5
OPERATING SYSTEMS MODULE 1
COMPUTER-SYSTEM ARCHITECTURE
A computer system may be organized in a number of different ways, which we can categorize
roughly according to the number of general-purpose processors used.
Single processor systems
Multiprocessor system
Clustered system
SINGLE-PROCESSOR SYSTEM
One main CPU capable of executing a general-purpose instruction set, including
instructions from user processes.
All systems have special purpose processors. i.e device specific processors such as disk,
keyboard, and graphics controller
Mainframes- general purpose processors such as I/O processors
Run limited set of instruction does not run user processes.
Use of special purpose processor does not turn a single processor system into
multiprocessor system
MULTI-PROCESSOR SYSTEMS
Also known as parallel systems or tightly coupled systems
Two or more processors in close communication sharing the computer bus and
sometimes the clock, memory and peripheral devices
***List the three main advantages of multi-processor systems
Advantages
1. Increased throughput: By increasing the number of processors, we expect to get more work
done in less time
2. Economy of scale: Multiprocessor systems can cost less than equivalent multiple single-
processor systems.
3. Increased reliability: If functions can be distributed properly among several processors, then
the failure of one processor will not halt the system, only slow it down.
Page 6
OPERATING SYSTEMS MODULE 1
Page 7
OPERATING SYSTEMS MODULE 1
CLUSTERED SYSTEMS
****Explain the types of clustered system
Clustered system gather together multiple CPUs to accomplish computational work
Clustered systems are composed of two or more individual systems or nodes joined
together.
Clustered system share storage and are closely linked via local area network.
Clustering provide high availability.
Types of clustering systems
i. Asymmetric clustering
ii. Symmetric clustering
Asymmetric clustering
One machine is in hot-standby mode while other is running the applications.
The hot standby host machine does nothing but monitor the active server.
If server fails, the hot standby host machine becomes the active server.
Symmetric clustering
Two or more hosts are running applications and are monitoring each other.
This mode of system is more efficient, as it uses all of the available hardware.
Page 8
OPERATING SYSTEMS MODULE 1
OPERATING-SYSTEM STRUCTURE
The various types of general purpose OS is
1. Batch Systems
1. Multiprogramming
2. Time sharing or Multitasking
Define the essential features of Batch operating system (Batch file system)
BATCH SYSTEM
The user of batch OS do not interact with the computer directly.
Each user prepares his job on an off-line device like punch cards and submits it to the
computer operator
At some later time (after minutes, hours or days) the output is generated.
To speed up processing, jobs with similar needs are batched together and run as a group
As several jobs are given to computer system and unless it completes the first job it is not
possible to process the next job. Therefore it is an in-efficient OS. Also the CPU is often
idle because the speed of the mechanical I/O devices.
Define the essential features of Multiprogramming operating system
MULTIPROGRAMMING
Multiprogramming increases CPU utilization by organizing jobs (code and data) so that the CPU
always has one to execute.
OS keeps several jobs in memory simultaneously.
One job selected and run via job scheduling
In a multi-programmed system, the operating system simply switches to, and executes,
another job. When that job needs to wait, the CPU is switched to another job, and so on.
As long as at least one job needs to execute, the CPU is never idle.
Multiprogramming provides an environment in which various system resources are
utilized effectively but they do not provide user interaction with the computer system.
Page 9
OPERATING SYSTEMS MODULE 1
Page 10
OPERATING SYSTEMS MODULE 1
Page 11
OPERATING SYSTEMS MODULE 1
A mode bit is added to the computer hardware to indicate the current mode; ie: mode bit = 0 for
kernel mode and 1 for user mode.
Working Principle:
At system Boot time, the hardware starts in kernel mode
The OS is then loaded and starts user application in user mode
Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel
mode
Page 12
OPERATING SYSTEMS MODULE 1
The system always switches to user mode (setting mode bit = 1), before passing control
to user program
Dual mode operation protects OS from errant users and errant user from one another
Privileged instruction is executed only in kernel mode
If an attempt is made to execute privileged instruction in user mode, the hardware treats it
as illegal and traps it to the OS
A system calls are called by user program to ask the OS to perform the tasks on behalf of
the user program.
TIMER
PROCESS MANAGEMENT
A process is a program in execution. It is a unit of work within the system. Program is a passive
entity, process is an active entity. Process needs resources to accomplish its task like CPU, memory,
I/O, files. Process termination requires reclaim of any reusable resources. Single- threaded process
has one program counter specifying location of next instruction to execute. Process executes
instructions sequentially, one at a time, until completion. Multi-threaded process has one program
counter per thread. Typically system has many processes, some user, some operating system
running concurrently on one or more CPUs. All processes can execute concurrently by
multiplexing the single CPUs.
*****What are the operating System activities connected with Process management
1. Creating and deleting both user and system processes
2. Suspending and resuming processes
3. Providing mechanisms for process synchronization
4. Providing mechanisms for process communication
5. Providing mechanisms for deadlock handling
Page 13
OPERATING SYSTEMS MODULE 1
MEMORY MANAGEMENT
*****What are the operating System activities connected with Memory management
Memory management activities
1. Keeping track of which parts of memory are currently being used and by whom
2. Deciding which processes (or parts thereof) and data to move into and out of memory
3. Allocating and de-allocating memory space as needed
STORAGE MANAGEMENT
1. Storage management
2. Mass-Storage management
3. Caching
FILE MANAGEMENT
*****What are the operating System activities connected with File management
OS activities include
1. Creating and deleting files and directories
2. Supporting Primitives to manipulate files and directories
Page 14
OPERATING SYSTEMS MODULE 1
*****What are the operating System activities connected with Mass storage management
OS activities
1. Free-space management
2. Storage allocation
3. Disk scheduling
CACHING
Page 15
OPERATING SYSTEMS MODULE 1
Page 16
OPERATING SYSTEMS MODULE 1
DISTRIBUTED SYSTEM
**List the essential properties of Distributed OS
Page 17
OPERATING SYSTEMS MODULE 1
Page 18
OPERATING SYSTEMS MODULE 1
Page 19
OPERATING SYSTEMS MODULE 1
OPERATING-SYSTEM SERVICES
An operating system provides an environment for the execution of programs. It provides certain
services to programs and to the users of those programs.
*********List and explain the services provided by OS for the user and efficient operation
of system.
Services provided by the OS that are helpful to the user:
1. User Interface: Almost all operating systems have a user interface (UI), such as
Command-Line (CLI) uses text commands, Graphics User Interface (GUI) is window
system, Batch Interface uses commands and directives.
2. Program execution: The system must be able to load a program into memory and to run
that program, end execution, either normally or abnormally (indicating error)
3. I/O operations: A running program may require I/O, which may involve a file or an I/O
device.
4. File-system manipulation: The file system is of particular interest. Obviously, programs
need to read and write files and directories, create and delete them, search them, list file
Information, permission management.
5. Communications: Processes may exchange information, on the same computer or
between computers over a network. Communications may be via shared memory or
through message passing (packets moved by the OS)
6. Error detection – OS needs to be constantly aware of possible errors. Errors may occur in
CPU and memory, in I/O devices and in user program.
Services provided by the OS that are helpful to the efficient operation of system.
1. Resource allocation - When multiple users or multiple jobs running concurrently,
resources must be allocated to each of them
Page 20
OPERATING SYSTEMS MODULE 1
2. Accounting - To keep track of which users use how much and what kinds of computer
resources
3. Protection and security – When several separate processes execute concurrently, it should
not be possible for one process to interfere with the others or with the OS itself. Protection
involves ensuring that all access to system resources is controlled. Securityof the system
from outsiders requires user authentication, extends to defending external I/O devices from
invalid access attempts
COMMAND-LINE INTERFACE OR COMMAND INTERPRETER
CLI allows direct command entry
Sometimes implemented in kernel, sometimes by systems program
Sometimes multiple flavors implemented – shells
Primarily fetches a command from user and executes it
Sometimes commands built-in, sometimes just names of programs
GRAPHICAL USER INTERFACE
• User-friendly desktop metaphor interface
– Usually mouse, keyboard, and monitor
– Icons represent files, programs, actions, etc
– Various mouse buttons over objects in the interface cause various actions (provide
information, options, execute function, open directory (known as a folder)
• Many systems now include both CLI and GUI interfaces
– Microsoft Windows is GUI with CLI ―command‖ shell
– Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)
Page 21
OPERATING SYSTEMS MODULE 1
SYSTEM CALLS
Page 22
OPERATING SYSTEMS MODULE 1
Page 23
OPERATING SYSTEMS MODULE 1
Write the system call sequence to copy a file from source to destination
Page 25
OPERATING SYSTEMS MODULE 1
SYSTEM PROGRAM
***What are the different categories of system program
Six categories of system program are:
1. File management: These programs manipulate files. Create, delete, copy, rename, print,
dump, list etc
2. Status information: Some programs ask the system for Date(time), amount of memory,
number of users etc.
3. File modification: text editors can be used to create and modify the content of files stored
on the disk.
4. Programming Language support: Compilers, assemblers and interpreters for common
programming languages are provided to the user
5. Program loading and Execution: the system may provide absolute loader, re-locatable
loaders, linkage editors, overlay loaders, Debugger etc.
6. Communications: These programs are used for creating virtual connections between
processes, users and computer systems. They allow user to browse web pages, send email
or log-in remotely
OPERATING SYSTEM DESIGN AND IMPLEMENTATION
Affected by choice of hardware, type of system-batch system, time shared system
User goals and System goals
User goals – operating system should be convenient to use, easy to learn, reliable, safe, and fast
System goals – operating system should be easy to design, implement, and maintain, as well as
flexible, reliable, error-free, and efficient. The wide variety of systems in existence shows
different requirements can result in variety of solutions for different environments.
Specifying and designing an OS is a highly creative task.
Software engineering provide general principles.
MECHANISM AND POILCIES
One important principle is the separation of policy and mechanism.
Policy: What will be done?
Mechanism: How to do it?
Page 26
OPERATING SYSTEMS MODULE 1
IMPLEMENTATION
Once an OS is designed it must be implemented. Traditionally OS is implemented in assembly
language and now it is written in c or c++ .
Example: MS-DOS written in intel 8088 assembly language. Linux OS written in C is available
to number of CPUs
Page 27
OPERATING SYSTEMS MODULE 1
Page 28
OPERATING SYSTEMS MODULE 1
Page 29
OPERATING SYSTEMS MODULE 1
LAYERED APPROACH
Explain the advantages of layered approach OS with neat diagram
Page 30
OPERATING SYSTEMS MODULE 1
Disadvantages:
1) Less efficient than other types.
MICRO-KERNEL APPROACH
Explain the advantages of Micro-kernel approach OS with neat diagram
Main function:
To provide a communication facility between
client program and
various services running in user-space.
Advantages:
1) Ease of extending the OS. (New services are added to user space w/o modification of
kernel).
2) Easier to port from one hardware design to another.
3) Provides more security & reliability.(If a service fails, rest of the OS remains
untouched.).
4) Provides minimal process and memory management.
Page 31
OPERATING SYSTEMS MODULE 1
Disadvantage:
1. Performance decreases due to increased system function overhead
2. Performance overhead of user space to kernel space communication.
Page 32
OPERATING SYSTEMS MODULE 1
→ BSD kernel.
Mach provides
→ memory management;
→ support for RPCs & IPC and
→ thread scheduling.
BSD component provides
→ BSD command line interface
→ support for networking and file systems and
→ implementation of POSIX APIs
The kernel environment provides an I/O kit for development of
→ device drivers and
→ dynamic loadable modules (which Mac OS X refers to as kernel extensions).
Page 33
OPERATING SYSTEMS MODULE 1
VIRTUAL MACHINES
******What are Virtual Machines? With neat diagram explain the concept of virtualization
and its advantages.
A virtual machine (VM) is a software program or operating system that not only exhibits the
behavior of a, separate computer hardware, but is also capable of performing tasks such as running
applications and programs like a separate computer.
• The fundamental idea behind the virtual machine is to abstract the hardware of a single
computer (CPU, memory, disk drives, network interface cards) into several execution
environments thereby creating an illusion that each separate execution environment is
running its own private computer.
• The operating system creates the illusion of multiple processes, each executing on its own
processor with its own (virtual) memory.
• Major difficulty is disk systems.
Page 34
OPERATING SYSTEMS MODULE 1
Problem:
Virtual-machine software itself will need substantial disk space to provide
virtual memory.
Solution: provide virtual disks that are identical in all respects except size.
Advantages:
1) Complete protection of the various system resources.
2) It is a perfect vehicle for OS‟s R&D.
Disadvantage:
1. Difficult to implement due to effort required to provide an exact duplicate to
underlying machine.
Page 35
OPERATING SYSTEMS MODULE 1
Network of virtual machines each of which can send information over the virtual
communication network
Virtual machine is a perfect vehicle of research and development
The current operating system must be stopped and taken out of use while changes are
made and tested. This period is called as system development time.
Multiple operating systems can be running in developers workstation concurrently
Data center use is system consolidation (run two or more separate system and run in
virtual machine of one system)
VMWARE
*****Explain VM-WARE architecture of virtual machine with neat diagram
Key Idea: This virtualization tool run in user mode as an application on top of the operating system
such as Windows or Linux and allows this host system to concurrently execute several different
guest operating systems as independent virtual machines.
• VM-WARE abstracts intel 8086 and compatible hardware into isolated virtual machines
• Linux OS is running as the host OS: FreeBSD, Windows NT and Windows XP are running
as guest OS
Page 36
OPERATING SYSTEMS MODULE 1
• The virtualization layer is the heart of VM-WARE, as it abstracts the physical hardware
into isolated virtual machines running as guest operating systems.
• Each virtual machine has its own virtual CPU, memory, disk drives, network interface
and so forth.
• An application could be tested concurrently in one physical computer with different OS
using VMware.
• Programmer could test the application on a host operating system and on three guest
operating systems with each system running as a separate virtual machine by using
VMware
JAVA VIRTUAL MACHINE
Explain VM-WARE architecture of virtual machine with neat diagram
Page 37
OPERATING SYSTEMS MODULE 1
Page 38