Download PL , OS and OOPS Concept - Banking Solutions , Nagpur

Document related concepts

Go (programming language) wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Join-pattern wikipedia , lookup

Class (computer programming) wikipedia , lookup

Abstraction (computer science) wikipedia , lookup

Flow-based programming wikipedia , lookup

Compiler wikipedia , lookup

Assembly language wikipedia , lookup

Stream processing wikipedia , lookup

Thread (computing) wikipedia , lookup

Application Interface Specification wikipedia , lookup

Object-oriented programming wikipedia , lookup

Name mangling wikipedia , lookup

Interpreter (computing) wikipedia , lookup

C Sharp syntax wikipedia , lookup

ILLIAC IV wikipedia , lookup

C++ wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Scheduling (computing) wikipedia , lookup

Transcript
♦ Operating System
♦ OOPs concept
♦ Programming Languages
Operating System
A program that acts as an intermediate
software(system) between a user of a
computer and computer hardware.
 Resource allocator (allocation, management,
withdrawal)
 Control Program
 Device Manager
Functions of Operating
System
Process Management
 Process Management: Creation and deletion
of process handled by CPU
 The synchronization and scheduling of
processes also handle by CPU only.
File Management
Crating and deleting both the files and directives.
Other functions of Operating system
 Allocating space for files
 Keeping backup securing easy access to file
 Input-output management
 Storage management
 User interface
 GUI
 CLI/ CUI
Parts of OS
 Kernel : it is a computer program that
manages input/ output requests from
software and translates them into data
processing instructions for the CPU.
 Shell : is a command line interpreter it
interprets the commands the user types in
and arranges for them to be carried out.
Micro and Monolithic and hybrid are type of?
Operating system Structure
user
 User
 application
 system
Application
System
Shell
kernel
 Shell
 kernel
 hardware
H/W
Kernel and user mode
Application
User Mode
System Libraries
Kernel Mode
interaction by system calls
OS
Device
OS interacts with memory
via load and store
instructions
and CPU registers
OS: Spooling
Spool: Simultaneous Peripheral Operation
On-Line
 A spool is a buffer that holds output for a
device such as printer that can not accept
interleaved data streams
 The spooler may be reading the input of one
job while printing the output of a different
job.
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
CPU
Memory
i/o
Process state
New
admitted
terminated
interrupt
exit
ready
running
scheduler dispatch
i/o event completion
i/o event wait
waiting
Process Scheduling
 For maximizing CPU use, quickly switch
process onto CPU for time sharing.
 Process scheduler selects among available
processes for next execution on CPU.
 Maintains scheduling queues of processes
 Job queue- set of all process in system
 Ready queue- set of all processes residing in
main memory, ready and waiting to execute
 Device queues – set of processes with an i/o
device
Bootstrap Loader
 It loads Operating system from Hard Disk to
Main Memory
Types










of Operating System
Single user OS
Multi user OS
Multitasking OS
RTOS OS
Embedded OS
Time Sharing OS
Batch Processing OS
Distributed OS
Mobile OS
Server Site OS
CPU Scheduling:
 CPU Scheduling is the process by which an
Operating System decides which programs get
to use the CPU. CPU scheduling is the basis of
MULTIPROGRAMMED operating systems. By
switching the CPU among processes, the
operating system can make the computer more
productive.
 CPU Schedulers: Schedulers are special system
software’s which handles 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.
CPU scheduling algorithm
1. First Come First Serve (FCFS)
 Jobs are executed on first come, first serve
basis.
 Easy to understand and implement.
 Poor in performance as average wait time is
high.
2. Shortest Job First (SJF)
 Best approach to minimize waiting time.
 Impossible to implement
 Processer should know in advance how much
time process will take.
3. Priority Based Scheduling
 Each process is assigned a priority. Process
with highest priority is to be executed first
and so on.
 Processes with same priority are executed on
first come first serve basis.
 Priority can be decided based on memory
requirements, time requirements or any
other resource requirement.
4. Round Robin Scheduling
 Each process is provided a fix time to execute
called quantum.
 Time uniformity maintained
 Once a process is executed for given time
period. Process is preempted and other
process executes for given time period.
 Context switching is used to save states of
preempted processes.
5. Multi-Queue Scheduling
 Multiple queues are maintained for
processes.
 Each queue can have its own scheduling
algorithms.
 Priorities are assigned to each queue
Language
What is language?
 Language is an important element of
Communication that may consist of either
single or all the below mentioned
components.




Sound
Expression
Words
Grammar etc
Programming Language
 Programming language is formally designed
language that is used to instruct a digital
system. We have three types of programming
language.
 Machine Language
 Assembly Language
 High level Language
Scope of languages to CPU
Low Level
Assembly
High Level
CPU
Translator
 Compiler
 Assembler
 Interpreter
Assembler
 It is used to convert the assembly language
which consist of mnemonics codes.
compiler
 It converts source code into machine
language.
 Compiler reads whole source code at a time.
 For each high level language a separate
compiler requires.
Interpreter
 It converts source code into machine
language.
 Interpreter reads source code line by line and
converts it into machine code
OOPS Concept
OOPS
 An object is basic unit of object oriented
programming Approach which has a name
and is designed to perform certain actions, it
also interacts with other elements of
program.
Features of OOPS
 Class
 Object
 Encapsulation
 Polymorphism
 Data Hiding
 Data Abstraction
 Inheritance
object
 Object is instance of class having some
characteristics and behavior, object is a key to
oops
class
 Class is a collection of objects, in a general
class may contain data and function
 It is collection of same type of object
Automobile is a class that may contains two
wheeler, four wheeler
bull cart ?
Inheritance
 Properties of acquiring features of




predecessors
In oops class inherits the property of it
superior class
Advantage
Code reusability
Less consumption of time
Inheritance
 Single :subclass inherits properties of its
super class
 Multiple : one subclass can inherit properties
from multiple super class(ex. java)
 Multilevel: A subclass is inherited from
existing subclass.
 Hierarchical: a single class act as a super class
for more than one subclass.
Data Abstraction
 Displaying only and essential data and hiding
the background details.
Data Hiding
done by using access modifiers
Public
Private
protected(internal method/ function)
Encapsulation
 Wrapping data members and member
function together in single unit
 Member function(Method) used to access the
data hence provide add on security to the
data
Polymorphism
 The word polymorphism means multiple
forms, in oops the polymorphism describes
the implementation of single method in
different manner
 Static
 dynamic
example
 Area()
triangle
square
cube
Method overloading
 Method Overloading means a function having
same name but different arguments/
parameters.
 Ex: add(int,int)
add(int,int,int)
add(int, float)
add(float,float)
int add(int a, int b)
{
Return a+b;
}
int add(double a, double b, double c)
{
Return a+b+c;
}
int main()
{
int z;
double r;
z=add(5,4);
r=add(5,4,6);
cout<<z”\n”<<r;
}
OUTPUT
9
15
Method overriding
 Allows subclass or child class to provide a
specific implementation of method that is
already provided by one of its super class or
parent class.
 The implementation in the subclass
overrides(replaces) the implementation in the
super class by providing a method that has
same name, same parameters and same
return type as methods in parent class.
Ex:
class abc
{
Protected:
Int x;
Public:
void get_x (int a)
{
x=a;
}
void put()
{
cout<<“X”<<x;
}
};
class xyz: public abc
{
int y;
public:
Void get (int a, int b)
{
x=a;
y=b;
}
void put()
{
cout<<“X :”<<x;
cout<<“Y :”<<y;
}
};
int main()
{
xyz a;
a.get(5,10);
a.put();
return 0
}
Output:
 X: 5
 Y: 10
An Integer variable that is used to
manage concurrent processes is
called…..
(A) Thread
(B) Semaphore
(C) Counter
(D) None of the above
…… is the smallest unit for processing
that consists of a program counter, a
stack & a set of registers.
(A) Compiler
(B) Thread
(C) Heap
(D) None of the above
Which of the following services is
not supported by the OS?
(A) I/O Operation
(B) Protection
(C) Compilation
(D) None of the above
First Come First Serve (FCFS)
Scheduling is…….
(A) used to reduce waiting time
(B) easy to understand and implement
(C) impossible to implement
(D) None of the Above
……… is a system call of OS that is
used to create a new process?
(A) Shell
(B) Kernel
(C) Fork
(D) Thread
Which of the following is an example of
Cooperative Multi-Tasking OS?
(A) Lynx OS
(B) Mac OS
(C) MS DOS
(D) None of the above
The performance of Round Robin(RR)
scheduling depends on……
(A) quantum.
(B) priority.
(C) preemption
(D) None of the above
Which of the following plays an important
role in modern Operating Systems(OS)?
(A) Kernel.
(B) Shell
(C) Fork.
(D) None
In DOS label command is used to….
(A) Create the label of disk
(B) Change the label of disk
(C) Both (A) & (B)
(D) None
Thank you