Module 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 41

22MCA12

FACULTY: Dr.GNANESWARI.G
Operating System Concepts

MODULE 1
DEFINITION
■ An operating system is a system software that provides an
interface between the hardware and the user.
– The functions of an OS are process management, memory
management, file management, I/O management and security, etc.
– To efficiently use the resources such as memory, processor and I/O
devices.
– Being user friendly.
Computer System Architecture

Booting
ROM / RAM
Secondary Storage
Volatile/Non Volatile memory
Multiprogramming
Time Sharing
Multi Processing
Physical memory
Logical memory
Computer System Architecture
Booting: When a computer system is started, the hardware components
are initialized.
The process of loading the operating system from the secondary storage
into main memory/RAM is known as booting.
ROM / RAM: Random Access memory is volatile, it temporarily stores the
files that is running.
Read only memory is a non volatile memory that stores programs
permanently.
ROM and RAM are known as the primary memory.
Secondary Storage: A computer memory that is non volatile and cannot be
accessed immediately by the processor. Eg. Hard Disk
Volatile/Non Volatile memory: Temporary memory and permanent
memory.
Computer System Architecture
Multiprogramming: Multiprogramming is the rapid switching of CPU
between multiple processes in memory.
Time Sharing: The resources could be shared between different jobs, with
each job being allocated a portion of time to use a resource.
Multiprocessing: It is the ability of a system to run multiple processors at
one time.
Physical memory: This refers to the main memory.
Logical memory: The address is generated by the CPU. Eg. Paging
Types of Operating System

Operating systems have gone through a long history of evolution:

1. Batch processing systems


2. Multiprogramming systems
3. Time-sharing systems
4. Parallel systems
5. Distributed systems
6. Real-time systems
Batch processing system
A batch is a sequence of user jobs.
Each job is independent of other and belongs to different users and is
FCFS.
It is best for programs with no interaction.
Batch processing system
Advantages:
Scheduling is simple.
Device management is not difficult.
File management is easy.
Very fast; bcoz interaction is only at the start and end.
Disadvantages:
Turnaround time is large.
Errors or infinite loops cause delay.
Output of each job is given only at the end of the batch.
Buffering

Buffering : A buffer is a memory area that stores data while they are
transferred between an application and a device
When the entire buffer of data has arrived, the buffer can be written to
disk in a single operation
Eg: Playing videos in youtube
Spooling
Spooling: A spool is a buffer that holds output for a device. Eg:
Printers
Each application’s output is spooled to a separate file.
System maintains the spool file in a queue.
Eg: Printing, view the job pool, cancel printing …
Multiprogramming system

Multiprogramming is the rapid switching of CPU between multiple


processes in memory.
If a job has some interaction then it switches to the next job. Thus CPU
has at least one job to execute all the time.
It appears to the user that all the programs are executed at the same
time.
OS keeps several jobs in the memory (subset of job pool).
Multiprogramming system

Advantages:
Multiple jobs run concurrently.
Efficient resource utilization.
Increases job throughput rate (no. of jobs completed in a given time).
Disadvantages:
Interaction is not possible once execution begins.
Modifying the program during the execution is not possible.
Time sharing system
◦ They are very similar to Multiprogramming systems except for, here
the resources could be shared between different jobs, with each job
being allocated a portion of time to use a resource (resource sharing).
◦ Time sharing is hidden from the user—each user has the impression
that the whole system is serving them exclusively.
◦ It uses scheduling and multiprogramming.
Time sharing system
Advantages:
◦ Many users can share the computer simultaneously.
◦ Interaction is possible.

Disadvantages:
◦ It is more complex than multiprogramming systems
◦ Inter-process communication is difficult
◦ Memory management is difficult
Parallel Systems
(Multiprocessor systems)

◦ Parallel computing is the simultaneous use of multiple processors to solve a single


program.
◦ A program is broken into discrete parts that can be solved concurrently. Each part is
further broken into series of instructions and are executed simultaneously.
◦ The systems having more than one processor shares the other resources such as
clock, bus and peripheral devices. They are known as tightly coupled systems.
◦ If multiple CPU’s has associated memory with it then they are known as Distributed
systems.

Thread is a basic unit of CPU Utilization


Types of Multiprocessor systems

•All the processors are equal


•Master-Slave relationship
•Some processors can be idle whereas
•Master processor handles I/o routines &
others are overloaded
OS kernel
•Others are called attached processors
Parallel systems

Advantages:
◦ They are cheap bcoz they share the peripherals.
◦ More reliable
◦ Increased job throughput

Disadvantages:
◦ Implementation is complex
◦ Resource management and security is essential
Distributed systems
◦ Networking and internetworking have created a new
dimension in operating systems.

◦ A job that was previously done on one computer can now be


shared between computers that may be thousands of miles
apart.

◦ Distributed systems combine features of the previous


generation with new duties such as controlling security.
Distributed systems
Advantages:
• Computation speeds up; one process can be run in different systems
• Sharing of files is possible
• More reliable; even if one site fails

Disadvantages:
• Implementation is complex
• Memory and Resource management is essential
Real-time Systems
◦ A real-time system is expected to do a task within a specific time
constraint.
◦ They are used with real-time applications, which monitor, respond to
or control external processes or environments.
◦ Systems are used to control machinery , industrial and scientific
instruments.
◦ If processing does not happen in a fixed time, the system will fail.
◦ It should operate for the same amount of time everytime.
◦ Eg: Food factory
◦ Guided missile and medical monitoring
Real-time Systems
◦ Hard real time systems: Guarantee that critical task will complete on time
◦ Soft real time systems: Less timing constraints

Advantages:

◦ Multitasking is done by scheduling processors


◦ Memory management is less demanding.
◦ File management is faster

Disadvantages:
◦ Implementation is very costly.
◦ Time limit are challenging
Functions of an OS

Process Management - assigning the processor to do different


tasks.
Memory Management - allocation of main memory/ RAM
Input and Output Management - assignment of different output
and input.
File System Management - Operating system is also responsible
for maintenance of a file system, in which the users are allowed to
create, delete and move files.(DISK)
OPERATING SYSTEM STRUCTURE

1. Simple Structure:

Shell: It acts as a command interpreter, a


program that acts as an interface b/w kernel
and the user.
Kernel: It is the core of the OS, It controls
the resources.
OPERATING SYSTEM STRUCTURE
2. Layered Structure:
In the layered approach, the OS is divided
into a number of layers (levels), each built
on top of lower layers.
The bottom layer (layer 0), is the hardware;
the highest (layer N) is the user interface.
Each layer uses functions (operations) and
services of only lower-level layers.
OPERATING SYSTEM STRUCTURE
3. Microkernels:

It is an OS kernel designed to provide the basic


services of the operating system.
Only system level and user level programs have
been implemented with microkernels.
Microkernels provide minimal process and
memory management.
Communication takes place between user
modules using message passing.
OPERATING SYSTEM OPERATIONS
1. Dual Mode and Multimode Operation:
For proper execution of the operating system the OS code and
the user code needs to be distinguished.
OPERATING SYSTEM OPERATIONS
2. Timer Mode
Programs may get stuck in an infinite loop.
We use a timer to set an interrupt.
A counter is initialized and is decremented, when the counter is
less than zero the interrupt occurs.
While(c<10)
{
……
C++
}
SERVICES OF OS
USER POINT OF VIEW SYSTEM POINT OF VIEW
USER INTERFACE: CUI and GUI RESOURCE MANAGEMENT: Scheduling
algorithms, manage memory, I/O
PROGRAM EXECUTION: Load the program into the PROTECTION AND SECURITY: access, security
memory and execute
I/O OPERATION: support I/O operations ACCOUNTING: calculate CPU utilization
FILE SYSTEM MANIPULATION: create, delete,
search, access …
ERROR DETECTION: memory overflow errors,
printer out of paper, divisionbyzero error…
COMMUNICATION: IPC Interprocess
communication through shared memory and
message passing
SERVICES OF OS
System Calls
• A system call is a request made by any program to the operating system for
performing tasks.
• It provides an interface between a process and the operating system.
• A number(ID) is associated with each system call.
• System call interface maintains a table indexed with these numbers.
• API hides most of the details of how OS handles System Calls.
System Calls
Consider a process of writing a simple program to read data from
one file and copy them to another file
Passing Parameters

In Registers
In block of Memory
In Stack
Types of System calls
Process Control.  Device Management.
end, abort  request device, release
load, execute device
create process, terminate  Information
process Maintenance.
allocate and free memory  get time or date, set time
or date
File management.  get process, file, or device
create file, delete file attributes
open, close  Communication.
read, write, …  send, receive messages
SYSTEM PROGRAMS
File Management: These programs create, delete,
copy, rename, print and generally manipulate files
and directories.
Status Information: These programs ask the system
for the date, time, amt of memory available, no. of
users or status information.
File Modification: Several text editors are available to
create and edit the content of files stored on the disk.
SYSTEM PROGRAMS
Programming language support: Compilers,
assemblers, debugger and interpreters for
programming languages are provided to the user with
the OS.
Program Loading and Execution: After compiling or
assembling the program, it has to be loaded for
execution(LOADER).
Communication: These programs provide the
mechanism for creating virtual connections to
transfer files from one machine to another.
.
• All systems programs can be classified as System Programs and
Application Programs
• Programs that are used in solving common problems or performing
operations for the user are known as application program.
Virtual Machines
The fundamental idea behind a virtual machine is to abstract the
hardware of a single computer into several environments.
Thus creating an illusion that each separate execution
environment is running its own private computer by using CPU
scheduling and virtual memory techniques.
Each process is provided with a virtual copy of the underlying
computer.
Eg: VM Virtual Box, VMware
Virtual Machines
Advantages:
Consolidation: Multiple OS can run in isolation in the same server eliminating the
need to dedicate 1 machine for 1 application.
Sharing: Hardware can be shared.
Network: A network of virtual machines can send information across each other.
Development Flexibility: A virtual machine can host different OS in the same system,
allowing the user to test his program in various versions.
Security: Crashing in one virtual machine will not bring down the whole system.
Virtual Machines

You might also like