Professional Documents
Culture Documents
1unit4 Notes
1unit4 Notes
1unit4 Notes
An operating system (OS) is the program that, after being initially loaded into the computer by a boot program,
manages all of the other application programs in a computer. The application programs make use of the operating
system by making requests for services through a defined application program interface (API). In addition, users
can interact directly with the operating system through a user interface such as a command line or a graphical
user interface (GUI).
•Processor Management: This deals with management of the Central Processing Unit (CPU). The operating
system takes care of the allotment of CPU time to different processes. When a process finishes its CPU
processing after executing for the allotted time period, this is called scheduling. There are various type of
scheduling techniques that are used by the operating systems:
1.Shortest Job First(SJF): Process which need the shortest CPU time are scheduled first.
2.Round Robin Scheduling: Each process is assigned a fixed CPU execution time in cyclic way.
3.Priority Based scheduling (Non Preemptive): In this scheduling, processes are scheduled according
to their priorities, i.e., highest priority process is schedule first. If priorities of two processes match,
then schedule according to arrival time
•Device Management:
The Operating System communicates with hardware and the attached devices and maintains a balance
between them and the CPU. This is all the more important because the CPU processing speed is much
higher than that
of I/O devices. In order to optimize the CPU time, the operating system employs two techniques –
Buffering and Spooling.
•Buffering:
In this technique, input and output data is temporarily stored in Input Buffer and Output Buffer. Once the
signal for input or output is sent to or from the CPU respectively, the operating system through the device
controller moves the data from the input device to the input buffer and for the output device to the output
buffer. In case of input, if the buffer is full, the operating system sends a signal to the program which
processes the data stored in the buffer. When the buffer becomes empty, the program informs the operating
system which reloads the buffer and the input operation continues.
•Spooling (Simultaneous Peripheral Operation on Line):
This is a device management technique used for processing of different tasks on the same input/output
device. When there are various users on a network sharing the same resource then it can be a possibility
that more than one user might give it a command at the same point of time. So, the operating system
temporarily stores the data of every user on the hard disk of the computer to which the resource is attached.
The individual user need not wait for the execution process to be completed. Instead the operating system
sends the data from the hard disk to the resource one by one.
Example: printer
•Memory management:
In a computer, both the CPU and the I/O devices interact with the memory. When a program needs to be
executed it is loaded onto the main memory till the execution is completed. Thereafter that memory space
is freed and is available for other programs. The common memory management techniques used by the
operating system are Partitioning and Virtual Memory.
•Partitioning:
The total memory is divided into various partitions of same size or different sizes. This helps to
accommodate number of programs in the memory. The partition can be fixed i.e. remains same for all the
programs in the memory or variable i.e. memory is allocated when a program is loaded on to the memory.
The later approach causes less wastage of memory but in due course of time, it may become fragmented.
•Virtual Memory:
This is a technique used by the operating systems which allow the user can load the programs which are
larger than the main memory of the computer. In this technique the program is executed even if the
complete program can not be loaded inside the main memory leading to efficient memory utilization.
•File Management:
The operating System manages the files, folders and directory systems on a computer. Any data on a
computer is stored in the form of files and the operating system keeps information about all of them using
File Allocation Table (FAT). The FAT stores general information about files like filename, type (text or
binary), size, starting address and access mode (sequential/indexed sequential/direct/relative). The file
manager of the operating system helps to create, edit, copy, allocate memory to the files and also updates
the FAT. The operating system also takes care that files are opened with proper access rights to read or edit
them.
Advantages of RTOS:
•Maximum Consumption: Maximum utilization of devices and system,thus more output from all the
resources
•Task Shifting: Time assigned for shifting tasks in these systems are very less. For example in older
systems it takes about 10 micro seconds in shifting one task to another and in latest systems it takes 3 micro
seconds.
•Focus on Application: Focus on running applications and less importance to applications which are in
queue.
•Real time operating system in embedded system: Since size of programs are small, RTOS can also be used
in embedded systems like in transport and others.
•Error Free: These types of systems are error free.
•Memory Allocation: Memory allocation is best managed in these type of systems.
Disadvantages of RTOS:
•Limited Tasks: Very few tasks run at the same time and their concentration is very less on few applications
to avoid errors.
•Use heavy system resources: Sometimes the system resources are not so good and they are expensive as
well.
•Complex Algorithms: The algorithms are very complex and difficult for the designer to write on.
•Device driver and interrupt signals: It needs specific device drivers and interrupt signals to response
earliest to interrupts.
•Thread Priority: It is not good to set thread priority as these systems are very less prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging systems, industrial
control systems, weapon systems, robots, air traffic control systems, etc.
Note: Main difference between multiprogramming and time sharing is that multiprogramming is the effective
utilization of CPU time, by allowing several programs to use the CPU at the same time but time sharing is the
sharing of a computing facility by several users that want to use the same facility at the same time. Each user on
a time sharing system gets her own terminal and gets the feeling that she is using the CPU alone. Actually, time
sharing systems use the concept of multiprogramming to share the CPU time between multiple users at the same
time.
Popular OSs:
• Windows is Microsoft’s flagship operating system, the de facto standard for home and business
computers. Introduced in 1985, the GUI-based OS has been released in many versions since then. The
user-friendly Windows 95 was largely responsible for the rapid development of personal computing.
•Mac OS is the operating system for Apple's Macintosh line of personal computers and workstations.
•Unix is a multi-user operating system designed for flexibility and adaptability. Originally developed in
the 1970s, Unix was one of the first operating systems to be written in C language.
•Linux is a Unix-like operating system that was designed to provide personal computer users a free or
very low-cost alternative. Linux has a reputation as a very efficient and fast-performing system.
DATABASE MANAGEMENT SYSTEM
Database is a collection of related data and data is a collection of facts and figures that can be processed to
produce information.
Mostly data represents recordable facts. Data aids in producing information, which is based on facts. For
example, if we have data about marks obtained by all students, we can then conclude about toppers and average
marks.
A database management system stores data in such a way that it becomes easier to retrieve, manipulate, and
produce information. Following are the important characteristics and applications of DBMS.
•ACID Properties − DBMS follows the concepts of Atomicity, Consistency, Isolation, and Durability
(normally shortened as ACID). These concepts are applied on transactions, which manipulate data in a
database. ACID properties help the database stay healthy in multi-transactional environments and in case
of failure.
•Multiuser and Concurrent Access − DBMS supports multi-user environment and allows them to
access and manipulate data in parallel. Though there are restrictions on transactions when users attempt to
handle the same data item, but users are always unaware of them.
•Multiple views − DBMS offers multiple views for different users. A user who is in the Sales department
will have a different view of database than a person working in the Production department. This feature
enables the users to have a concentrate view of the database according to their requirements.
•Security − Features like multiple views offer security to some extent where users are unable to access
data of other users and departments. DBMS offers methods to impose constraints while entering data into
the database and retrieving the same at a later stage. DBMS offers many different levels of security
features, which enables multiple users to have different views with different features. For example, a user
in the Sales department cannot see the data that belongs to the Purchase department. Additionally, it can
also be managed how much data of the Sales department should be displayed to the user. Since a DBMS
is not saved on the disk as traditional file systems, it is very hard for miscreants to break the code.
DBMS vs. Flat File:
DBMS Flat File Management System
Multi-user access It does not support multi-user access
Design to fulfil the need for small and large businesses It is only limited to smaller DBMS system.
Remove redundancy and Integrity Redundancy and Integrity issues
Expensive. But in the long term Total Cost of
It's cheaper
Ownership is cheap
Easy to implement complicated transactions No support for complicated transactions
Users of DBMS:
A typical DBMS has users with different rights and permissions who use it for different purposes. Some users
retrieve data and some back it up. The users of a DBMS can be broadly categorized as follows −
Administrators − Administrators maintain the DBMS and are responsible for administrating the database. They
are responsible to look after its usage and by whom it should be used. They create access profiles for users and
apply limitations to maintain isolation and force security. Administrators also look after DBMS resources like
system license, required tools, and other software and hardware related maintenance.
•Designers − Designers are the group of people who actually work on the designing part of the database.
They keep a close watch on what data should be kept and in what format. They identify and design the
whole set of entities, relations, constraints, and views.
•End Users − End users are those who actually reap the benefits of having a DBMS. End users can range
from simple viewers who pay attention to the logs or market rates to sophisticated users such as business
analysts.
Applications of DBMS:
Disadvantage of DBMS:
DBMS may offer plenty of advantages but, it has certain flaws-
•Cost of Hardware and Software of a DBMS is quite high which increases the budget of your
organization.
•Most database management systems are often complex systems, so the training for users to use the
DBMS is required.
•In some organizations, all data is integrated into a single database which can be damaged because of
electric failure or database is corrupted on the storage media
•Use of the same program at a time by many users sometimes lead to the loss of some data.
•DBMS can't perform sophisticated calculations
Data models:
Data models define how the logical structure of a database is modeled. Data Models are fundamental entities to
introduce abstraction in a DBMS. Data models define how data is connected to each other and how they are
processed and stored inside the system.
The very first data model could be flat data-models, where all the data used are to be kept in the same plane.
Earlier data models were not so scientific, hence they were prone to introduce lots of duplication and update
anomalies.
Entity-Relationship Model:
Entity-Relationship (ER) Model is based on the notion of real-world entities and relationships among them.
While formulating real-world scenario into the database model, the ER Model creates entity set, relationship set,
general attributes and constraints.
ER Model is best used for the conceptual design of a database.
ER Model is based on −
•Entities and their attributes.
•Relationships among entities.
These concepts are explained below.
Relational Model
The most popular data model in DBMS is the Relational Model. It is more scientific a model than others. This
model is based on first-order predicate logic and defines a table as an n-ary relation.
The main highlights of this model are −
•Data is stored in tables called relations.
•Relations can be normalized.
•In normalized relations, values saved are atomic values.
•Each row in a relation contains a unique value.
•Each column in a relation contains values from a same domain.
Hierarchical Model:
In a Hierarchical database, model data is organized in a tree-like structure. Data is Stored Hierarchically (top
down or bottom up) format. Data is represented using a parent-child relationship. In Hierarchical DBMS parent
may have many children, but children have only one parent.
Network Model:
The network database model allows each child to have multiple parents. It helps you to address the need to
model more complex relationships like as the orders/parts many-to-many relationship. In this model, entities are
organized in a graph which can be accessed through several paths.
Object-Oriented Model:
In Object-oriented Model data stored in the form of objects. The structure which is called classes which display
data within it. It defines a database as a collection of objects which stores both data members values and
operations.
DBMS Architecture:
•The DBMS design depends upon its architecture. The basic client/server architecture is used to deal with
a large number of PCs, web servers, database servers and other components that are connected with
networks.
•The client/server architecture consists of many PCs and a workstation which are connected via the
network.
•DBMS architecture depends upon how users are connected to the database to get their request done.
1-Tier Architecture:
•In this architecture, the database is directly available to the user. It means the user can directly sit on the
DBMS and uses it.
•Any changes done here will directly be done on the database itself. It doesn't provide a handy tool for
end users.
•The 1-Tier architecture is used for development of the local application, where programmers can directly
communicate with the database for the quick response.
2-Tier Architecture:
•The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications on the
client end can directly communicate with the database at the server side. For this interaction, API's
like: ODBC, JDBC are used.
•The user interfaces and application programs are run on the client-side.
•The server side is responsible to provide the functionalities like: query processing and transaction
management.
•To communicate with the DBMS, client-side application establishes a connection with the server side.
3-Tier Architecture:
•The 3-Tier architecture contains another layer between the client and server. In this architecture, client
can't directly communicate with the server.
•The application on the client-end interacts with an application server which further communicates with
the database system.
•End user has no idea about the existence of the database beyond the application server. The database also
has no idea about any other user beyond the application.
Example: In the given table Stud ID, Roll No, and email are candidate keys which help us to uniquely identify
the student record in the table.
StudID Roll No First Name LastName Email
1 11 Tom Price abc@gmail.com
2 12 Nick Wright xyz@gmail.com
3 13 Dana Natan mno@yahoo.com
What is the Foreign key?
A foreign key is a column which is added to create a relationship with another table. Foreign keys help us to
maintain data integrity and also allows navigation between two different instances of an entity. Every
relationship in the model needs to be supported by a foreign key.
Example:
DeptCode DeptName
001 Science
002 English
005 Computer
Teacher ID Fname Lname
B002 David Warner
B017 Sara Joseph
B009 Mike Brunton
In this example, we have two table, teach and department in a school. However, there is no way to see which
search work in which department.
In this table, adding the foreign key in Deptcode to the Teacher name, we can create a relationship between the
two tables.
Teacher ID DeptCode Fname Lname
B002 002 David Warner
B017 002 Sara Joseph
B009 001 Mike Brunton
This concept is also known as Referential Integrity.
SQL:
SQL is a database computer language designed for the retrieval and management of data in a relational
database. SQL stands for Structured Query Language.
SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data
stored in a relational database.
SQL is the standard language for Relational Database System. All the Relational Database Management Systems
(RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL Server use SQL as their standard
database language.
Also, they are using different dialects, such as −
•MS SQL Server using T-SQL,
•Oracle using PL/SQL,
•MS Access version of SQL is called JET SQL (native format) etc.
SQL Architecture:
SQL Commands
The standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT, UPDATE,
DELETE and DROP. These commands can be classified into the following groups based on their nature −
DDL - Data Definition Language: DDL is short name of Data Definition Language, which deals with database
schemas and descriptions, of how the data should reside in the database.
ALTER
2
Modifies an existing database object, such as a table.
DROP
3
Deletes an entire table, a view of a table or other objects in the database.
DML - Data Manipulation Language: DML is short name of Data Manipulation Language which deals with
data manipulation and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE,
etc., and it is used to store, modify, retrieve, delete and update data in a database.
SELECT
1
Retrieves certain records from one or more tables.
INSERT
2
Creates a record.
UPDATE
3
Modifies records.
DELETE
4
Deletes records.
GRANT
1
Gives a privilege to user.
REVOKE
2
Takes back privileges granted from user.
UPDATE table_name
SET column1 = value1, column2 = value2....columnN=valueN
[ WHERE CONDITION ];
USE database_name;