You are on page 1of 10

Q.NO.

2 ANSWER:

Types of Client Server Communication are:

 HTTP Push and Pull


 Ajax Polling
 Long Polling
 Server sent events
 Websockets
 Message queues

HTTP Push and Pull


Hypertext transfer protocol (http) is a communication protocol used for fetching
resources such as HTML documents, images, video files etc. It is the most common
client-server protocol on the internet. HTTP communication can be divided into two
types: HTTP pull and HTTP push.

HTTP pull is a style of communication whereby a client sends a message to a server


(usually called a request) and the server sends back a reply (called response) after
which the connection is closed. Anytime the client needs more information the process
is repeated over and over again. Application developers are responsible for deciding
how often to make requests for data from the server. The dilemma with polling is that
making continuous requests at short intervals means you get the most up to date
information from the server immediately its available but this risks overloading the
server with too many requests and most of the time the responses are empty because
there's no new info to display which means unnecessary traffic is created on the
network. On the other hand, making requests on longer intervals means that there's
less traffic but with the downside of possibly missing important updates from the server.

Ajax Polling
AJAX stands for Asynchronous JavaScript And XML. The last part (XML) is a little
misleading as nowadays Ajax is used along with other data formats such as JSON.
This is a technique in which a client, usually a web browser sends a request to a web
server and the server responds. Before requests can be sent the client has to establish
a connection to the web server. After the connection has been successfully established,
then requests can be sent. On receiving a request a server performs some processing
and sends back a response after which the connection is closed. This process is
repeated continuously to exchange data between the client and server. The process is
always initiated by the client. This means that even if the server has updates which the
client might be interested in, the updates can't be sent unless the client explicitly
requests updates. This mode of communication is not ideal for real-time applications
such as stock trading apps or chat apps where updates come frequently and users
require the most up to date information as soon as possible.
An advantage of polling is that it has almost universal support. It is used in traditional
web applications which do not require real time updates to clients e.g. a weather app.

Long Polling
This is more efficient than AJAX polling. In traditional polling, there's allot of overhead
due to the fact that the connection has to be created repeatedly any time the client
needs to make a request. Also the fact that a client has to make requests repeatedly in
order to check for new data creates a lot of unnecessary traffic, and adds to the load on
the server processing such requests. Considering the server is required to serve
several other clients, this repeated polling could become a problem.

With long polling, a client connects to a server makes a request and waits for a
response. After receiving the request, the server checks if it has any new data which
has not been already sent to the client. If there is, it sends the data to the client in its
response but if there isn't it does not send a response but rather it keeps the
connection open and waits till there is new data to be sent. Only then will a response be
sent down to the client. After receiving the response, the client then immediately sends
another request to the server and the process is repeated over and over again.

Long polling is like a simulation of http push communication because the client still has
to make the request but unlike normal polling the server does not have to respond if it
does not have any data to send. Doing this helps prevent clogging up the network with
unnecessary requests and responses and also saves the server from having to keep
processing requests even if there's nothing new to show. While this method frees up
the network it creates a lot of overhead in the server as it dedicates some of its
resources in order to keep the request connection open.

Server sent events


This is a mode of communication whereby, a server can automatically send updates
(data) or events to a client without the client explicitly making requests for it. The client
has to subscribe for those events though, which means an initial connection is first
established. After which the clients continuously receives updates in the form of events
from the server. Server sent events are suitable in apps like stock market applications
where the server receives a lot of updates in a short period of time.

Websockets
Websocket is a communication protocol just like HTTP. They are both compatible with
each other i.e. websockets was designed to work with HTTP proxies and a HTTP
connection can be upgraded to use websockets using the upgrade header. A
websocket connection provides the ability for two-way (full-duplex) communication
between the client and the server unlike HTTP which is one way (half-duplex). What
this means is that the client and server can send and revive messages at the same
time on the same connection, whereas in HTTP the server waits for the client to send a
request and then it sends its response (communication is done one at a time). An
advantage of websockets is they allow for bi-directional communication i.e. both client
and server can send messages at the same time. Websockets are suitable for chat
apps and online games.

Message queues
As mentioned earlier, the internet has to do with the sharing of data and resources.
Sometimes, several users, micro-services or clients may request the same resource at
the same time. Lets take the example of an application broken up into several services
i.e. the email service, password recovery, marketing, registration etc. In such an
application it is possible that the password recovery service, marketing service and
registration service may each need the email service to send several emails at the
same time but the email service can only send the emails one at a time. Message
queues are software designed to handle such situations.
Message queues allow for asynchronous communication between several components
or services. When using message queues, there are two types of components: the
producers which create messages or send requests and the consumers which process
those requests.

In the example we discussed above, the password, marketing and registration services
are the producers making requests while the email service is the consumer whose job it
is to process those requests i.e. send the emails.
In such a system, a delay by the consumer will not affect the producers as they send
their messages to the queue and continue processing other tasks. The message queue
ensures that the consumer receives the messages. Even if the consumer is down for
one reason or the other, the message is kept in the queue until the consumer is back
up and able to process the messages meant for it. This ensures reliability and a
synchronicity. Some examples of message queues include RabbitMQ, Apache Kafka,
Axon etc.

Conclusion
In conclusion, the mode of communication is a very important factor in the client server-
architecture as it determines how interactive applications will be and how much
resources are consumed on the network and on the server. Nowadays, users want to
be able to view the latest information as soon as it is available. For example on
facebook feeds, stock applications and chat apps. In such applications, pull
communication won't be the most effective form of communication as data changes
quickly and there is potential to miss some updates. Which is why server push methods
have become increasingly popular that is apart from the fact that push methods are
also less resource intensive than pull methods. That is not to say that pull
communication is completely useless as there are still situations where it is a better
option just like the weather application mentioned.
Q.NO. 3 ANSWER:

Client side component:

Client-side development is a type of development that involves programs that run on a client
or user's device. Client-side developers focus on creating the part of a website that the user
can interact with. Sometimes, client-side development is also referred to as front-end
development, as it focuses on the "front" part of an application that users can see. Client-
side developers complete a variety of tasks, including:

 Creating website layouts


 Designing user interfaces
 Adding form validation
 Adding visual elements like colors and fonts

People in careers like web design and user experience design focus on client-side
development. Client-side developers use specific programming languages. Some common
client-side languages include:

 HTML: HTML, which stands for Hypertext Markup Language, is a markup


language that is the standard language for web development. HTML builds a
website's structure and renders a website in a browser.
 CSS: CSS, which stands for Cascading Style Sheets, is a design language that
developers can use to add visual design elements to a website coded in
HTML. Developers can use CSS to make their websites look visually
appealing on users' devices.
 JavaScript: JavaScript is a scripting language that developers can use for
web development, web applications and other purposes. Developers can use
JavaScript to make websites dynamic and interactive.
 VBScript: VBScript is a general-purpose, client-side scripting language
supported by some browsers. Developers can use VBScript to add interactive
elements to websites.

Server Side Component:


Server-side development is a type of development that involves programs that run on a
server. Server-side developers focus on behind-the-scenes development, and server-side
development is also referred to as "back-end" development. This type of programming is
important because web browsers, or clients, interact with web servers to retrieve
information. Common server-side tasks include:

 Coding dynamic websites


 Developing web applications
 Connecting websites to databases

Software developers, database administrators and web developers typically use server-side
development. Server-side developers can use many different programming languages,
including:

 Java: Java is an object-oriented programming language that developers can


use for a variety of purposes, including software and application
development. Java is one of the most popular server-side programming
languages.
 Python: Python is an object-oriented, general-purpose programming
language that developers can use for web development, application
development, operating systems and other purposes. Python has
applications in data science, finance, computing and other fields.
 SQL: SQL, which stands for Structured Query Language, is the industry-
standard language for interacting with databases. Developers can use SQL
to manipulate data in databases, including updating, retrieving and deleting
data.
 PHP: PHP, which stands for Hypertext Preprocessor, is a scripting language
developers use to create websites and web applications. PHP can connect to
databases to display their content on websites.

Q.NO. 5 ANSWER:
Scheduling and its types

The process scheduling is the activity of the process manager that handles the removal of the
running process from the CPU and the selection of another process on the basis of a particular
strategy.
Process scheduling is an essential part of a Multiprogramming operating system. Such operating
systems allow more than one process to be loaded into the executable memory at a time and loaded
process shares the CPU using time multiplexing.

Schedulers are special system software’s which handles process scheduling in various ways.
Their main task is to select the jobs to be submitted into the system and to decide which process to
run. Schedulers are of three types
 Long Term Scheduler
 Short Term Scheduler
 Medium Term Scheduler

Long Term Scheduler

It is also called job scheduler. Long term scheduler determines which programs are admitted to the
system for processing. Job scheduler selects processes from the queue and loads them into memory
for execution. Process loads into the memory for CPU scheduling. The primary objective of the job
scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also
controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the
average rate of process creation must be equal to the average departure rate of processes leaving
the system.
On some systems, the long term scheduler may not be available or minimal. Time-sharing operating
systems have no long term scheduler. When process changes the state from new to ready, then
there is use of long term scheduler.

Short Term Scheduler

It is also called CPU scheduler. Main objective is increasing system performance in accordance with
the chosen set of criteria. It is the change of ready state to running state of the process. CPU
scheduler selects process among the processes that are ready to execute and allocates CPU to one of
them.
Short term scheduler also known as dispatcher, execute most frequently and makes the fine grained
decision of which process to execute next. Short term scheduler is faster than long term scheduler.

Medium Term Scheduler

Medium term scheduling is part of the swapping. It removes the processes from the memory. It
reduces the degree of multiprogramming. The medium term scheduler is in-charge of handling the
swapped out-processes.
Running process may become suspended if it makes an I/O request. Suspended
processes cannot make any progress towards completion. In this condition, to remove
the process from memory and make space for other process, the suspended process is
moved to the secondary storage. This process is called swapping, and the process is
said to be swapped out or rolled out. Swapping may be necessary to improve the
process mix.

Implementation of scheduling in CSS:

Task scheduling can be performed both as a centralized or a decentralized unit. Because a


centralized scheduler contains global knowledge of all the participating workers it is easier to
implement however it lacks the scalability and fault tolerance a decentralized scheduler
would have. This is because of the single machine that is scheduling which also is a single
point of failure. Because of the single point of failure are centralized scheduler not optimal
when working with a big distributed system where a decentralized scheduler would work
much better. Task scheduling can be divided into two distinct parts; static scheduling and
dynamic scheduling. Static scheduling is scheduling performed at compile time and dynamic
scheduling is performed during run time. Static scheduling assumes that there is an finite
number of tasks that are going to be scheduled and dynamic scheduling assumes that there is
an continuous flow of incoming tasks. When static scheduling is used all information about
the tasks need to be known in advance. This information is for example the size,
dependencies and demand of the task. Dynamic scheduling on the contrary does only know
very little or no information about the tasks in advance. The dynamic scheduling is because
of this more complex to create but achieves a better throughput than the static scheduling
algorithm. Preemptive and non-preemptive is a classification for task scheduling algorithms
which determines if a task can be paused and then restarted on a later stage. In preemptive
algorithms any running task can be interrupted to make another task execute on the
processing unit. The preemption is determined by a predefined policy. Non-preemptive is the
exact opposite of preemptive algorithms, once a tasks has begun to execute it will continue
until it is done. A drawback when using preemptive is that it requires more resources to
maintain its state.
Q.NO.7 ANSWER:

In the Oracle database system environment, the database application and the database are
separated into two parts: a front-end or client portion, and a back-end or server portion--hence
the term client/server architecture. The client runs the database application that accesses
database information and interacts with a user through the keyboard, screen, and pointing
device, such as a mouse. The server runs the Oracle software and handles the functions required
for concurrent, shared data access to an Oracle database.

Although the client application and Oracle can be run on the same computer, greater efficiency
can often be achieved when the client portions and server portion are run by different computers
connected through a network.

Oracle fits into Client server model:

The Oracle Tuxedo system fits into the middle of the client/server model. In a Oracle
Tuxedo application, clients log in and request services offered by an application. The Oracle
Tuxedo system offers these services through a transparent bulletin board. The bulletin board
provides a global directory advertising service.

Q.NO.8 (A) ANSWER:

In Oracle database management, PL/SQL is a procedural language extension to Structured Query


Language (SQL). The purpose of PL/SQL is to combine database language and procedural
programming language. The basic unit in PL/SQL is called a block and is made up of three parts: a
declarative part, an executable part and an exception-building part.

Because PL/SQL enables users to mix SQL statements with procedural constructs, it is possible to use
PL/SQL blocks and subprograms to group SQL statements before sending them to Oracle for
execution. Without PL/SQL, Oracle must process SQL statements one at a time. In a network
environment, this can affect traffic flow and slow down response time. PL/SQL blocks can be compiled
once and stored in executable form to improve response time.
A PL/SQL program that is stored in a database in compiled form and can be called by name is referred
to as a stored procedure. A PL/SQL stored procedure that is implicitly started when an INSERT,
UPDATE or DELETE statement is issued against an associated table is called a trigger.

How PL/SQL works


PL/SQL blocks are defined by the keywords DECLARE, BEGIN, EXCEPTION and END, which divide
the block into a declarative part, an executable part and an exception-building part, respectively. The
declaration section of the block is used to define and initialize constants and variables; if a variable is
not initialized, it will default to NULL value. Blocks can be nested and submitted to interactive tools, like
SQL*Plus.

PL/SQL is designed to compute and return a single scalar value or a single collection, such as a
nested table or VARRAY. Users can create their own functions to supplement those provided by
Oracle. While functions can be used in an SQL statement, procedures cannot

(B) Stored procedures:

A stored procedure is a set of Structured Query Language (SQL) statements with an assigned name,
which are stored in a relational database management system (RDBMS) as a group, so it can be
reused and shared by multiple programs.

Stored procedures can access or modify data in a database, but it is not tied to a specific database or
object, which offers a number of advantages.

Benefits of using stored procedures


A stored procedure provides an important layer of security between the user interface and the
database. It supports security through data access controls because end users may enter or change
data, but do not write procedures. A stored procedure preserves data integrity because information is
entered in a consistent manner. It improves productivity because statements in a stored procedure only
must be written once.

Stored procedures offer advantages over embedding queries in a graphical user interface (GUI). Since
stored procedures are modular, it is easier to troubleshoot when a problem arises in an application.
Stored procedures are also tunable, which eliminates the need to modify the GUI source code to
improve its performance. It's easier to code stored procedures than to build a query through a GUI.

Use of stored procedures can reduce network traffic between clients and servers, because the
commands are executed as a single batch of code. This means only the call to execute the procedure
is sent over a network, instead of every single line of code being sent individually.
Stored procedure in SQL
Stored procedures in SQL Server can accept input parameters and return multiple values of output
parameters; in SQL Server, stored procedures program statements to perform operations in the
database and return a status value to a calling procedure or batch.

User-defined procedures are created in a user-defined database or in all system databases, except for
when a read-only (resource database) is used. They are developed in Transact-SQL (T-SQL) or a
reference to Microsoft. Temporary procedures are stored in tempdb, and there are two types of
temporary procedures: local and global. Local procedures are only visible to the current user
connection, while global procedures are visible to any user after they are created. System procedures
arrive with SQL Server and are physically stored in an internal, hidden-resource database. They
appear in the SYS schema of each system, as well as in a user-defined database.

Stored procedure in Oracle


Oracle's database language, PL/SQL, is made up of stored procedures, which build applications within
Oracle's database. IT professionals use stored programs in Oracle's database to properly write and
test code, and those programs become stored procedures once compiled.

A stored procedure in Oracle follows the basic PL/SQL block structure, which consists of declarative,
executable and exception-handling parts.

Stored procedure vs. function


Stored procedures and functions can be used to accomplish the same task. Both can be custom-
defined as part of any application, but functions are designed to send their output to a query or T-SQL
statement. Stored procedures are designed to return outputs to the application, while a user-defined
function returns table variables and cannot change the server environment or operating system
environment.

You might also like