[go: up one dir, main page]

0% found this document useful (0 votes)
200 views83 pages

PG TRB OS CLASS1 Notes Send

The document provides an overview of operating systems, covering their definitions, functionalities, types, and components. It discusses system software, including compilers, assemblers, and interpreters, and explains the process lifecycle and states. Additionally, it outlines various operating system strategies such as batch, multitasking, multiprogramming, distributed, network, and real-time operating systems.

Uploaded by

chitrapreetha.sp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
200 views83 pages

PG TRB OS CLASS1 Notes Send

The document provides an overview of operating systems, covering their definitions, functionalities, types, and components. It discusses system software, including compilers, assemblers, and interpreters, and explains the process lifecycle and states. Additionally, it outlines various operating system strategies such as batch, multitasking, multiprogramming, distributed, network, and real-time operating systems.

Uploaded by

chitrapreetha.sp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

WELCOME

TO
PROFESSOR ACADEMY

TRB-COMPUTER INSTRUCTOR GRADE-1

Today Topic: Operating System


MOTIVATION
Operating Systems- Syllabus
• Introduction: System software, OS Strategies;
Multiprogramming, batch.
• Operating system Organization: basic OS
function, Kernels, device drivers.
• Device Management: buffering.
• Process Management: resource abstraction,
process hierarchy
• Scheduling: Strategy selection.
Operating Systems- Syllabus
• Synchronization Principles: deadlock,
semaphores, multiprocessors.
• Deadlock: hold and wait, Bankers algorithm,
consumable resources.
• Memory Management: Memory allocation
strategies, variable partition.
• Protection and Security: Internal access
authorization
TOPIC : SYSTEM SOFTWARE
System Software
There are two main types of software:
1. Systems software
2. Application software
Systems software:
• It includes the programs that are dedicated to managing the computer
itself.
• System software is software that provides platform to other
software's.
• System Software is a set of programs that control and manage the
operations of computer hardware. It also helps application programs
to execute correctly.
System Software-Examples
• Some examples can be operating systems, Assembler,
Compiler, Interpreter, etc. These are commonly
prepared by the computer manufacturers.
• These software's consists of programs written in low-
level languages, used to interact with the hardware at a
very basic level.
• System software serves as the interface between the
hardware and the end users.
Compiler
• The language processor that reads the complete source
program written in high level language as a whole in one go
and translates it into an equivalent program in machine
language is called as a Compiler.
Example: C, C++, C#, Java
• In a compiler, the source code is translated to object code
successfully if it is free of errors.
• The compiler specifies the errors at the end of compilation
with line numbers when there are any errors in the source
code.
• The errors must be removed before the compiler can
successfully recompile the source code again
Compiler
Assembler
• The Assembler is used to translate the program
written in Assembly language into machine code.
• The source program is a input of assembler that
contains assembly language instructions.
• The output generated by assembler is the object
code or machine code understandable by the
computer
Assembler
Interpreter
• The translation of single statement of source program into
machine code is done by language processor and executes it
immediately before moving on to the next line is called an
interpreter.
• If there is an error in the statement, the interpreter terminates
its translating process at that statement and displays an error
message.
• The interpreter moves on to the next line for execution only
after removal of the error.
• An Interpreter directly executes instructions written in a
programming or scripting language without previously
converting them to an object code or machine code.
Example: Perl, Python and Matlab.
What is an Operating System?
• A program that acts as an intermediary between a user
of a computer and the computer hardware
• A more common definition is that the operating system
is the one program running at all times on the
computer (usually called the kernel), with all else being
application programs.
• An operating system is concerned with the allocation
of resources and services, such as memory, processors,
devices, and information
History Of OS
• The General Motors Research Lab implemented the first
OS in the early 1950s for their IBM 701
• In the mid-1960s, operating systems started to use disks
• In the late 1960s, the first version of the Unix OS was
developed
• The first OS built by Microsoft was DOS. It was built in
1981 by purchasing the 86-DOS software from a Seattle
company
• The present-day popular OS Windows first came to
existence in 1985 when a GUI was created and paired
with MS-DOS.
Functionality of Operating system .
Following are some of important functions of an operating
System.
• Memory Management
• Processor Management
• Device Management
• File Management
• SecurityJob accounting
• Error detecting aids
• Coordination between other software and users
Memory Management
• Memory management refers to management of Primary Memory or
Main Memory.
• Main memory is a large array of words or bytes where each word or
byte has its own address.
• Main memory provides a fast storage that can be accessed directly by
the CPU. For a program to be executed, it must in the main memory.
An Operating System does the following activities for memory
management:
• Keeps tracks of primary memory, i.e., what part of it are in use by
whom, what part are not in use.
• In multiprogramming, the OS decides which process will get memory
when and how much.
Processor Management
• In multiprogramming environment, the OS decides
which process gets the processor when and for how
much time. This function is called process scheduling.
An Operating System does the following activities for
processor management −
• Keeps tracks of processor and status of process. The
program responsible for this task is known as traffic
controller.
• Allocation and De-allocation of the processor (CPU) to a
process.
File Management
• A file system is normally organized into
directories for easy navigation and usage. These
directories may contain files and other directions.
• An Operating System does the following activities
for file management:
• Keeps track of information, location, uses, status
etc. The collective facilities are often known
as file system.
Other Important Activities
Some of the important activities that an Operating System
performs −
• Security − By means of password and similar other
techniques, it prevents unauthorized access to programs and
data.
• Job accounting − Keeping track of time and resources used by
various jobs and users.
• Error detecting aids − Production of dumps, traces, error
messages, and other debugging and error detecting aids.
• Coordination between other software's and users −
Coordination and assignment of compilers, interpreters,
assemblers and other software to the various users of the
computer systems.
TOPIC : Types of Operating System(OS
Strategies)
Types of Operating System(OS Strategies)
Following are the popular types of Operating System:
• Batch Operating System
• Multitasking/Time Sharing OS
• Multiprogramming OS
• Distributed OS
• Network OS
• Real Time OS
1. Batch Operating System
• The users of a batch operating system 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.
• To speed up processing, jobs with similar needs are
batched together and run as a group.
• The programmers leave their programs with the
operator and the operator then sorts the programs
with similar requirements into batches.
Batch Operating System
Problems with Batch Systems
The problems with Batch Systems are as follows −
• Lack of interaction between the user and the job.
• The computer operators should be well known with
batch systems
• Batch systems are hard to debug
• CPU is often idle, because the speed of the mechanical
I/O devices is slower than the CPU.
• Difficult to provide the desired priority
Time-sharing(Multi tasking) operating systems
• Time-sharing or multitasking is a logical extension of
multiprogramming. Processor's time which is shared among
multiple users simultaneously is termed as time-sharing.
• Each task is given some time to execute so that all the tasks
work smoothly.
• These systems are also known as Multitasking Systems. The
task can be from a single user or different users also.
• The time that each task gets to execute is called quantum.
After this time interval is over OS switches over to the next
task.
Time-sharing operating systems
Advantages and Disadvantages
Advantages of Timesharing operating systems are as follows
• Provides the advantage of quick response.
• Avoids duplication of software.
• Reduces CPU idle time.
Disadvantages of Time-sharing operating systems are as
follows
• Problem of reliability.
• Question of security and integrity of user programs and data.
• Problem of data communication.
Multiprogramming OS
• One of the most important aspects of an Operating System is
to multi program.
• In a computer system, there are multiple processes waiting to
be executed, i.e. they are waiting when the CPU will be
allocated to them and they begin their execution
• These processes are also known as jobs. Now the main
memory is too small to accommodate all of these processes
or jobs into it. Thus, these processes are initially kept in an
area called job pool.
• CPU selects one job out of all these waiting jobs, brings it
from the job pool to main memory and starts executing it.
Note
• Multiprogramming – A computer running
more than one program at a time (like running
Excel and Firefox simultaneously).
• Multiprocessing – A computer using more
than one CPU at a time.
• Multitasking – Tasks sharing a common
resource (like 1 CPU)
Distributed Operating System
• Various autonomous interconnected computers communicate
with each other using a shared communication network.
• Independent systems possess their own memory unit and
CPU. These are referred to as loosely coupled systems or
distributed systems.
• The major benefit of working with these types of the
operating system is that it is always possible that one user can
access the files or software which are not actually present on
his system but some other system connected within this
network i.e., remote access is enabled within the devices
connected in that network.
Network Operating System
• These systems run on a server and provide the capability to
manage data, users, groups, security, applications, and
other networking functions.
• These types of operating systems allow shared access of
files, printers, security, applications, and other networking
functions over a small private network.
• One more important aspect of Network Operating Systems
is that all the users are well aware of the underlying
configuration, of all other users within the network, their
individual connections, etc. and that’s why these computers
are popularly known as tightly coupled systems
Real-Time Operating System
These types of OSs serve real-time systems. The time
interval required to process and respond to inputs is very
small. This time interval is called response time.
• Real-time systems are used when there are time
requirements that are very strict like missile systems, air
traffic control systems, robots, etc.
• Two types of Real-Time Operating System which are as
follows:
1. Hard Real-Time Systems 2. Soft Real-Time Systems:
Real-Time Operating System
• Hard Real-Time Systems:
These OSs are meant for applications where time
constraints are very strict and even the shortest possible
delay is not acceptable. These systems are built for saving
life like automatic parachutes or airbags which are required
to be readily available in case of any accident. Virtual
memory is rarely found in these system
• Soft Real-Time Systems:
These OSs are for applications where for time-constraint is
less stric
MCQ QUESTION
which of the following is not true about an
interpreter?
a) Interpreter is a kind of translator
b) Interpreter generates an object program from
the source program
c) Interpreter analyses each source statement
every time it is to be executed
d) All of the above
Answer: b
MCQ QUESTION
A programmer, by mistakes writes a program to
multiply two numbers instead of dividing them,
how can this error be detected
a) Compiler
b) Interpreter
c) Compiler or interpreter
d) None of the above
Answer: d
MCQ QUESTION
In a multi-programming environment :
a) the processor executes more than one process
at a time
b) the programs are developed by more than one
person
c) more than one process resides in the memory
d) a single user can execute many programs at the
same time
Answer: c
MCQ QUESTION
In which of the following OS, the response time
is very crucial?
a) Network operating system
b) Real time operating system
c) Batch operating system
d) Unix operating system
Answer: C
MCQ QUESTION
In a time-sharing operating system, when the time
slot given to a process is completed, the process
goes from the running state to the :
a) Blocked state
b) Ready state
c) Suspended state
d) Terminated state
Answer: b
TOPIC : PROCESS
What is Process?
• A process is basically a program in execution. The
execution of a process must progress in a sequential
fashion.
• A process is defined as an entity which represents the
basic unit of work to be implemented in the system.
• To put it in simple terms, we write our computer
programs in a text file and when we execute this
program, it becomes a process which performs all the
tasks mentioned in the program.
• When a program is loaded into the memory and it becomes a
process, it can be divided into four sections ─ stack, heap, text
and data. The following image shows a simplified layout of a
process inside main memory
Process Component & Description
Stack
The process Stack contains the temporary data such as
method/function parameters, return address and local variables.
Heap
This is dynamically allocated memory to a process during its run
time.
Text
This includes the current activity represented by the value of
Program Counter and the contents of the processor's registers.
Data
This section contains the global and static variables.
What is Program?
• A program is a piece of code which may be a single line
or millions of lines.
• A computer program is usually written by a computer
programmer in a programming language. For example,
here is a simple program written in C programming
language
include <stdio.h>
int main() {printf("Hello, World! \n");return 0;}
• A computer program is a collection of instructions that
performs a specific task when executed by a computer.
Program Vs Process
• When we compare a program with a process,
we can conclude that a process is a dynamic
instance of a computer program.
• A part of a computer program that performs a
well-defined task is known as an algorithm.
• A collection of computer programs, libraries
and related data are referred to as a software.
Process states or Process Life Cycle
• When a process executes, it passes through different states.
These stages may differ in different operating systems, and
the names of these states are also not standardized.
• In general, a process can have one of the following five
states at a time.
• 1. New State
• 2.Ready State
• 3.Running State
• 4.Wait State
• 5. Terminate or exit state
Process state
Process state
1. New State
A process is said to be in new state when a program present
in the secondary memory is initiated for execution
2. Ready State-
A process moves from new state to ready state after it is
loaded into the main memory and is ready for execution.
In ready state, the process waits for its execution by the
processor.
In multiprogramming environment, many processes may be
present in the ready state.
Process state
3. Run State-
A process moves from ready state to run state after it is
assigned the CPU for execution.
4. Block Or Wait State-
A process moves from run state to block or wait state if it
requires an I/O operation or some blocked resource during
its execution.
After the I/O operation gets completed or resource
becomes available, the process moves to the ready state.
Process state
5. Terminate State-
A process moves from run state to terminate
state after its execution is completed.
After entering the terminate state, context (PCB)
of the process is deleted by the operating
system.
Process Control Block (PCB)
• A Process Control Block is a data structure
maintained by the Operating System for every
process.
• The PCB is identified by an integer process ID
(PID).
• A PCB keeps all the information needed to keep
track of a process as listed below in the table
Process Control Block (PCB)
Process State
• The current state of the process i.e., whether it is ready,
running, waiting, or whatever.
Process privileges
• This is required to allow/disallow access to system resources.
Process ID
• Unique identification for each of the process in the operating
system.
Pointer
• A pointer to parent process.
Process Control Block (PCB)
Program Counter
• Program Counter is a pointer to the address of the next
instruction to be executed for this process.
CPU registers
• Various CPU registers where process need to be stored for
execution for running state.
CPU Scheduling Information
• Process priority and other scheduling information which is
required to schedule the process.
Process Control Block (PCB)
Memory management information
• This includes the information of page table, memory limits,
Segment table depending on memory used by the operating
system.
Accounting information
• This includes the amount of CPU used for process execution,
time limits, execution ID etc.
IO status information
• This includes a list of I/O devices allocated to the process.
Process Control Block (PCB)
Process Scheduling
• The process scheduling is the activity of the process
manager that handles the removal of the running
process from the CPU and the selection of another
process on the basis of a particular strategy.
• Process scheduling is an essential part of a
Multiprogramming operating systems.
• Such operating systems allow more than one process
to be loaded into the executable memory at a time
Process Scheduling Queues
• The OS maintains all PCBs in Process Scheduling Queues.
• The OS maintains a separate queue for each of the process
states and PCBs of all processes in the same execution
state are placed in the same queue.
• When the state of a process is changed, its PCB is unlinked
from its current queue and moved to its new state queue.
• The Operating System maintains the following important
process scheduling queues −
Process Scheduling Queues
The Operating System maintains the following important
process scheduling queues
Job queue − This queue keeps all the processes in the
system.
Ready queue − This queue keeps a set of all processes
residing in main memory, ready and waiting to execute.
A new process is always put in this queue.
Device queues − The processes which are blocked due to
unavailability of an I/O device constitute this queue.
Process Scheduling Queues
Two-State Process Model
Running
• When a new process is created, it enters into the system as in the
running state.
Not Running
• Processes that are not running are kept in queue, waiting for their
turn to execute.
• Each entry in the queue is a pointer to a particular process. Queue is
implemented by using linked list.
• When a process is interrupted, that process is transferred in the
waiting queue. If the process has completed or aborted, the process
is discarded. In either case, the dispatcher then selects a process from
the queue to execute.
Process Schedulers
• Schedulers are special system software which handle
process scheduling in various ways.
• Their main task is to select the jobs to be submitted into
the system and to decide which process to run
There are three types of Schedulers
1. Long-Term Scheduler
2. Short-Term Scheduler
3. Medium-Term Scheduler
Long Term Scheduler
• It is also called a job scheduler. A long-term scheduler determines
which programs are admitted to the system for processing.
• It selects processes from the queue and loads them into memory for
execution.
• Process loads into the memory for CPU scheduling.
• The primary objective of the job scheduler is to provide a balanced
mix of jobs, such as I/O bound and processor bound. It also controls
the degree of multiprogramming.
• If the degree of multiprogramming is stable, then the average rate of
process creation must be equal to the average departure rate of
processes leaving the system.
Short Term Scheduler
• It is also called as CPU scheduler.
• Its main objective is to increase system performance in
accordance with the chosen set of criteria.
• It is the change of ready state to running state of the
process. CPU scheduler selects a process among the
processes that are ready to execute and allocates CPU to one
of them.
• Short-term schedulers, also known as dispatchers, make the
decision of which process to execute next. Short-term
schedulers are faster than long-term schedulers.
Medium Term Scheduler

• Medium-term scheduling is a part of swapping.


• It removes the processes from the memory.
• It reduces the degree of multiprogramming. The
medium-term scheduler is in-charge of handling the
swapped out-processes.
MCQ QUESTION
Which of the following includes the current activity
represented by the value of Program Counter and
the contents of the processor's registers.
a) stack
b) Text
c) Data
d) Heap
Answer: b
MCQ QUESTION
____ section is dynamically allocated memory
to a process during its run time
a) stack
b) Text
c) Data
d) Heap
Answer: d
MCQ QUESTION
A process generally also includes the process
______which contains temporary data (such as
function parameters, return addresses, and local
variables)
a) text section
b) program counter
c) stack
d) data section
Answer: c
MCQ QUESTION
How many states can a process be in?
(A)2
(B) 3
(C) 4
(D) 5
Answer: D
Match the following
List – I List - II
Process state transition Reason for transition
a. Ready→Running i. Request made by the process
-is satisfied or an event for which it was waiting occurs.
b. Blocked→Ready ii. Process wishes to wait for
some action by another process.
c. Running→Blocked iii. The process is dispatched.
d Running→Ready iv. The process is preempted.
Codes :
a b c d
(A) iii i ii iv
(B) iv i iii ii
(C) iv iii i ii
(D) iii iii ii i
Answer: A
MCQ QUESTION
A virtual memory based memory management
algorithm partially swaps out a process. This is an
example of
(A) short term scheduling
(B) long term scheduling
(C) medium term scheduling
(D) mutual exclusion
Answer: C

You might also like