Professional Documents
Culture Documents
2 ANSWER:
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.
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 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:
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:
Software developers, database administrators and web developers typically use server-side
development. Server-side developers can use many different programming languages,
including:
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
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.
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 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.
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.
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.
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.
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
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.
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.
A stored procedure in Oracle follows the basic PL/SQL block structure, which consists of declarative,
executable and exception-handling parts.