Monday, September 6, 2010

OOPS Notes

Q1(a) What is the mean by Dynamic Initialization of objects ? Why it is needed ? How is it accomplished in C++ ? Illustrate
Ans

Dynamic initialization of objects means that we will provide the value at rum time of the program. This is referred as dynamic initialization of object. In C++ a variable can be
Initialized at run time using the expressions at the place of declaration. Dynamic initialization of variable will provide the value at run time that is not fixed at starting time of program. Dynamic programming will provide the value at running condition at run time.
Dynamic initialization means that we will provide the value to a variable when it used for first time in the programming.

The following is the reason that why Dynamic initialization of objects are used
1) We can provide the value according to the user requirement
2) We can change the format of the variable at rum
3) We can different types of values at run time
4) User can change its value frequently


There are three ways to initialize Dynamic objects
1) Dynamic declaration with new operator
When we define a variable, we specify a type and a name. When we dynamically allocate an object, we specify a type but do not name the object. Instead, the new expression returns a pointer to the newly allocated object; we use that pointer to access the object:
int i; // uninitialized int variable
int *pi = new int; // pi points to dynamically allocated,


2) Initialization of Dynamic objects
In these concepts we will provide the value to dynamic objects we will generate.
3) Default value assign to objects



Q What is exceptional handling ? How the exception handling is useful/preferred than normal error checking codes ? Illustrate
Ans.
Exceptions are run-time anomalies that a program may detect for example divided by zero. When program is running then exception will arrive that exception can be catch by different statement provided by C++. Exceptions can be classified into two category.
1) System define Exception Handling
2) User define Exception handling

1) System define exception handling
System define exception handling is an handling in which we will handle errors that has been define by the system. For Example number is divided by zero that means when we will divide a number with zero then this exception will throw by the system catch by the exception placed by the user
2) User define exception handling
User define exception handling is a handling in which we will try to solve the error that will generated by the user program. For Example we want to add two number and we place a particular condition if any number is negative then it must show an error to us. If any user will give negative number then it will throw an exception.
User define exception handling will use the following three statements
1. Trying the normal flow: To deal with the expected behavior of a program, use the try or __try keyword as in the following syntax:

try {Behavior}

The try or __try keyword is required. It lets the compiler know that you are attempting a normal flow of your program. The actual behavior that needs to be evaluated is included between an opening curly bracket “{“ and a closing curly bracket “}”. Inside of the brackets, implement the normal flow that the program should follow, at least for this section of the code.
2. Catching Errors: During the flow of the program as part of the try section, if an abnormal behavior occurs, instead of letting the program crash or instead of letting the compiler send the error to the operating system, you can transfer the flow of the program to another section that can deal with it. The syntax used by this section is:

catch(Argument) {WhatToDo}
This section always follows the try section and there must not be any code between the try’s closing bracket and the catch section. This means that, if you are using a __finally section, it must not be included before a catch section. The catch keyword is required and follows the try section.

The catch behaves a little like a function. It uses an argument that may be passed by the previous try section. The argument can be a regular variable or a class. If there is no argument to pass, the catch must at least take a three-period argument as in catch(…). The behavior of the catch clause starts with an opening curly bracket “{“ and ends with a closing curly bracket “}”. The inside of the brackets is called the body of the catch clause. Therefore, use the body of the catch to deal with the error that was caused.

Combined with the try or __try block, the syntax of an exception would be:

try {
// Try the program flow
}
catch(Argument)
{
// Catch the exception
}
3. Throwing an error: There are two main ways an abnormal program behavior is transferred from the try block to the catch clause. This transfer is actually carried by the throw keyword. Unlike the try and catch blocks, the throw keyword is independent of a formal syntax but still follows some rules. For example, it is usually included in a try or __try section.



For Example
#include
void main()
{
int a,b;
try
{
cout<<"Enter Two values"< cin>>a>>b;
if(a<=10)
throw(a);
else
cout<<"Addition is "<
}catch(int p) { cout<<"Exception handling "< cout<<"Value of a is "< }
}

According to this example we are placing the try block on the value which we are accepting from the user. If user is entering wrong value then it will throw an exception that will catched by catch block that we have placed in the last of the program.


Advantage of Exception Handling
1) We can handle the error according to the user requirement
2) We can show user define message in the case of error.
3) It will stop the normal execution of the program
4) We recover from the position from where program has been stopped.
Disadvantage
1) It required unnecessary memory space to catch and throw the expected errors to the user.
2) Multiple try and catch block of exception handling can reduce the performance of the system




Q what is object oriented programming? how it is different from procedural language.

Ans
Object oriented programming is a programming in which we will focus on objects. As we know that an object is the representation of any thing that we are viewing in the world. For Example Name of student is an object that contains different types of attributes that will make the different between two objects.The following difference between object oriented and procedural language will clear how both are different from each other.

Procedural Language Object Oriented Language.
1) It is Function based Language
1) It is Object Based language
2) It use top-down design approach 2) It use bottom-up approach
3) Functions are define earlier 3) functions can define at run time as well design time
4) It does not provide the facility of multiple inheritance 4) It provide multiple inheritance concepts
5) Software complexity can not be managed 5) Software complexity can be managed
6) A large problem is sub-divided into different sub parts 6) A large problem is sub-divided into different sub objects
7) We can not generate multiple instance of the function 7) we can generate the multiple instance of an object
8) Data hiding can not be performed 8) Data hiding can be performed
9) No message passing concepts are used between different types of functions 9) Message passing concepts are used to communicate between different objects
10) Access specifier is not possible 10) Access specifier is possible
11) function abstraction can not be possible 11) We can perform data abstraction
12) Multiple functions can be combined in single function 12) Multiple objects are combined into a class
13) We can not use the concepts of inheritance 13) We can use the concepts of inheritance
14) We have to perform static binding of data 14) we can perform static and dynamic binding

Q What is function overloading? Where and why we use this concept. Explain with the help of example.
Ans :
Function overloading means that we will use different functions with same name but each function will contains different arguments or data type of argument will be different.In other word we can say that two function will share the same name but the arguments will different from each other.
For Example

#include
using namespace std;
void f(int i); // integer parameter
void f(int i, int j); // two integer parameters
void f(double k); // one double parameter
int main()
{
f(10); // call f(int)
f(10, 20); // call f(int, int)
f(12.23); // call f(double)
return 0;
}
void f(int i)
{
cout << "In f(int), i is " << i << '\n';
}
void f(int i, int j)
{
cout << "In f(int, int), i is " << i;
cout << ", j is " << j << '\n';
}
void f(double k)
{
cout << "In f(double), k is " << k << '\n';
}
This program produces the following output:
In f(int), i is 10
In f(int, int), i is 10, j is 20
In f(double), k is 12.23

According this example we are using one function with name f first function is containing with single arguments and second function is containing two arguments and third function contains one arguments with single argument but the different between first function and second function is format of arguments we pass in the function.

Where we can use Function overloading

1) When we have to use same function on different types of data
2) When we need one function that can perform different operation with different types of data
3) Function overloading will used when we donot know which type of data can be input by the user.

Why we use the Function Overloading
1) Improving the interface between functions and use request. In other word we can say that user can use the any arguments without knowing which type argument is required by the function.
2) Function Overloading will be used when we want to use the same function for different purpose point of view.


Advantage of Function overloading
1) we can use same function multiple times
2) we can accept different types of values
3) User can easily switch from one value to another value
4) Processing of data will be hidden from the user that means user does not know about the working of a function
5) It will increase the readability of code
6) Function overloading when we want to call a particular data with different requirements

Disadvantage of Function overloading

1) No Proper decision about which function is about to execute. Suppose we created with two functions that are using same arguments but argument contains same format of data that time function overloading will show an error to us.For Example
// Overloading ambiguity.
#include
using namespace std;
float myfunc(float i);
double myfunc(double i);
int main()
{
// unambiguous, calls myfunc(double)
cout << myfunc(10.1) << " ";
// ambiguous
cout << myfunc(10);
return 0;
}
float myfunc(float i)
{
return i;
}
double myfunc(double i)
{
return i;
}

According to this example we are overloading the function myfunc. If we provide the value with 10.1 then compiler will be confused which will be executed and which not be executed then it will show an error to us. This is main disadvantage of Function Overloading

Q What are macros ? How do they help . Explain with the help of example.

Ans
The macro is that part of the compiler that performs various
text manipulations on your program prior to the actual translation of your source code into object code. You can give text-manipulation commands to the macro. These commands are called macro directives and, although not technically part of the C++ language, they expand the scope of its programming environment.The C++ macro contains the following directives:

1) #define
It is used to define an identifier and a character sequence that will be substituted for the identifier each time it is encountered in the source file. The identifier is called a macro name and the replacement process is called macro substitution. The general form of
the directive is #define macro-name character-sequence
Notice that there is no semicolon in this statement. There can be any number of spaces between the identifier and the character sequence, but once the sequence begins, it is terminated only by a newline

Example

#define UP 1
#define DOWN 0
According to this example where ver we will use UP that will be converted by 1 and DOWN will be converted by 0
2) #error
When the #error directive is encountered, it forces the compiler to stop compilation.This directive is used primarily for debugging. The general form of the directive is #error error-message The error-message is not between double quotes. When the compiler
encounters this directive, it displays the error message and other information, and then terminates compilation.
3) #include

This macro will instruct the compiler to include either a
standard header or another source file with the file that contains the #include directive. The name of the standard headers are enclosed between angle brackets, as shown in the programs throughout this book. For example,
#include
4) #if #else #elif
#endif #ifdef #ifndef

The general idea behind the #if directive is that if the constant expression following the #if is true, then the code between it and an #endif will be compiled; otherwise,the code will be skipped over. #endif is used to mark the end of an #if block.
The general form of #if is




#if constant-expression
statement sequence
#endif

If the constant expression is true, the block of code will be compiled; otherwise, it will
be skipped. For example:

// A simple #if example.

#include
#define MAX 100
int main()
{
#if MAX>10
cout << "Extra memory required.\n";
#endif
// ...
return 0;
}

5) #undef
The #undef directive is used to remove a previously defined definition of a macro name. The general form is

#undef macro-name

6) #line
The #line directive is used to change the contents of _ _LINE_ _ and _ _FILE_ _,
which are predefined macro names. _ _LINE_ _ contains the line number of the
line currently being compiled, and _ _FILE_ _ contains the name of the file being
compiled. The basic form of the #line command is
#line number “filename”
Here, number is any positive integer, and the optional filename is any valid file
identifier. The line number becomes the number of the current source line, and the
filename becomes the name of the source file. #line is primarily used for debugging
purposes and for special applications.
For example, the following program specifies that the line count will begin with 200.
The cout statement displays the number 202 because it is the third line in the
program after the #line 200 statement.
For Example

#include
using namespace std;
#line 200 // set line counter to 200
int main() // now this is line 200
{ // this is line 201
cout << _ _LINE_ _; // outputs 202
return 0;
}


7) #pragma
The #pragma directive is an implementation-defined directive that allows various instructions, defined by the compiler’s creator, to be given to the compiler. The general form of the #pragma directive is
#pragma name Here, name is the name of the #pragma you want. If the name is unrecognized by the compiler, then the #pragma directive is simply ignored and no error results.

Advantage of Macro
1) single time declaration will perform that will be used multiple time
2) Single time modification will change the entire program where it has been used.
3) Compiler will ignore macro when compiler is done
4) Macro will reduce the workload of processing
5) We can easily understand the program






Q Differentiate between constructor and destructor

Constructor Destructor
1) single class can contains many constructor 1) class contains only one destructor
2) Constructor can contains different arguments 2) Destructor does not contain any arguments
3) Constructor will be automatically executed or worked when object of the class is generated 3) Destructor will be automatically destroyed when class is destroyed
4) Constructor can be overloaded 4) Destructor can not be overloaded
5) Constructor contains the same name as the class is having 5) It will contain the same name of class but it is preceded by ~ symbol
6) constructor contains different styles
a) Simple constructor
b) Constructor with arguments
c) Copy constructor 6) It contains single type
7) Constructor contains only default arguments 7) It does not contains any default arguments
8) It can not refer to their addresses 8) It will be referred to address of constructor
9) It can be used to initialize different types of variables 9) It can be used to free the memory that is provided to different variable that we have declared in the program
10) It does not return any type of data to calling program 10) It will return any value but it will terminate the operation of the constructor



Q Define Constructor .what are the properties of a constructor ? Explain the different types of constructors used in C++

Ans :
Constructor is a function that will contains the same name as the class is having. The constructor will be executed when we will generate an object of the class.
There are following properties are used in constructor
1) constructor should be declared in public section
2) It should be invoked automatically when we will generate an object of the class
3) It will return any type of value
4) We can not refer to their addresses
5) What ever object of the class that can not be used some where else in the program. for programming
6) They can have default arguments
7) Constructor can not be inherited
There are different constructor are used in C++
1) Default Constructor

Default Constructor is a constructor. Default Constructor that does not contains any parameter. Default constructor which contains the same name as the class is having

Syntax
class abc
{
public:
abc() //This is the default constructor
{
}
}
According to this example abc is the class and abc is constructor that does not contains any arguments
2) Parameterized Constructor
Parameterized constructor is the constructor that will contain different parameter that we will pass to constructor. Parameterized constructor will accept the arguments from the user.
Syntax
class name
{
name (arguments list)
{
}
}
According to the example there is class name that contains different type of arguments we will pass to the constructor

3) Multiple Constructor
Multiple Constructor will contain more than one constructor. Each constructor will contain different types of arguments.
Class gh
{
gh()
{
}
gh(arguments)
{
}
}

According to the syntax there is a class gh that contains two constructor one constructor contain no argument and another constructor contains two arguments.


4) Constructor with default arguments
Constructor with default arguments means that we will provide some argument with a constant value or we can say that we will pass a fixed value.
Syntax
Class gh
{
gh(int g=20)
{
}
}
According to the example there is a class gh that contains a constructor that contains one argument in which we have given a fixed value.
5) Copy Constructor
Copy constructor is a constructor in which one constructor will work as an object to another constructor. Copy constructor will play very important role when we want to use one constructor in another constructor.


6) Dynamic Constructor
Dynamic constructor is a constructor in which we will pass dynamic arguments to the constructor. In other word we can say that we will pass dynamic values to arguments.
Syntax
class yu
{
yu(dynamic arguments)
{
}
}
According to the example there is a class yu and there is dynamic arguments we pass in the constructor that will be associated with the constructor. In the summary form we can say that constructor will be used to initialize variables and constant that is required in the program.

Q What is mean by objects ? How these are created .Explain with the help of example
Ans :
As we know that object is an entity that contains properties and behavior associated with them. With the help of property we can identity the objects.
Objects can be created from the characteristics of class and different features associated with them. In other word we can say that objects can be created from the real life entity like name of any person and any thing name will be included in object.
Each object contains two parts inside it
(a) Object name
When we are providing the name to object the we have to be careful about the name of object. The following care we have to taken during providing the name to objects
1) Name of object should indicate the purpose of task
2) Two object name should be unique from each other
3) Two objects can have same properties.

(b) Value that object can store
1) what ever the value we will store in the objects should be according to the name of an object
2) Value that will be stored should be relevant enough to perform the purpose of the object

For Example
#include
class student
{
public:
int rollno;
char name[100];
char result[10];
};
void main()
{
student r;
cout<<"Enter the rollno of the student"< cin< cout<<"Enter the name of the student"< cin>>r.name;
cout<<"Enter the result of the student"< cin>>r.result;
}


According to this example there is a class student that contains three objects inside it that objects we can use to manipulate the class and different operation we can perform on the class.

When we are declaring the objects then we will use the following access mode.
1) public
public means that what ever the object we declared that can be easy to access from outside of the class .In other word we can say that public objects can used by another class.
2) Private
Private members are that members that are not easy to access by another class.Private member are accessible by the member of class and class that is inheriting the class
3) Protected
Protected object are that object which is accessible by another class member but the other class member should be to make the member of class.



Advantage of Objects
1) We can easily represent the object
2) We can see the actual functioning of objects or different objects exist in the world
3) Objects communicate with each other with the help of message passing between different objects

Q What are the important common features supported by Object Oriented languages ? Explain in details

Ans :
Object oriented language provides the following features to us.
1) Objects
2) Classes
3) Inheritance
4) Abstraction
5) Polymorphism
6) Message Passing
7) Encapsulation
8) Dynamic Binding

1) Objects
Object represents the basic run-time entity in an object-oriented system. object occupy space in memory that keeps its state and it will perform operation on them. When different objects are combined then it will make a class.
2) Classes
A class represents a possible set of objects.The object will contain attributes that will make the difference between different objects.
3) Inheritance
Inheritance means that we will inherit some feature from existing class.In other word we can say that we will use some objects that are available in previous class.
Inheritance can be classified into the following category
a) Simple Inheritance
b) Multipoint Inheritance
c) Multiple Inheritance
d) Hybrid Inheritance

4) Abstraction
Abstraction is an important features of OOPS in which we will describe the external behavior than internal behavior.
5) polymorphism
polymorphism means that we will use one function more than one time with different types of arguments. Polymorphism will reduce the coding that we have to perform again and again.
7) Message Passing
Two objects interacting with each other with the help of message passing between two objects Message Passing is the best way to make the communication.
8) Dynamic Binding
Dynamic binding means that we will bind the object not in static form but it is bounded in dynamic form. Dynamic binding will provide different features that will provide different types of flexibility of data acceptance.

Q What is database ? What qualities a database must processes to be an ideal database ?
Ans
Database is a collection of records there are different program available to manipulate them according to user requirement . Database should have the following characteristics
1) Inconsistency
When we will use database then inconsistency will be removed from the database.
For Example
There is one employee in the company who have been
Promoted from clerk to head clerk then salary of that employee will be increased then salary will be updated in database that updated database will be shifted to all client who are connected with central database. There will be no confusion between two clients who are connected with central database.
2) Sharing of data
When central database is used then data can be shared between clients computers which has been connected with each other..Sharing of data can be done with the help of backup concept of database.
For Example:
Suppose one client is making a particular application in a particular computer that can be shared with other client.
3) Security
When we use database then we can protect the database from illegal access of database. Security will be handled by the System administrator who will take care of each and every task is performed by the user.
For Example
One client who want to access a particular file from the database then system administrator will check rights of that use then using of file is allowed to that client
4) Auditing
Database can maintain the auditing of different users who log in the system and different task performed by them. Auditing will maintain all details about the user.
For Example
One client who log in the system in the at 10:30 and file manipulation will be performed by the client all details will be maintained in the log file.
5) Data Integrity
Data integrity means that data will be entered in the database will be accurate. In other word we can say that every user will get the accurate data.
For Example
Suppose one client enter the record with amount of 500Rs then other user will get the amount 500Rs.
6) Single time implementation
When we use database then we have to implement the rule at central database that rule will be used by every client who will make transaction with database.
For Example
We implement a rule on database that every employee age will be entered greater than 18 then every user enter the age of employee greater than 18.
7) Query Processing
We can perform query with database. Query is done by the user in the form of simple English syntax.
For Example
One client want to know about the employee whose name start with ‘l’ then client will make a query that query will move to database. Database will understand that query and return result back to client.
8) Conflict resolve
Database will handle the conflict that is arriving between different client request.
For Example
There are five client who are making interaction with database. One client is requesting about a particular file “abc.dat” the same is requested by another client then conflict will arrive. The System administrator will solve this problem according to the rights provided to clients.
9) Data Independence
Database will provide Data independence. Data Independence indicate that application and data both are separate utility. If any change is performed in data that does not effect application and changes
Performed in application does not change data.
For Example
We write a resume and copy that resume to pen drive that does not effect resume.







Q Differentiate between the following
1) Links and Associates
2) Public inheritance and private inheritance
3)SA/SD and Object Modeling
4) Multilevel inheritance and Multiple Inheritance

1) Links and Associates
Links Associates
1) It will show relation between Objects 1) It will show relation between classes
2) It will operate on single entity 2) It will work on group of entity
3)
4) Multilevel Inheritance and Multiple Inheritance

1) In Multilevel Inheritance one class inherit objects from another class and another class inherit objects from next another class. 1) In multiple inheritance multiple class inherit the objects from one class.
2)








According to the example Class A inherit the objects from Class B and Class B inherit the objects from Class C.





2)





According to the example class B,C,D inherit the objects from class A.

3)




Q What is method overriding ? when does it occur. Explain with the help of example

When a class inherits a base class, it receives all the base class’s public and protected mehtods and properties. However, it does not have to take everything it gets as is. The derived class can override any function to suit the needs of the derived class. In other words, you are not stuck with the functions you inherit. You can override them. Overwriting a function is not the same as overloading a function. When you overload a function it must have different parameters (either a different number or different types). When you override a function it should have the same parameters, but the actual code in the function will be different. The function declaration (the name, return type, and parameters) is called the interface; the actual code in the function is called the implementation. Thus, your interface will be the same when you override an inherited function, but its implementation will be the same.
For Example
class baseclass
{
public:
void testfunction();
};

void baseclass::testfunction()
{
cout << "Hey this is the base class!\n";
}
class childclass:public baseclass
{
public:
void testfunction();
};
void childclass::testfunction()
{
cout << "Hey this is in the child class!!\n";
}
According to the example there is one class that is baseclass and another is childclass. The baseclass contains one function that is testfunction and childclass contains the same function but child class overriding that function.

When it occurs
Overridding occurs when we want to use a particular function again and again in different classes.

Advantage
1) We does not required to compile the function
2) Coding will be saved
3) We can usa a particular function for different purpose in different classes.
4) When we want to perform the same operation that is done by the base class.
5) We can bound the clientclass to provide the arguments that has been given in parentclass
6) We can easily perform the modification in the method according to the requirement of the class.
Q what is JSD ? Explain this design in details along with its advantage and disadvantage
Ans.
Jackson structured development start with the consideration of real world. JSD model will describe the real world in terms of entities, actions and ordering of actions. A Jackson Structured Programming diagram is used to explain the inner workings of a program. At a glance they seem similar to algorithm flowcharts, but the likeness is only superficial. To understand a JSP diagram you must read it properly. With a JSP diagram each step on the same branch is performed top down - left to right.
JSD will diagram concepts to show the flow of control from one data to another data.
1) Action /Process
2) Selection
3) Iteration
4) Procedure

1) Action/Process

Action and process indicate that we will take proper action against the entity and process that we are performing in the program
Action is indicated by the following diagram






2) Selection
In this step we will take proper selection against the selection done by the user.

According to this diagram circle indicate that we will make a selection in different options available to us.

3) Iteration
In this diagram we will represent iteration of steps that we will take again and again to perform a specific task.

This diagram indicate that we will execute number of statements again and again according to the condition given by the user.
4) Procedure
In this diagram we will represent procedure of statements that will be executed once a procedure will be executed.

This diagram will indicate that we will make a bundle of statements that will be executed when we will perform a action on entity.


JSD will use six steps in structured programming
1) Entity Action Step
2) Entity Structure Step
3) Initial Model Step
4) Function Step
5) System Timing Step
6) Implementation Step

1) Entity Action Step
In this step we will decide what action will be taken by entity. Entity Action Step will ensure that what output will come when we will perform some task on them.
2) Entity Structure Step
In this step we will decide the structure of entity. The structure will include different entities inside it. Structure will include different types of data types and size of different variables we will use in the programming
3) Initial Model Step
In this step we will decide initial step that will be used to process the entire model. In this step we will decide memory we will provide to different objects we will include in the programming
4) Function step
In this step we will decide the function that entity will perform during the operation. This step will decide different arguments we can pass and different values return by the function.
5) System Timing Step
In this step we will decide the timing that is required for processing the entities. System timing will be decided by the statements that will be included in the program
7) Implementation step
In this step we will implement different entities to perform the task performed by the function or procedure that will be included in the program.

Q What do you mean by RDBMS ? Name two popular RDBMS available in the market.
Ans
RDBMS stands for Relational Database Management System. RDBMS is used to store different types of data which is provided by the user. RDBMS will ensure that data has been entered in the database will be accurate.
RDBMS provides the following advantages to us.
1) Data Integrity
2) Data Independence
3) No more Inconsistency
4) Security
5) Resource sharing
6) Simple to implement
7) Single time implementation

There are following software are available in the market.

4th Dimension
Adabas D
Alpha Five
Apache Derby
BlackRay
CA-Datacom
CSQL
CUBRID
Daffodil database
DataEase
Dataphor
DB-Fast
Derby aka Java DB
ElevateDB
EnterpriseDB
EffiProz
eXtremeDB
fastDB
FileMaker Pro
Firebird
Gladius DB
Greenplum
Orcle
H2
IBM DB2
SmallSQL
solidDB
SQLBase
SQLite
Sybase Adaptive Server Enterprise
Sybase Adaptive Server IQ


We are explaining two software that are very popular in the market


1) Oracle
Oracle takes a lead role because of some of the following reasons:

Oracle is used for almost all large application and one of the main applications in which oracle takes its major presence is banking. In fact ten of the world’s top 10 banks run Oracle applications this is because oracle offers a powerful combination of technology and comprehensive, pre-integrated business applications, including key functionality built specifically for banks.

Some similar databases like Sybase, SQL-Server one have facilities for using loops, conditions, arrays and so on in a program and also facilities like cursors and temp tables but all this would be used in a convoluted fashion which are very slow and resource consuming operations. The operations are not implemented as in Oracle which is efficient enough.

Also with the features available in oracle with the earlier versions in market the oracle company keeps upgrading and releasing new products into market, new versions releases which serves better than the earlier versions and thus the performance is improved much in later versions and thereby retaining the market growth and thus proves greater satisfaction to the customers using this technology. Thus the advantage of a higher version is that one would have more features and better capabilities.

For instance oracle 8i version has many new features which helped users namely like with oracle 8i one could run Java in the database, had features like new features on partitioning to support large database and so on. With the next version 9i oracle had these facilities maintained and had more new facilities added to it namely like new features added to help the DBA to handle change database configuration and so on.

Oracle is a database that responds very well with excellent performance in demanding environments. Oracle is a major database which along with its added features passes the ACID test, which is important in insuring the integrity of data. This is very important because data is the heart of any system in organization. A reliable and adequate database system has the following properties:

Atomicity:
That is Results of a transaction's execution are either all committed or all rolled back.

Consistency:
The database is transformed from one valid state to another valid state. Illegal transactions aren't allowed and, if an integrity constraint can't be satisfied then the transaction is rolled back.

Isolation:
The results of a transaction are invisible to other transactions until the transaction is complete thus increasing the security on data.

Durability:
Once committed (completed), the results of a transaction are permanent and survive future system and media failures and thus ensuring maintenance and protection of data.
All the above are well maintained by Oracle database.
The latest version oracle 10g has many features and one new feature is the introduction of recycle bin. This option when enabled could be used by users just like Windows recycle bin or Mac Trash. Dropped tables go "into" the recycle bin, and can be restored from the recycle bin.

One of the main advantage of oracle over other databases is in its recent version oracle has the concept of Flashback technology. That is we all know that data is the heart of any application or organization and thus this requires careful maintenance. But sometimes application outage can occur and mostly DBA claim the reasons for this as hardware failure and apart from this the reason would be human errors like accidental deletion of valuable data, deleting the wrong data, or dropping the wrong table. So it is very essential to take care of such situation and this is done in oracle's latest technology called flash introduced in its latest version. By Flash technology it helps in recovery by working just on the changed data. Thus Flashback provides an

• Efficient recovery from human errors
• Faster database recovery
• Helps in simplifying the management and administration processes
and so on.


solidDB

This software provides the better facility to handle the database perfectly.The Followin software contains the following features to us that why we use this software
1) Achieves Extreme Speed with In-Memory Database Technology
solidDB delivers extreme speed because it keeps data in main memory at all times rather than on disk. Applications can take advantage of its capability through standard ODBC, JDBC, SQL interfaces. solidDB works under the premise that all data to be accessed will be in main memory, all the time. Thus, it has data structures and access methods specifically designed for storing, searching, and processing data in main memory, with efficient concurrency control mechanisms. This has two performance advantages over conventional, disk-based databases. First, solidDB eliminates the need to transfer data blocks from disk to main memory. This is because any data requested by the application is already in main memory. Second, solidDB is faster than disk-based databases, even if the latter cache all data in main memory, since solidDB employs data structures and access methods that are optimized for main memory access.
2) Keeps Data Persistent and Recoverable
While solidDB works under the premise that all data is accessible in main memory, all the time, solidDB also writes updated data to disk, and uses checkpointing and transaction logging mechanisms so that the recoverability of the data is ensured.
3) Provides Extreme Availability
solidDB delivers extreme availability enabling applications to recover from system failures in less than a second providing the extreme data availability required by performance-critical applications. Using a two-node, hot-standby configuration, solidDB maintains copies of the data synchronized between two solidDB nodes.
4) Combines High Availability and Extreme Speed
solidDB can boost performance even further by providing a hot-standby configuration where read operations can be load-balanced across primary and hot-standby solidDB instances transparently to the application. To take advantage of load balancing, an application uses solidDB's ODBC or JDBC drivers that maintain only one logical connection to both primary and hot-standby solidDB instances. In this configuration, write transactions are automatically directed to the primary solidDB node, and read transactions can be directed either only to the hot-standby solidDB node, or load-balanced across primary and hot-standby solidDB instances, without application developers having to write code. Using load-balancing can yield up to a 100% performance improvement, while hot-standby configuration also provides high availability of solidDB nodes with subsecond failover in the event of a failure.
5) Balances Data Safety, Application Throughput and Recovery Time
solidDB offers several high availability configuration options that specify how primary and secondary database servers are synchronized, which can be selected at the system, session and transaction levels. This enables you to balance throughput, durability, and recovery time with unprecedented flexibility.
6) Lowers costs
The extreme speed and extreme availability of solidDB address the need for businesses to always keep data available and accessible, avoiding the costs associated with both planned and unplanned outages and delays. solidDB further reduces costs because it can be controlled by the application and run virtually unattended, letting businesses accelerate deployments and reduce administrative costs resulting in a lower total cost-of-ownership. Furthermore, because solidDB can run on commodity as well as best-of-breed hardware, it provides you with a variety of proven, cost-effective solutions.
Q Name any two object oriented languages.

There are many types of languages available in the market but the most popular languages are the following
1) Actor
2) Ada 95 (multi-purpose language)
3) BETA
4) C++
5) C#
6) Chrome
7) ChucK
8) Cobra
9) ColdFusion
10) Curl
11) DASL
1) C++
C++ is object oriented programming language that why it is used frequently with following reasons.


2) C#





















1) 4th Dimension
2) Adabas D
3) Alpha Five
4) Apache Derby
5) BlackRay
6) CA-Datacom
7) CSQL
8) CUBRID
9) Daffodil database
10) DataEase
11) Dataphor
12) DB-Fast
13) Derby aka Java DB
14) ElevateDB
15) EnterpriseDB
16) EffiProz
17) eXtremeDB
18) fastDB
19) FileMaker Pro
20) Firebird
21) Gladius DB
22) Greenplum
23) H2
24) Helix database
25) HSQLDB
26) IBM DB2
27) WCE SQL Plus
28) IBM DB2 Express-C
29) Informix
30) Ingres
31) InterBase
32) InterSystems Caché
33) Kognitio
34) Linter
35) MaxDB
36) Mckoi SQL Database
37) Microsoft Access
38) Microsoft Jet Database Engine (part of Microsoft Access)
39) Microsoft SQL Server
40) Microsoft SQL Server Express
41) Microsoft Visual FoxPro
42) Mimer SQL
43) MonetDB
44) mSQL
45) MySQL
46) Netezza
47) NonStop SQL
48) Openbase
49) OpenLink Virtuoso (Open Source Edition)
50) OpenLink Virtuoso Universal Server
51) Oracle
52) Oracle Rdb for OpenVMS
53) Pervasive
54) PostgreSQL
55) Progress 4GL
56) RDM Embedded
57) RDM Server
58) The SAS system
59) Sav Zigzag
60) ScimoreDB
61) SmallSQL
62) solidDB
63) SQLBase
64) SQLite
65) Sybase Adaptive Server Enterprise
66) Sybase Adaptive Server IQ
67) Sybase SQL Anywhere (formerly known as Sybase Adaptive Server Anywhere and Watcom SQL)
68) tdbengine
69) Teradata
70) TimesTen
71) txtSQL
72) Valentina (Database)
73) Vertica
74) VistaDB
75) VMDS
76) XSPRADA

Operating System Notes

Operating System and UNIX


Q1. Explain the purpose and syntax of any two UINX commands belonging to the following categories of the commands
(a) Process Management
(b) System Management
(c) Directory Commands
(d) File Manipulation commands
(e) Security and Protection
(f) Inter-user Commands
(g) Information commands
Q2(a) What are the salient features of UNIX Operating System ? Explain .
(b) What is the directory structure of UNIX Operating System? Explain
Q3(a) What do you understand by an operating System ? What are the major functions performed by an operating System?
(b) Enumerate important characteristics of a good operating system and also discuss the ]
Responsibilities of an operating system as a resource manager.
(c) Give an overview of the different types of operating systems.
Q4 what is fragmentation ? What are different types of fragmentation ? How each of these can be overcome ? Explain
Q5(a) What do you understand by a process ? What are the different states of it.
(b) Explain Process States and its diagram
(c) Differentiate between long term ,medium term and short term scheduler.
Q6(a) What do you mean by device Independence ? Discuss the major functions of the device independent software
(b) Explain clock hardware and clock software
Q7 Explain the Following
(a) Device controller
(b) Device Driver
(c) User space I/O Software
(d) Interrupt Handler.

Q8(a) Consider swapping system in which memory of the following hole size in memory order
10K,4K,20K,18k,7K,9K,12K and 15K
Which hole is taken for successive requests of
(i) 12K (ii) 10K (iii) 9K
For first fit ? repeat the same for Best-Fit,Worst-Fit and Next-Fit
Q8( b) Shown below is the workload for 5 job arriving at time zero in the order given below





Job Burst
1 10
2 29
3 3
4 7
5 12
Now considering FCFS ,SJF and round robin (RR) [with quantum=1] algorithms for this set of minimum average time.
(c) Consider a system with a set of a process P1,P2,P3 and P4. Let their arrival times and CPU burst times mentioned as below
Process Arrival Time CPU Brust Time
P1 0 3
P2 1 6
P3 5 4
P4 6 2

(1) Draw the Gantt chart using
(i) First –Come First-Served
(ii) Sortest Job First
(iii) Round Robin
[Quantum of time 2 units]
(2) Calculate
(i) Average Turnround Time
(ii) Average Wait Time
(iii) Average Throughput
Q9(a) what is meant by disk scheduling? Explain why disk scheduling is necessay.
(b) Discuss three disk scheduling algorithms
(c) State the desirable characteristics of disk scheduling policies and explain briefly the various seek optimization scheduling techniques.
Q10 (a) What is time slicing ? How the time slicing duration affects the overall working of the system.

(b) write short note on virtual memory.
Q11(a) What is segmentation ? what are its advantages and disadvantages ? Explain
(b) what is memory management ? Discuss objectives of memory management.
Q12 Write notes on the following
(a) Highest Response Ratio Next Scheduling
(b) Shortest Remaining Time Scheduling
(c) Thrashing
(d) System Calls
Q13. Explain the following allocation algorithms
(a) First Fit
(b) Best Fit
(c) Worst Fit
(d) Buddy’s System
(e) Next fit
Q14(a) when does a page fault occur ? Explain various page replacement strategies/algorithms
(b) What factors can lead to the degradation of the performance of round robin scheduling
Q15(a) Differentiate the following
(a) Networking Operating System and Distributed operating System
(b) Batch Operating System and Real Time Processing System.
(c) Multitasking and Multithreading
(d) Real Time System and Timesharing System
(e) Multiprocessing and Multiprogramming
(f) Preemptive and non-preemptive scheduling
(g) Paging and segmentation
Q16(a) what is an operating system structure ? Compare important operating system structures.
(b) how layered structure approach differs from kernel approach ? Explain
Q17(a) what is File-System ? What are the main responsibilities of a file-system located in layered organization of operating system?
Q17(b) what do you understand by file protection and security ? Explain the various file protection methods / strategics

Q18 what are deadlock ? When do these occurs ? Suggest three basic methods for preventing these
Q19 what are the benefits of multi-programming .
Q19(b) What are the benefits of Multiprocessing /Parallel systems.
Q20 what do you mean by paging ? how address mapping is performed in paging technique? Also enumerate the advantages and disadvantages of paging.
Q21 (a) what are the different objectives which must be considered in the design of scheduling discipline?
Q21(b) what are semaphores ? How do semaphores solve the problem of mutual exclusion ? Explain what are the benefits and limitations of semaphores.




















Network Operating System Distributed Operating System
1) In Network Operating system we have to know the IP Address of a particular system to access the resources. 1) In Distributed Operating system we will male simple query to server. The server will check the entire clients computer the return the result back to client computer.
2) Any user can access any computer after providing user name and password 2) One user can not access any computer without the permission of administrator
3) Any hardware disturbance will slow down the process of the computer 3) Any hardware disturbance will not slow down the process of the computer
4) It is not reliable 4) It is reliable
5) One user can know about the location of a particular user easily 5) One user can not know about the location from where the result is coming
6) Updation process is cheap Updation process is costly.
7) Backup process is costly 7) Backup process is not costly.
8) if server is not working then entire process will be break down 8) if server is not working then backup server or recovery server manage all process.
9) Controlling of all system is done by System administrator 9) Controlling of all System is done by System automatically
10) resources can be shared between different system 10) Resource can not be shared between System because one user can not login into another system.


Batch Processing System Real Time Processing System
1) all processes are collected and processed in a particular fashion 1) all processes are collected and processed in the order in which it is inserted in system
2) It is the oldest method for processing 2) It is the latest processing Concepts
3) we can perform sorting to get the desired result 3) we does not required sorting of processing
4) Result is provided without any time limit 4) Result is provided within time Limit
5) Processing request is done by the user. 5) Processing request is done by the event which we perform on an application.
6) order of processing can be changed according to user requirement 6) Order of processing will be depend on the order in which request is entered in the system.
7) Last process in the batch will take more time to get the final output 7) Real time processing system will provide same time for each processing
8) It is cheap processing System 8) It is costly processing System
9) There is no specific time limit 9) there is a Time limit
10) It is measurement oriented 10) It is action Oriented
11) For Example
Payroll ,forecasting 11) for Eample
Scientific Experiement
12) Processes are handled in a batch 12) Processes are not handled in a batch


Multitasking and Multithreading




MultiTasking MultiThreading
1) In Multitasking more then one program is executed with in same CPU 1) In Multithreading multi tasking is performed within a single program
2) Different tasks can be taken from different users 2) Single task is taken from single user at a time
3) we can handle complex processes 3) we can handle simple process
4) Each program contains Individual address memory space 4) every program will use same memory space
5) each process can not perform separate task without using any resources. 5) In this process process can perform the task without using resources.
6) In multitasking stack is used 6) In multithreading stack is used but sequentially is executed
7) It can handle different users request 7) It can not handle Different user request


Real Time System and TimeSharing System
Real Time System Time sharing System
1) Program is executed according to event we perform 1) Program is executed according to time slice is given to each program
2) We can handle one process at a time 2) We can handle multi program at a time
3) User can see the result according to query performed by the user. 3) User can change ,upgrade as well modify the program
4) User get the result of query with in the time limit given by the user. 4) time is already decided by the user.
5) Processing time is less because no context switching is performed 5) It will take more time because more context switch is taken
6) Real Time System can be classified into two category
a) flexible
b) Fixed 6) Time sharing system will be depend on the Time slice is given to each process
7) One time can be processed at a time 7) Multiple task can be processed at a time


Preemptive and Non-Preemptive
Preemptive Non-Preemptive
1) Time is allocated to each process 1) Time is not allocated to each process
2) In Preemptive shifting is done from one process to another process 2) shifting is not performed from one process to another process
3) It is best for Multiprogramming environment 3) It is best for UniProcessor System
4) We need a special hardware to perform Preemptive 4) We does not required special hardware
5) It will increase the utilization of CPU Utilization 5) It will not increase the CPU Utilization
6) It is costly because we have to prepare scheduled 6) It is not costly .
7) Time is limit given by the user 7) Time limit is not given
8) Deadlock condition can not happens 8) deadlock condition can come
9) Time Interval equally given to each process 9) Time Interval is not given equally to each process
10) It will shift from one process to another process until the entire tasks are not completed 10) It will shift from one process to another process

Paging and Segmentation

Paging Segmentation
1) This is the physical arrangement of Information 1) This is the logical arrangement of Information
2) User can not see the limit of paging 2) User can view the limit of paging
3) Paging always performed in Fixed size 3) segmentation size can be changed according to the size of an application
4) Size of physical will be decided by the machine architecture 4) Size is not decided by the machine architecture
5) we have to rearrange the physical blocks 5) We donot have to rearrange the physical blocks
6) we have to decide the frame to handle the paging 6) we do not required frame to handle segmentation
7) Paging can be used to shift from one block to another block 7) Segmentation can not be used to shift from one location to another location


Q18. What are deadlock? When these do occur? Suggest three basic methods for preventing these.

Ans. Deadlock means that one process is requesting one resource the is hold by another process.




According to the diagram there are four process P1,P2,P3,P4. Process P1 is requesting the resource that has been hold by another process P2 and P2 is requesting the resource that has been hold by the process P3 and p3 is requesting the resource that is hold by the P4 process . In this condition no one process will be satisfied that means no one will satisfied. This will lead to Deadlock condition.

There are four conditions that must be true for a particular deadlock

1) Mutual Exclusion
In this condition one particular resource is allocated to particular process and other process will wait until the resource is not free up by the first process.


According to the diagram P1 is using the resource R and p2 is also demanding the same resource R.In this case P2 will wait until p1 does not release the resource R.
2) Hold and Wait
In This condition one process hold one resource and demanding another resource that has been hold by another process.
3) No Pre-emptive
In This condition one process hold a particular resource and other processes are waiting for that resources.In other word we can say that one process hold a particular resource for unlimited time. that will bring other process to deadlock condition

4) Circular –wait :
In this condition one process wait for a particular resource that is hold by another process and another process is waiting for a resource for a resource that is hold by some another process. That means no one has been satisfied.











According to this diagram P1 is waiting the resource that has been held by the process P2 and P2 is requesting the resource that has been held by the process P3 that process requesting the resource that has been held by the process P4.


Deadlock handling:
Deadlock handling is the concepts in which we will handle the deadlock with different techniques. There are different techniques are available to handle the deadlock condition.
1) Deadlock Prevention
This method will ensure that we will prepare some protocol to ensure the system does not enter into deadlock situation. The following conditions must be ensure the deadlock should not be entered
a) Mutual Exclusion
b) Hold and Wait
c) No Preemptive
d) Circular Wait

2) Banker’s Algorithms


Q9 (a) Disk Scheduling is concept in which we will decide how we will access the data from disk. Disk Scheduling will use different methods to access the data from storage. Disk Scheduling will take the data from requested track and sector on which data has been stored.
For Example
There are four request arriving from different different user then which one process will be processed first or which one will be processed last that will be decided by the Disk Scheduling. Finally we can say that Disk Scheduling will arrange different request arriving from different users.

Disk Scheduling is required with following reasons
1) Time should be taken to access the data should be less
2) Reducing the seek Time to move to desired Sector or track
3) Providing the proper execution time to each process that are arriving for the process
4) Deciding which operation we want to perform on disk
5) Handling the proper address for data transfer
6) Handling the proper number of bytes for transfer
7) Proper arrangement of different proper that has been stored in System Queue.
8) Proper utilization of CPU

There are different Methods are used for disk scheduling
1) First Come First Server
In this scheduling we will process the request that arrive first then move to process that arrive later. This is the simplest disk scheduling technique. This technique is fair enough to process the request.This technique does not provide fatest service to process the request that arrive to the CPU. For Example

Process Block
P1 92
P2 152
P3 82
P4 30
P5 20
P6 50


According to this example the starting position of head at 20. during the first process head will move to block 92 then it will move to block 182 this is the forward movement of head then it will go back to block 81 this is backward movement of head. All processes processing required
242 blocks to be traveled.

Advantage

a) It is the simple scheduling technique
b) It will follow the order of request. It means that First In First Out will be
followed up
c) As the request will be placed in queue that will be processed without observing the higher order or lowest order.
d) This technique can be implemented easily.

Disadvantage
a) It does not provide fastest service to us
b) Reading and Writing time to the disk will take more time. Because
switching from one block from one block.



2) Shortest Seek Time First
Shortest Seek Time First is a scheduling in which job will be processed first which contains less time from the current head location.This scheduling technique will ensure that process which will take less time will be processed first.

Process Block
P1 92
P2 152
P3 82
P4 30
P5 20
P6 50
According to the example the starting head location is 80 . It will check which one process will take less time to process. From starting position it will move to process P3 after that it will check that which block is very near to the current block location.

Advantage
a) Shortest Time taking process will be executed first then other process will be processed.
b) It will not consider the order of insert.
c) It is the best technique when we have short time process in the queue.
Disadvantage
a) This technique will take us to starvation condition. For example
we are at block no. 20 and next block location is 220 .
According to this technique process at block location 220 will
remain in wait condition .
3) SCAN Scheduling
In this scheduling technique we will start from one block then we will move to another block. In other word we can say that head will start moving from one block to another block the request that arrive between starting to ending location of memory that will be processed. In this scheduling the process will executed in a specific order.
For Example

Process Block
P1 56
P2 78
P3 18
P4 120
P5 220
P6 250

The Processing will performed in the following order.
First of all starting position of the head will be considered . Then first location P1 will be processed then P2,P4,P5,P6 in the last when head will be restarted the process no. P3 will be processed.
Advantage
a) It is the simple disk scheduling technique
b) It is faster technique than FCFS,SSTF technique.
c) It is Better technique to avoid starvation of process.
Disadvantage
a) if any process arrive before the head position then process will have to wait until the head position reach to that location.
b) It is not best when you want to execute a process immediately.

4) C-SCAN Scheduling
C-SCAN scheduling in which head will move in circular condition. that means when head reach to end of the disk then it will be started automatically to the starting of the disk.
For Example






Process Block
P1 56
P2 78
P3 88
P4 120
P5 220
P6 250
According to this example there are six processes from P1 to P6 and head position start from block no. 109 then it will process in the following order


Process number Process Name
1 P4
2 P5
3 P6
4 P1
5 P2
6 P3


This example indicate the process will be started with P4 and ending with with P3.

Advantage
a) This scheduling with ensure every request will be processed
b) This is the simple technique to process different types of request
c) The request will be processed in a particular sequence
Disadvantage
a) The process request before the head position will have to wait for their term
b) Waiting for execution can create starvation condition for different types of processes.

LOOK Scheduling

In This scheduling head will move in any direction according to request done by the user. In this scheduling head will move in any direction it can be forward or backward.

For Example






Process Block
P1 92
P2 152
P3 82
P4 30
P5 20
P6 50
According to the example user make a request for a particular block then head will be automatically shifted to that block.
Advantage
a) request will be processed fast
b) Priory can be given according to the user request
c) This is the simple techniques for scheduling
Disadvantage
a) Unrequired blocks can be read by the head because moving from one location to another location that will travel lot of blocks from one location to another location.
Q2(a) What are the salient features of UNIX operating system ? Explain
There are following features provided by UNIX
a) Multitasking
UNIX provide more than one job at a time. For Example
You are typing a letter in text editor at the same time you can copy,modify,delete another file according to user requirement. This indicate that multiple taks can be performed at the same time.
b) Software Development
UNIX Operating system provide excellent environment for developing the software with the help of different types of tools provided by the UNIX with the help of UNIX we can utilize the hardware at maximum level to get the proper out to us.
c) Networking
UNIX operating system provides different types of programs by which we can perform the networking between different types of computers.
d) Security
UNIX provide a particular user a user name and password to provide proper security to the user.
e) Rights
UNIX operating system provides proper rights to each user and file. There are three types of rights provided by the UNIX operating system (Read,Write,Execute)
f) Flexible
UNIX Operating system provides flexible environment to modify,change the environment according to user requirement
g) File Structure
UNIX Operating system provides File structure by which we can organize different types of files easily.
h) Format
UNIX operating system use a uniform format of file that format can be modified easily.
Format will be accepted globally
i) User Interface
UNIX operating system use a simple user interface that means user can interface with the system easily
j) hideness
UNIX operating system hide the hardware information from the user. That means user can not view the hardware details from the system
k) Primitives
UNIX Operating System provides different types of primitives that provides the facility to make simple and complex program easily.
l) Independent
UNIX operating system is machine independent that means UNIX operating system can run on any system without any hardware specifications
m) Portable
UNIX operating system is portable so that we can shift from one system to another system easily
n) Multi-support
UNIX Operating system support character interface and user interface.

(b) what is the directory structure of UNIX operating system ? Explain

Ans : As we know that directories are files that give the file system a hierarchical structure.In a directory the data is put in a sequence of entires.Each such entry contains an node number and name of a file present in the directory and pathname is a null terminated character string. The pathname is divided into separate parts by “/” character.Each component will contains directory name by which it will be identified.







According to the diagram there is single root tha is called root. Every leaf is called directory.This diagram contains one root and following directories inside it.
a) /dev
This directory will contains all device files. This directory will contains files that are associated with printer,monitor and other devices which we have attached with the system
For Example /dev/console This directory indicate that dev is the directory that contains directory console inside it. That will handle all operation that we will perform on monitor
b) /bin
This directory will contains the executable files for most UNIX commands. As we know that all UNIX commands are executable that has been written in “C” language or script .UNIX provide shell script that will contain single name by which file will be identified.we have to type one name of the file for execution
c) /usr
This directory will contains all files that can be private or public to every one. This directory will contains all work perform by a single user or group of users.

d) /tmp
This directory will contains all temporary files that will stored for temporary operation or different other operation we perform on a particular file.
e) /etc
This directory will contains all additional files that are used to handle additional work that we perform on the system.This directory will contains all files that are associated with Devices,Pheripheral Devices that we have attached with the system.

f) /lib

This directory will contains all library functions that is provided by UNIX for the programmers.We can use library functions by making system calls to library from where we want to access the function.



Advantage
a) We can arrange different files in different directories
b) We can easily identified different files
c) We can easily arrange different files with in a single directory
d) We can provide index to different files that are placed in a particular directory.
Disadvantage
a) We have to provide path to switch from one directory to another directory
b) We have to provide long path to access a particular file.
Q13 Explain the following allocation algorithms
(a) First Fit
This allocation algorithm will scan the free list until a large enough hole is found. This algorithm find the perfectly fit block of memory if perfectly block of memory is found then it will be allocated to process otherwise process will wait for memory allocation
For Example
List of available Memory block
Block Size
B1 128
B2 152
B3 421
B4 322
B5 22
Now the request arrive for a process with size of 150 then block B2 will be selected to fit the memory block.
Advantage
a) It is fastest algorithm because list of free space is also maintained
b) It can be implemented easily
Disadvantage
a) If any change happens in any memory block then we have to change the list according to the changes done in memory
b) Every time we have to update the list to get the better output
c) If there is no large space is available then process will move to starvation condition

(b) Best Fit
This allocation technique will place the process in smallest block of unallocated memory. This algorithm will find all list of small holes in memory then it will check which is best to fit the process request done by the user.




For Example
List of available Memory block
Block Size
B1 128
B2 152
B3 54
B4 42
B5 47
Now the request arrive for a process with size of 150 then smallest block B4 then B5 and last B3 will be occupied.

Advantage
a) Smallest block of memory will utilize perfectly
b) We can arrange small and large block easily
Disadvantage
a) We require list of free memory block to get the best fit memory blocks.
b) This algorithms will generate large number of small holes
c) Searching in list will take lot of time

(c) Worst Fit
This allocation technique will place process in available largest block of unallocated memory .This algorithm will make a large hole once the allocation has been done.
For Example
List of available Memory block
Block Size
B1 128
B2 152
B3 54
B4 42
B5 47
Now the request arrive for a process with size of 150 then largest block B2 will be occupied.

Advantage
a) This algorithm will generate large hole of memory
b) This algorithm will arrange large blocks of memory perfectly
Disadvantage
a) Once larger block of memory occupied then same size memory can not be prepared.
b) This technique is best when we have large number of memory blocks

(d) Buddy’s System
Buddy’s System is System in which different memory blocks are arrange with the size of multiply with 2. This system will handle memory block fast because allocation address calculation is an easy process. When ever user make a request then request will be processed with power of 2.
For Example
List of available Memory block
Block Size
B1 128
B2 152
B3 54
B4 42
B5 48
Now the request arrive for a process with size of 150 then block B2 will be occupied.

Advantage
a) Calculation of memory address is an easy
b) Searching is an easy process
c) Entire list is not searched

Disadvantage
a) This is not best for memory allocation. For Example we want to allocate a memory block at address 35 but this technique use the address with power of 2 that will store them on address 36 that will waste the memory block.
b) Extra space is leaved between two memory allocation

(e) Next Fit
This allocation technique will allocate the process in free partition of memory. In this algorithm processing will be started from the same place from where the processing has been leaved off.
For Example
List of available Memory block
Block Size
B1 128
B2 152
B3 54
B4 42
B5 47
Now the request arrive for a process with size of 150 then largest block B2 will be occupied again the request will be arrived then process will be started from block B2 will be started.

Advantage
a) It will take less time
b) Block allocation is fast
c) Proper arrangement of memory can be performed
Disadvantage
a) Once allocation of block is performed then we can not go to that block



Q5(a) what do you understand by a process ? what are the different states of it?
Ans
Execution of a program from a particular context is known as process. In other word we can say that we will run a block of code that code can effect or it can effected by another process. There are different system that support single process at a time that is called uniprogramming and the system with multiple process is called multiprogramming.
The following process control block is used
Process Control Block

Execution State
Scheduling Information
Accounting and Miscellaneous

Execution State
This part of Process control block indicate that the state of a particular process. There are following state of process is used
a) New State
In this state new process will be created or new process is generated
b) Ready State
In this state process will be in ready state to accept input and output to any devices that we have attached with the system. Ready state will use ready queue that will contain all process that has been started or generated by the user.
c) Running State
In this state program will in execution state in which program will be ready to accept input and output from the external devices that we have attached with the system. Running state will ensure that program is in running state.
d) Suspended State
In this state process will be stop by the user. due to lack of resources or other reasons . For Example one process is processed by the CPU during this processing another higher priority arrive then current process will be suspended and focus will move to new process with higher priority.
e) Terminate State
In this state the process will be terminated by the user . After this state program execution will be stopped and terminated.










According to diagram there is new process that will move to ready state. Ready state will ensure that process is ready to run on the system. Ready state will send the process to running state this state will execute the program that has been by the user. During running state process can be terminated or it can be send to suspended state. Once the state has been send to suspended state should be reprocessed as term will come.




Scheduling Information

In this step we will decide the scheduling information that will decide how the process will be executed. Scheduling information will be depend on the scheduling algorithm we will apply on the process.Scheduling information will provide information about the processing details.
Scheduling information will provide the following details
1) Process Name
2) Process Identification
3) Process Ready Date
4) Process Last Access details
Accounting and Miscellaneous
In this step we will maintained the following details
1) List of resources
2) Number of resources used
3) Priority details of each process
4) Scheduling details of each process
5) Different modification has been performed on the process


Q5(b) Differentiate between long term, medium term and short term scheduler


Long Term Scheduler Medium Term Scheduler Short Term Scheduler









Q5(c) Scheduler
Operating System must select the process from the queue in some fashion and selection of processes will be depend on the scheduler that will carries out the process in other word we can say that scheduler is a mechanism that carries out the scheduling activities

The scheduler can be classified into three categories
1) Long term scheduler
Long term scheduler which determines which programs are admitted to the system for execution and when and which ones should be executed. Long term scheduler will control the degree of multiprogramming and decides on which job or jobs to accept and turn into processes. The more jobs created and it make smaller to process a particular process. Long term scheduler provides satisfactory services to the current set of processes.
2) Middle term scheduler
Middle term scheduler will decide which processes suspended and resumed. Middle term scheduler will process based on resources they require. This scheduler will suspend the processes if no proper resource is found then process is suspended. It will act as medium term scheduler between resource and memory.
3) Short term scheduler
Short term scheduler shares the processor among the ready or running processes.the scheduler is very fast scheduler. if any process requires a resource that it is removed from the ready list and use a ready list data structure to identify ready processes.

There are following criteria to evaluate the scheduler
a) Scheduler Efficiency
As we know that scheduler will perform the process activities of the operating system. Scheduler is efficient then processes will be performed in perfect way. Scheduler should be able to take the overhead of the different processes that arrives in the Operating System
b) Waiting Time
The time is spent between Ready to run state of a particular process.In other word we can say that time between Ready State and Running State should be less. If time is less then processing will be fast otherwise system will be slow in processing of process.
c) Response Time
Response time is the time between Submission of request and first response to request. If the time between submission and first response to request is less then processing will be fast otherwise System performance will be down.
d) Throughput
Throughput means that number of processes will be completed per unit time. We can say that how many processes can be completed according to time period provided by the system.
e) Turnaround
Turnaround means that time has been between submission to completing the process. Turnaround time is less that mean system is performing the process fast and quickly.
f) CPU Utilization
In this criteria will design the scheduling in which CPU can be utilize in perfect way.
g) Proper Response
Scheduler should provide proper response to each process that mean each process should utilize the system resources.
h) Independent
Scheduler should treat each process as independent and each process can use the system resources properly. In other word we can say that each process should be handled individually.
i) Distribution
Scheduler should distribute the CPU Resource properly and fair that means scheduler should treat each process equally manner.
j) Proper Separation
Scheduler perform the proper separation between IO Bound process and CPU bound
process efficiently.




Scheduling Techniques

Scheduling is a technique that will decide how the process will be shifted from ready queue to CPU.Scheduling


Q10(a) What is time slicing ? How the time slicing duration affects the overall working of the system?

Ans . The period of time for which a process is allowed to run in a preemptive multitasking system is known as time-slicing.the scheduler is run once every time slice to choose the next process to run.if time slice is short then scheduler will consume too much processing time.
Time slicing improve the performance of the system in the following ways.

1) Prediction
Time-Slice will decide the time-period for all processes that will appear for the processing.Time given to each process is predicted earlier.
2) Equality
With the help of time slicing resources are provided to each process in equal manners.In other word we can say that fairness is provided to each process.
3) Minimize Overhead
Time-Slice will reduce the overhead of the process because time limit is given to each process.
4) Balance of Resources.
Time slicing will maintain the proper balance between different types of resources.
5) Enforcement of Rules
With the help of time slicing we can implement the rules on different resources required by each process.
6) Balance
Time-Slicing will maintain the balance between response and utilization from resources.
7) Throughput
Time –Slicing will increase the output of CPU
8) Avoid starvation
Time-Slicing will reduce the starvation of proceses. Time-Slicing will provide a time period to each process that has been placed in the ready queue.
9) Handle complex process
With the help of Time-slicing we can handle complex processes easily.
10) Reliable
Time-Slicing will provide reliable time allocation to each process in the case of any process failure.


10(b) Write short note on Virtual Memory

Virtual memory is the combination of RAM and temporary space available on your harddisk.When RAM get low then it will move the data from RAM to paging file that will free up the RAM. The virtual memory memory subsystem of a processor that will implements the virtual address spaces to each process


Q1 Explain the purpose and syntax of any two UNIX commands belonging to the following categories of commands
(a) Process Mangement
(b) System Administrator
(c) Directory Command
(d) Security and Protection
(e) Inter-user Communication
(f) Information Commands
(g) File Manipulation Commands
(a) Process Management
As we know that every process has a process identification number that is used as the index to the process table. The UNIX Operating System provides a number of System Calls for process management. In Unix Operating System fork system is used to create an identical copy of process. The Created process is called the child process and original process is called as the parent process. The process management use the following commands
i) kill Command
This command will send the specified signal to the specified process or grou
P of process. If signal is not specified the TERM signal is sent then TERM signal will terminate the process.
Syntax of kill command
kill Signal
In This command we can use the following options

kill –s This will specify the signal to send.The signal may be given as a signal name or number
kill –l This command will print a list of signal names.
kill –a This command will not restrict the commandname to process id conversion.
kill –p This command will print only process id and it will not send any signal
(ii) nice command
This command will run a program with changing or modified scheduling
Priorty.This command will be used to change the priority of a process.
Syntax
Nice options
This command can contains different options with it.
(i) –n
this option will increment the priority according to the number given by
us.
(ii) –help
This option will show the entire details about the nice command
(iii) – version
This option output version and exit
Finally we can say the process management is an important to find out the status of any process as well as working of any process that is working in the system.
(b) System Administrator
System administration play very important role when system is accessed by different users. The System administrator will perform the following task
i) Efficient utilization of the System’s Resources.
ii) Focus on different task performed by the user.
In System Administration we use the following commands
i) fsck
This command will check consistency and interactively repairs the file systems. This command has two components
1)generic component : This will contains all commands that can be applied to each file systems.In other word we can say that it can be implemented on each file system.
2) component It will conain specific commands that can be applied on selected file systems.

Syntax of fsck command
fsck [file system]
This command contains the following options inside it

Options Description
-f This option will specify the file system. If type is not specified than it will take the file system from predefine directory
-v This option will echo the completed command line.It will show the information about different devices that we have attached with the system.
-m This option will check the file system first of all. This option will return a code.If it is zero the file system is clean otherwise file system is not clean .
-y This command will give answering yes or no to all prompts provided by the command

w This option will check the file system has write access or not
p This option will run the command automatically in silent mode.

ii) wall command
This command will send a message to everybody’s terminal. The client who have login into the system will get the message send by the user.
Syntax of Wall command
Wall [Message]
This command will send the message to everyone user login in the system. The limit of message send to each user will be limited upto 20 characters.

(c) Directory Command
Directory commands are that commands that will work on the directory that is available in the system. We include the following commands inside the directory commands
i) rm
This command is used to remove files or directories. We can remove a file or group of files.
Syntax
rm [options] filename,directoryname

In this command we include the following options

Options Description
-d This option will remove the directory. If it is empty directoy
-f This option will ignore nonexistence files
-i This option will show a message before every file removal
-r This option will remove the contents of directories recursively
-help This option will provide the help about this command
-version This option will show the


ii) mkdir
this command will make a directory on the path that is given by the user.
Syntax of mkdir
mkdir [option] directory

In this command we can specify the following options
Options Description
-m This option will decide the mode of directory which we want to create
-p If there is parent directory the it will return true otherwise it will return false
-v This option will be used to provide the version
-help This option will provide the help about the command


The above two commands will be used to handle the directory

(d) Security and protection
As we know that UNIX is multi-user operating system in which each user generate a file and directory and we have to provide security and protection over the files and directories.There are three types of permissions given in UNIX operating system.
i) read Access
ii) Write Access
iii) Execute Access
Permissions are defined for three types of users
i) the owner of file
ii) the group that the owner belongs to
iii) other users
Security and protection use the following commands
(i) chmod
This command is used to modify the permissions.
Syntax f chmod
chmod permissions
(ii) chgrp
This command is used to change group ownership
Syntax
chgrp [option] group file

In this command we use the following options
Options Description
-c This option will report about the changes performed in files
-d It will the difference the file
-h It will report about the no difference between two files or directory
-f This option will show the error messages
-r This option will perform recursive option
-help This option will provide the help about this command

(e) Inter-User Communication
Inter-user communication means that two user will communicate with each other. Inter-User communication will ensure that two user are communicate with each other. Inter-User Communication will use the following commands

(i) mail
This command is used to send and receive the mail from one user to another user.
Syntax
mail username
In this command we will provide the following options
Options Description
-v This option will display details of delivery performed on user’s terminal
-i This option will ignore tty interrupt signals
_I This option will forces mail to run in interactive mode
-n This option will start reading the mail as we will start
The system
-s This option is used when we have to specify the subject at command line of UNIX
-c This option will send carbon copies to different users.
-b This option will send carbon copy to different users.
-f This option is used to forcely read the contents of a mail
(ii) mesg
This command is used to control write access to your terminal. This command will control the working and controlling of write operation on files,

Syntax
mesg (Y/N)

This command is very important to get the control over write access to a particular file or directory.

(f) Information commands
Using this command we will get the information about the system we are using . These commands are very important when we have to handle different facility provided by the system.

(i) cal
This command will show the calendar according the option provided by the user.
Syntax
cal –smjy13 [month][year]

In this command we will use the following options
Options Description
-1 This option will show single month name
-3 This option will display prev/current/next month output
-s This option will display Monday as the first day of the week
-m This option is used to show Monday of week
-j This option will display julian daes
-y This option will display a calendar for the current year.



(g) File manipulation commands
This command will be used to manipulate the files according to user requirement. File manipulation will include the following operations.
(a) Copying the files
(b) Renaming the file
(c) Modifying the file
(d) Delete the file

In File manipulation use the following commands
(i) cp command
This command is used to copy the file from one location to another location.
Syntax
cp source destination

In this command we apply the following options
Options Description
-b This option will make the backup of different files we car copying from one location to another location
-i This option will make a prompt before each file copying from one location to another location
-l This option will make the link between different files that we want to copy from one location to another location
-u This option will used if any file we are copying from one location to another location but that file is already exists.


(ii)mv command

This command is used to move the file from one location to another location.This command will shift the files from one location to another location. File or Directory is totally removed from the source from where it is copied.
Syntax
mv source destination
In This command we can implement the following options
Options Description
-i This will put prompt before each file or directory moving
-reply This option will reply about the files that has been reached to destination
-help This option will display help about this command
-version This option will handle the version of different files that we are using during file operations.










Q12
Write short notes on the following
(a) Highest Response Ratio Next Scheduling

HRRN is a non preemptive scheduling algorithm. This algorithm is similar to Shortest Job Next algorithm. In this algorithm priority is provided according to time required by each process to execute a particular process. This scheduling algorithm will optimized the normalized turnaround value. This algorithm is best for long processes that are waiting for processing for long time.
HRRN is calculated with the following formulae
HRRN=1+Waiting time/Estimated run time




Job Name Arrival Time Service Time Start Time Finish Time Turnaround Time Waiting Time Response Time
A 0 10 0 10 10 0 1.0
B 1 29 32 61 60 31 2.1
C 2 3 10 13 11 8 3.7
D 3 7 13 20 17 10 2.4
E 4 12 20 32 28 16 2.3
Mean 25 13 2.3

According to this example there are five processes A,B,C,D,E are there and each process contains a specific arrival time,service time and starting time and finish time after getting all details we can get easily the HRRN that will give the best ratio process to us.

Advantage
1) The task with the greatest response ratio is dispatched
2) No Starvation will happen for different processes.
3) This algorithm will prevent indefinite postponement.
Disadvantage
1) Every time service time is calculated when a service is processed.
2) Waiting time and response time is recalculated every time when one task has been dispatched
3) It will increase the overhead of the processor.
(b) Shortest Remaining Time Scheduling
This scheduling algorithm is a preemptive version of shortest job next algorithm. In this algorithm scheduler always dispatches the process the ready process which has the shortest expected remaining time to complete. The dispatching decision will be depend when a new process is submitted then current process remaining time will be compared with new process time which one is short will be processed first. If the new process contains short time then current process will be blocked and new process will sent to dispatching and processing.


Process Arrival Time Burst Time
P1 0.0 7
P2 2.0 4
P3 4.0 1
P4 5.0 4


Gantt. Chart

P1 P3 P2 P4
0 7 8 12 16

Average Waiting Time=(0+(8-2)+(7-4)+(12-5)/4=4


Advantage
1) Short processes are handled very quickly
2) The system will take less overhead when new process arrived for processing
3) It will decreases the average turnaround time

Disadvantage
1) It can generate process starvation for the process that contains large time for completing
2) When two process contains the same remaining time then it will increase the overhead for the processor


(c) Thrashing
Thrashing will happens when we have limited number of resources that are not satisfying the request arrives from different user. when a process make a request to operating system for a particular resource then operating system will try to find that resource which has been taken already by another process at this time new process will not be satisfied. This condition will take to thrashing .

Reason for Thrashing
There are basically two reasons for Thrashing
a) Insufficient memory at a given level in memory hierarchy
b) The program does not understand the location of the reference then memory system will replace one block again and again that will reduce the performance of the system.

Protection from Thrashing
a) Thrashing can be protected by reducing the level of multiprogramming
b) Thrashing can be reduced by adding more memory
c) Implement Local Page Replacement Algorithms
d) Providing the frame according to the requirement of the user.
e) Reducing the Access time can protect the Thrashing

Finally we san say the as the uses of system resources increases that will reduce the performance of the system.










(d) System Call
System call is a mechanism by which we will make a request to operating system for performing a particular task .The request will be performed in predefine manner that is easy to understand by operating system. The System call will make an interface between a process and operating system.

Advantage provided by System call

a) We can activate any program easily
b) We can perform different operation on different files associated with file
c) We can Terminate any ongoing program
d) We can use System call to switch the data from one system to another system easily
e) We can perform read, write operation on a particular device.

Types of System Call

1) Process Controlling System call
The process Controlling System call is system calling in which we perform the following task
a) Starting of any process
b) Ending of process
c) Loading of program
d) Executing the program
e) Changing the attributes of process
f) Retrieving the attributes of process
g) Providing memory to program
h) Free up the memory from program
Finally we can say that process controlling System call can be used to handle different task that are related to the process.


2) Device maintaining System call
Device Maintaining System call is that call by which we will manipulate different types of devices according to user requirement.In device maintaining System call we can perform the following task
a) Sending data to different devices
b) Receiving data from different devices
c) Attaching device with system
d) Logically disconnect the device
e) Changing device functions
f) Manipulate device function

3) File Manipulation System call
File Manipulation System call that call by which we can manipulate the file according to user requirement. With the help of file manipulation System call we can perform the following task
a) Creating a file
b) Renaming a file
c) Deleting a file
d) Opening a file
e) Reading from a file
f) Writing to a file
g) Changing a file attributes
h) Getting a file attributes



4) Interfacing System call
Interfacing System call is that call by which we will make interface with different system or different users. Interface system call perform the following tasks
a) Creating the communication
b) Removing the communication
c) Sending the message
d) Receiving the message
e) Exchange the information between users
f) Communication between remote computer and general computer
g) Exchange status information between systems



5) System resources manipulation System call
System Resources manipulation System call is that call by which we will perform the manipulation of system resources.In this call we can perform the following functions


a) Getting System date and time
b) Setting System date and time
c) Getting process file
d) Setting process file
e) Getting system date
f) Setting System date

Q19(a) What are the benefits of multi-programming ?

Ans :-
Multi-programming is a method in which different program running at the same time.
Or we can say that we will allocate system resources to more than one concurrent application ,job or users.
Multi programming provides the following advantages
1) More efficient use of computer time:
If we have one computer that is running a single process and there are different types of input and output is required then CPU will remain idle most of time. But in multiprogramming more than one program are running concurrently suppose one program is accepting the input from the user then CPU will remain busy with another process processing. This will utilize the CPU time to get the better and best result from the CPU.
2) Increased Throughput
Multiprogramming will provide the throughput better and best because CPU will not wait for a particular process to provide the output. When CPU will process multiple user request then output will be much better and fast. Suppose there are two jobs that arrived for processing with different types of length then CPU will process them with efficient manner with proper utilization of system resources.
3) Multiple user
Multiprogramming support multiple user request that arrive for processing , Multiprogramming will treat the individual user request as a single process. we can say simply multiple user request can be processed.
4) Memory Management
Multiprogramming will use the memory in proper way. In multiprogramming we will provide separate memory to each process that arrived for processing. Multiprogramming will handle the memory according to the application size and memory requirement
advan
5) Efficient Resource Utilization
With the help of Multiprogramming we can use the resources efficiently. Multiprogramming will use the system resources better in the comparison of uniprogramming For Example

Resources Uniprogramming Multiprogramming
Processor Use 20% 40%
Memory Use 33% 67%
Disk Use 33% 67%
Printer Use 33% 68%
Elapsed Time 30Min 15Min
Throughput 6jobs/hr 12jobs/hr
Mean Response Time 18 min 10 min


According to the example we can see easily the difference between Uniprogramming and multi programming
In uniprogramming Resources are remain idle for time period and in multiprogramming resources are used in proper way and best utilization of resources is done

6) Mean response time
Mean Response Time means that how time is taken to execute the program and show the final output to the user. When multiprogramming is used then mean response time is reduced.
7) Elapsed time Reduction
When we use the multiprogramming then Elapsed time is reduced. In multi programming time will be reduced to half of time that is taken by uni-programing.
8) Better scheduling
When we use multi-programming then we can perform better scheduling of processes . CPU has better choice to take better scheduling to get the final output to us.





Q19(b) What are the advantages of “Multiprocessing/Parallel systems”
Ans
Parallel Systems
In Parallel system we will use multiple resources to solve a computational problem.
In Parallel system Multiple CPU is used and each problem is breeaken into different parts and each part is solved separately. When a problem is sub divided then sub-part is again sub divided into instruction and instruction will be executed on individual system.












According to the diagram a single problem is sub-divided into five different parts and each part is handled separately. When a problem is sub-divided then processing will be fast.

Advantage of Parallel System

1) Multi Task
With the help of multi-tasking we can execute multiple task at the same time.
As we know that when we have multiple CPU the multiple task can be performed

2) Save Time
Multi-processing will save the time that we will waste in processing multiple task separately. In other word we can say the time which we will waste to process each process separately the will be processed at the same time.

3) Save Money
Multi-processing can be implemented with cheap, commodity components.
Because single resource can be shared by multiple users.

4) Solve large problems
With the help parallel system we can solve large problem easily by dividing the problem into small parts and each part is handled separately.

5) Provide Concurrency

Parallel processing will provide concurrency to process multiple process equally.
6) use of non-local resources
Parallel processing provide the facility to use the non-local resources that is used in remote computer
7) Limits to serial computing
Parallel system will limit the serial computing that means we can process multiple task equally.


Q20
What do you mean by paging? How address mapping is performed in paging technique? Also enumerate the advantages and disadvantages of paging.


Ans :
Paging is the algorithm that divides computer memory into small partitions and allocates memory using a page as the basic building block. The paging will perform the following task
1) Paging will make all chunk of memory the same size and each chunk will be 512 bytes
2) Paging will define the base address in page table about a particular process along with
Complete details about read and write operation
3) Paging will handle page number that will come directly from the address
4) Each page is free then it is automatically assign to the requested process
5) Swapping will happens between the pages when a particular process happens

Paging




According to the diagram paging will contains virtual address that contains two parts one part is page number and other part is offset address of the virtual memory. Virtual memory entry will be done in Page Table Entry that will contain the address details of Virtual Memory. Virtual Memory will contain the offset address of memory where the block of virtual memory will be stored.The physical memory will contain page table entry and offset address of virtual memory.

For Example

Page Number Program allocated to Physical Memory Address
0 Program A.0 1000:0000
1 Program B.1 1000:1000
2 Program C.2 1000:2000
3 Program D.3 1000:3000
4 Program E.4 1000:4000
5 Program F.5 1000:5000
6 Program G.6 1000:6000
7 Program H.7 1000:7000


According to this example each page allocation size is four kilobytes . Then allocation can be performed in the following order.
1. Program A requests 3 pages of memory
2. Program B requests 2 pages of memory
3. Program D requests 2 pages of memory
4. Program C terminates leaving 2 empty pages


Advantage of Paging

1) Single address space
Paging will use single address space to maintain the address of different types of memory
2) Swapping
In paging swapping is performed from page table to physical memory available to us.

3) A process can thrash at disk speed
A Process can be increased according to the disk speed. If disk speed is good that means processing will be fast other wise processing will be slow.

4) Security achieved by assigning pages to tasks and comparing
We can achieved the security by assigning the pages to disk when we will call the specific address that will be compared with specific address
5) Simple bit wise substitution
Simple bit wise substitution is performed that means we can manipulate a particular address according to the requirement of an application
6) Fixed size simplifies allocation and placement
What ever the block is prepared that will be fixed size and fixed size will be allocated to the individual process.
7) External fragmentation
In Paging external Fragmentation is not a problem
8) Valid Identification
Paging will use valid bit to detect references to page-out pages
Disadvantage of Paging
1) One shared virtual address space
Single Shared Virtual Address Space is used that will create a problem for different address to be maintained in the memory
2) Locality is slightly diminished
What ever the address will be allocated that will occupy the memory space that will diminish the local memory
3) Fixed size wastes space
When fixed size memory space is used. Suppose fixed size size of memory is 4Kilobytes then address stored there should of 4 bytes.if stored address size is less then it will waste the memory space.
4) Problem was so big it lead to a second approach
When any critical problem arrive then it will move another approach.



Q3(a) What do you understand by an operating System ? What are the major functions performed by an operating sytem.

Ans :
An operating System is a collection of programs that are executed continuously to perform a specific task. An Operating System will perform different types of tasks. Operating System will manage different resources available on the system. As we know that a computer is an hardware that does not perform any specific task without the help of operating system. An operating system will accept request that is arriving from different resources and devices that has been attached with the system. An Operating system will handle different types of hardware which we attached with the system.
There are following functions performed by the Operating System.

a) One or more user interface shells, which can be either graphical user interfaces (GUIs) or commandline
interfaces (CLIs),

b) The facility to load and execute (and, if necessary, to abort and recover from) user processes,

c) One or more application program interfaces (APIs), a set of system call functions,

d) The facility to communicate with a variety of input/output (I/O) devices, one or more file systems,

e) The facility to share the computer’s resources between two or more user processes in a fair way,

f) A communications infrastructure to support message passing between processes,

g) Background record-keeping that keeps track of resource usage per user process,

h) Protection and security so that user processes and Data are kept as free as possible from undesired interference.


Q3 (b) Enumerate important characteristics of a good operating system and also discuss the responsibilities of an operating system as a resource manager.
Ans.

There are following characteristics are used for operating system.
a) Layered Structure
Operating system will use different types of layered concepts.
b) Microlernel Architecture
As we know that operating system use Microkernel Architecture is used to handle different types of
hardwares we attached with the system. It will handle address space, inter process communication and basic scheduling used in operating system. User can implement different other types of services.
c) Multithreading
Operating system should be capable to handle different processes simultaneously.
d) Threading
As we know that thread dispatchable unit of work and executed sequentially. Thread is executed as interrupted is activated.
e) Symmetric multiprocessing
In symmetric processing multiple processors will be implemented on the system. That can process multiple task equally and all processes share the input and output that has been attached with the system.
f) Distributed Operating System
Operating system can handle different types of processes that are arriving from different types of user or we can say that resources are distributed to different users. Distributed Operating System will distribute file system and shared memory.
g) Object Oriented Design
Operating System will add modular concepts to small microkernel system. When modular concepts are added then we can handle different requests arrives from different users.


There are following responsibilities performed by the Operating System.
a) Services
Different types of Services that operating system provides to programs. Services will include providing resources and different input and output devices.
b) Program execution
Operating System will provide the services to execute different types of programs. Providing memory to different programs
c)Input Outpput operations
Operating System perform Input Output operations with different types of peripheral devices we have attached with system.Operating Directly take input and output to peripheral devices.As we know that any program can not access peripheral devices directly that why operating system service is required by any devices.
d) File system manipulation
With the help of operating system we can perform different types of file manipulation task. Like file creation, deletion, reading, writing, and directory
e) Communication
Operating System will communicate with different system as well as it will exchange the data between processes. Operating System will use message passing service between processes and share the memory between them.
f) Fault detection
In this function we will find the fault that can arrive with CPU,Input output devices and different types of user programs. Operating System will perform a appropriate reactions to that fault.
g) Orientation
Operating System will design for the function of the system.It will not be user-oriented.
h) Resource allocation and freeing
Operating System will handle the process of resource allocation and freeing the resources that has been allocated to different processes.
i) Accounting
Operating System will maintain the account how long a particular resource has been used and what ever resources has been for a particular process.
j) Protection and security
Operating System will protect the System resources and different devices we attached with the system.




Q Give an overview of different types of operating system
Ans .
There are following types of operating System available.



Q what is an operating system structure ? Compare important operating system structures.
Ans :

Operating System structure will decide how an operating system has been design to handle different resources has been installed. Structure will include different parts included in operating system.

According to the diagram there are different parts included in operating system structure.
1) Command Interpreter
Command Interpreter will understand different commands issued by the user. The command can be given in the form of event and action on the window.
2) Error Handling
Error Handling means that there is any error in an operating system then it can be handled easily.
Error handling can be related to hardware and software.
3) Protection System
Protection System means that we use some authentication concepts to protect the system from illegal access of operating system.
4) Process Management
Process management means that how process will be handled and how the process will be arranged to execute them in a particular sequence.
5) Input Output System
Input Output System means that input and output will be handled perfectly. Input can be taken from input devices and it can be taken from external file. Output can be processed in the form of report and report can be display on printer.
6) Memory Management
Memory Management means that we will handle memory. Memory management will include memory operation like memory allocation,replication,recovery,removing and different other operation we can perform.
7) Accounting
Accounting means that operating system will maintain different types of account like userid,user rights, user access list.
8) Networking
Networking structure we will handle networking which we perform between different computers.

There are following types of operating system structures.
1) Layered Structure Approach
The components of layered operating system are organized into modules and layers them one on top of the other. Each module provide a set of functions that other module can call. Interface functions at any particular level can invoke services provided by lower layers but not the other way around. The layered operating system structure with hierarchical organization of modules


According to diagram application program will interface with system services. System services will understand user mode and kernel mode. Kernel mode will be understand by System Services. System services will make interface with File System. File System will handle memory and input and output management. Memory and input/Output management will make interface with processor scheduling and hardware we attached with the system.

Advantage
1) Each layer will provide access to only to lower-level interface
2) It required limited amount of code
3) N layer provides (N+1) services
4) It will starting debugging at lowest level until the whole system works correctly.
5) It will enhance the performance of operating system
6) Individual Layer can be replaced without effecting others parts of the system
Disadvantage
1) It provide low application performance
2) Making the difference between different layers if typical task.

2) Virtual Machine

Virtual Machine is next logical step of layered approach of operating system. Virtual machine in which any layer which are looking as hardware is best for current layer. Virtual machine will provide an interface that is identical to actual hardware, in other words we can say that it will provide an interface to different hardware in equal manner. Virtual machine will provide illusion of many processes which can be run at their own memory space. Virtual machine provides the facility to handle many processes that contains its own memory allocation. Client operating system in virtual machines is very simple because it perform single task and it is single user only. The resources of physical computer are divided into different parts and each part will create a virtual machine. In Virtual machine processors are shared between users then user will feel they have their own processor. Virtual machine provides the facility of card reader, disks and printers facility provided by virtual machine. Virtual machine will share disks between different processes and virtual machines. Virtual machine will use virtual network interface for communicating between virtual machines.Virutal machines will use Para virtualization that will provide compensate for virtual machines.

Advantage.
1) Protection
Virtual machines will provide perfect protection of system resources because machines are isolated virtually from each other.



2) Powerful base
It will provide powerful base for operating system research and development.
3) Efficient use
With the help of virtual machine we efficiently use the hardware attached with the system.

Disadvantage
1) No Direct Sharing of Data
With the virtual machine we can not share different resources or data directly.
2) Implementation
Implementation of virtual machine is complex task,
3) Cost
Virtual machine will increase the cost of implementation of virtual machines.

3) Client-Server Model
This is new concept in operating system. The basic idea behind client-server model is to divide the operating system into several processes, each of which implements a single set of services. For Example Input output server ,memory server and process server, thread interface server. Each server runs in user mode , provides services to the requested client. The client which can be either another operating system component or application program. The client will request a service by a message. The message will be identified by operating system and service is provided according to the message.









According to this model there are three layer
a) User Interface
User interface will include the following options inside it.
i) Client Application
Client application is an application by which user will interface with hardware that has been attached with the system. Client application will contains all common options that can be used by a user easily.
ii) PEACE threads interface
It will provide threads interface facility by message passing between two process,
iii) File Server
File Server is a server that will maintain different types of files that will placed by the user. File server will perform the following operations.
1) File Creation
2) File Deletion
3) File Updation
4) File Modification
iv) Display Server
Display server will handle all processes that is required to display objects on the window. Display server will accept the input from the keyboard and process them and show the output to the window.

b) Microkernel
Microkernel Approach
Microkernel approach by which we will make direct interface with system hardware. Kernel Approach
Will be used to Create, Delete any process with user requirement. With the Microkernel approach we can handle process management, memory management, file management and input/output management will be handled by kernel approach. Microkernel approach will make interprocess communication that means one process can interact with other process by sending message from one process to another process. As we know that Unix operating system use three layers to interact with hardware.

Advantage
1) Easier to extend
With the help of Microkernel approach we can extend the hardware and different other services that has been attached with the system.
2) Easier to port to a new architecture
Microkernel approach provides the facility by which we can shift from one port to another port without any type of specific software requirement. In other word we can say that we can easily port to new architecture.
3) More Robust
If there any error in kernel that can be removed easily because there are less code available in kernel. Due to less coding we can easily detect numbers of errors arriving in kernel
4) More Secure
It is more secure because proper authentication is performed. The authentication will be done with the help of user name and password assign to the process.
5) Simplified based Operating System
Microkernel approach is simplified operating system in which we can use simple commands to make interface with system.
6) Improved Reliability
Microkernel approach will improve reliability of the system that means if one process is not working the other process will handle the work load of that process.
7) Message Passing facility
Microkernel provides message passing facility between different processes. All process will communicate with another process by sending the message to that process.
8) Base for modulation and portable extension
Microkernel provides that base for modulation and portable features of an operating system. Using this facility we can divide a operating system into different sub parts and each sub part will perform a specific task. Portability means that any device can be added to the operating system without any type of specific software requirement.
c) Hardware
Hardware is electronics devices that can accept input and process the output according to the requirement of the user.

















Q How layered structure approach differs from kernel approach Explain.
Layered Approach Kernel Approach
1) Operating System is divided into layers 1) Operating System is not divided into layers.
2) Each Layer will use the service of lower layer 2) It will communicate with different hardware we has attached with the system
3) It will contain six Layers
i) Application Programs
ii) System Services
iii) File System
iv) Memory and I/O Device Management
v) Process Scheduling
vi) Hardware 3) It will use three parts
i) User Mode
ii) Kernel Mode
iii) Hardware
4)It can not be extended easily 4) It can be extended easily.
5) It will contains more coding 5) It will contain less coding
6) Debugging process is slow 6) Debugging process is fast.
7) It can not be converted into new architecture 7) It can be converted into new architecture
8)It is less secure 8) It is more secure
9)Modularity concept is used 9) Modularity concept is not used.
10) Message passing is not used. 10) Message passing is used.
11) modules can not be moved from kernel to user level 11) Modules can be moved from kernel to user level.
12) For Example OS/2 12) For Example MacOS



Q What is fragmentation? What are different types of fragmentation? How each of these can be overcome? Explain.

Ans
A condition in which individual files on a disk are not contiguous but are broken up in pieces scattered around the disk and a condition in which the free space on a disk consists of little bits of free space here and there rather than only one or a few free spaces. Fragmentation is process in which file or data will occupy the memory space that space is not in continuously manner. In other word we can say that memory space will be occupied by a particular file in scatter manner.
Fragmentation can be classified into two categories
a) External Fragmentation
External Fragmentation exists when there is sufficient space to satisfy a request but the available space not in continuous manner. In External Fragmentation small memory space exits in memory that can not full fill the requirement of a particular request. A large storage is divided into different small holes.
b) Internal Fragmentation










Q What is file system? What are the main responsibilities of a file system? Where is file system located in layered organization of operating system?

Ans:
File system contains different types of utility programs that are executed as privileged applications. Input to file can be given from a particular file or it can be accepted from any input device attached with the system and output from file system will be stored in a file. The file in which we will store the output can be used for long-term storage.
File System In Layered Form













According to this diagram there are different types of layered is used in file system.
1) Application Programs
This is program that will be executed by the user to perform interaction between file and storage device in
which we have store the file. Application Programs can be design according to the requirement of the user.
2) Logical File System
Logical File System is a system in which we will decide how a particular file will be arranged on physical
storage. Logical File System will decide format ,accessing techniques and different other concepts that are
related to file.
3) File Organization Module
File Organization module will decide which concepts we are using to store a particular file on the storage.
We are storing a file in sequential order,index order ,random way.
4) Basic file System
Basic file system will decide which types of operation we can perform on file system.
5) Input output Control
In input output control we will handle input that is given to a particular file and output will be handled by a proper file system. Input and output control will be decide by Operating system we will implement on the system
6) Devices
We will implement different types of devices attached with the system.



Main responsibilities of file system

1) It will provide a convenient naming system for files
2) It will provide standardized set of input and output interface routines.
3) It will enforce access control in a multi-user environment
4) It will optimize the performance of file access
5) It will handle variety of storage devices.
6) It will maintain the consistency of files.
7) It will reduce the chance of losing data or files.
8) It will support System administrator for system backup



Q what do you understand by file protection and security? Explain the various file protection methods/strategies.

Ans
File Protection
File Protection means we will protect the file system from mischievous, intentional violation of an access restriction by a user. Protection is done to improve the reliabilities of system.

Principles behind protection
1) least privilege
It will decide the program,users and even systems has been given enough privileges to work on them.
2)