Professional Documents
Culture Documents
SUBJECT:
CLOUD COMPUTING
ASSIGNMENT NO. 2
COURSE INSTRUCTOR:
DR. HUMAIRA IJAZ
COURSE CODE:
IT-4544
PREPARED BY:
WALEED AHMED
BSEF17E05
BSSE (7TH- SELF)
2017-2021
DATE:
WEDNESDAY, NOVEMBER 18, 2020.
DEPARTMENT OF CS & IT
UNIVERSITY OF SARGODHA
SARGODHA, 40100
1|Page
CLOUD COMPUTING
Privileged Instructions:_______________________________________________________________9
Examples of Privileged Instructions:____________________________________________________________9
2. Software Interrupts:_____________________________________________________________10
Normal Interrupts:____________________________________________________________________10
Exception:___________________________________________________________________________10
2|Page
CLOUD COMPUTING
CLOUD COMPUTING
3|Page
CLOUD COMPUTING
ASSIGNMENT NO.2
Q.No.1: Differentiate between Simulation, Emulation and
Virtualization?
ANS:
EMULATION VIRTUALIZATION SIMULATION
Emulation, in a software Virtualization is the creation A simulation is an
context, is the use of an of virtual servers, approximate imitation of the
application program or infrastructures, devices and operation of a process or
device to imitate the computing resources. system that represents its
behavior of another program Virtualization changes the operation over time. A
or device. Common uses of hardware-software relations computer simulation is an
emulation include: Running and is one of the attempt to model a real-life
an operating system on a foundational elements of or hypothetical situation on a
hardware platform for which cloud computing technology computer so that it can be
it was not originally that helps utilize the studied to see how the
engineered. capabilities of cloud system works.
computing to the full.
In case of Emulation, you’d In virtualization, hardware In simulation, the hardware is
need a software connector to can be accessed directly. accessed both directly to test
access hardware. functionality and indirectly to
control the environment.
Emulator requires an Virtual machine can run the An instruction set simulator
interpreter to translate the code directly, which is (ISS) is a simulation model,
source code. available in different usually coded in a high-level
languages. programming language,
which works by "reading"
instructions and maintaining
internal variables which
represent the processor's
registers.
Emulators are relatively Virtual machines are Simulators are faster than
slower. Since it involves relatively faster in its emulators but could be
binary translation which can operations. slower than virtual machines.
cause latency.
Emulation is comparatively VM solutions are costlier Simulator are the most costly
cheaper. than Emulation. of the three techniques as it
builds real time environment
to execute the code (system).
Internal structure of Virtual machine can run the Internal structure of
emulation is written in code directly, which is simulation is written in high-
4|Page
CLOUD COMPUTING
SIMULATION:
Simulation is preferred where want to:
Avoid danger and loss of life.
Where conditions can be varied and outcomes investigated.
Investigate critical situations without risk.
Have effective cost control.
Have speedy behavior needed to be studied easily over a long period of time.
VIRTUALIZATION:
Virtualization is preferred where we want:
To reduced capital and operating costs.
Minimized or eliminated downtime.
Increased it productivity, efficiency, agility and responsiveness.
Faster provisioning of applications and resources.
Greater business continuity and disaster recovery.
5|Page
CLOUD COMPUTING
6|Page
CLOUD COMPUTING
POPULAR ISAS:
There are various popular instruction sets that are used in the industry and are of theoretical
importance. Each one has its own usage and advantages.
PRIVILEGE LEVEL:
A privilege level in the x86 instruction set controls the access of the program currently running
on the processor to resources such as memory regions, I/O ports, and special instructions.
There are 4 privilege levels ranging from 0 which is the most privileged, to 3 which is least
privileged. Most modern operating systems use level 0 for the kernel/executive, and use level 3
for application programs. Any resource available to level n is also available to levels 0 to n, so
7|Page
CLOUD COMPUTING
the privilege levels are rings. When a lesser privileged process tries to access a higher privileged
process, a general protection fault exception is reported to the OS.
Computer operating systems provide different levels of access to resources. A protection ring is
one of two or more hierarchical levels or layers of privilege within the architecture of a
computer system. This is generally hardware-enforced by some CPU architectures that provide
different CPU modes at the hardware or microcode level. Rings are arranged in a hierarchy from
most privileged (most trusted, usually numbered zero) to least privileged (least trusted, usually
with the highest ring number). On most operating systems, Ring 0 is the level with the most
privileges and interacts most directly with the physical hardware such as the CPU and memory.
In the inner most ring are the most protected instructions; those that only the kernel should be allowed
to call. For example, the HLT instruction to halt the processor should not be allowed to be run by a user
application, since it would stop the entire computer from working. However, the kernel needs to be able
to call this instruction when the computer is legitimately shut down.
Each inner ring can access any instructions protected by a further out ring, but not any protected by a
further in ring. Not all architectures have multiple levels of rings as above, but most will either provide
for at least a "kernel" and "user" level.
TYPES OF INSTRUCTIONS:
Instructions are divided into two categories:
Non-Privileged Instructions
Privileged Instructions.
NON-PRIVILEGED INSTRUCTIONS:
A Non-Privileged instruction is an instruction that any application or user can execute.
(OR)
8|Page
CLOUD COMPUTING
The Instructions that can run only in User Mode are called Non-Privileged Instructions.
Various examples of Non-Privileged Instructions include:
Reading the status of Processor
Reading the System Time
Generate any Trap Instruction
Sending the final printout of Printer
Also, it is important to note that in order to change the mode from Privileged to Non-Privileged,
we require a Non-privileged Instruction that does not generate any interrupt.
Examples of Non-Privileged Instructions:
I. movl
II. addl
III. call
IV. ret
PRIVILEGED INSTRUCTIONS:
A Privileged instruction, on the other hand, is an instruction that can only be executed in kernel
mode.
(OR)
The Instructions that can run only in Kernel Mode are called Privileged Instructions.
Instructions are divided in this manner because privileged instructions could harm the kernel.
Privileged Instructions possess the following characteristics:
1) If any attempt is made to execute a Privileged Instruction in User Mode, then it will not be
executed and treated as an illegal instruction. The Hardware traps it to the Operating
System.
2) Before transferring the control to any User Program, it is the responsibility of the Operating
System to ensure that the Timer is set to interrupt. Thus, if the timer interrupts then the
Operating System regains the control.
Thus, any instruction which can modify the contents of the Timer is a Privileged Instruction.
3) Privileged Instructions are used by the Operating System in order to achieve correct
operation.
4) Various examples of Privileged Instructions include:
I/O instructions and Halt instructions
Turn off all Interrupts
Set the Timer
Context Switching
Clear the Memory or Remove a process from the Memory
Modify entries in Device-status table
Examples of Privileged Instructions:
I. insl
II. outb
III. inb
9|Page
CLOUD COMPUTING
IV. int
A program that tries to run a system call the kernel does not consider to be allowed will be
terminated.
Types of Interrupts:
Although interrupts have highest priority than other signals, there are many type of interrupts
but basic type of interrupts are
1. HARDWARE INTERRUPTS: If the signal for the processor is from external device
or hardware is called hardware interrupts. Example: from keyboard we will press the
key to do some action this pressing of key in keyboard will generate a signal which is
given to the processor to do action, such interrupts are called hardware interrupts.
Hardware interrupts can be classified into two types they are
o Maskable Interrupt: The hardware interrupts which can be delayed when a
much highest priority interrupt has occurred to the processor.
o Non-Maskable Interrupt: The hardware which cannot be delayed and should
process by the processor immediately.
SOFTWARE INTERRUPTS: Software interrupt can also divided in to two
types. They are
o Normal Interrupts: the interrupts which are caused by the software
instructions are called software instructions.
o Exception: Unplanned interrupts while executing a program is called Exception.
For example: while executing a program if we got a value which should be
divided by zero is called a exception.
CLASSIFICATION OF INTERRUPTS ACCORDING TO PERIODICITY OF
OCCURRENCE:
1. Periodic Interrupt: If the interrupts occurred at fixed interval in timeline then that
interrupts are called periodic interrupts
2. Aperiodic Interrupt: If the occurrence of interrupt cannot be predicted then that
interrupt is called aperiodic interrupt.
CLASSIFICATION OF INTERRUPTS ACCORDING TO THE TEMPORAL
RELATIONSHIP WITH SYSTEM CLOCK:
1. Synchronous Interrupt: The source of interrupt is in phase to the system clock is called
synchronous interrupt. In other words interrupts which are dependent on the system
clock. Example: timer service that uses the system clock.
10 | P a g e
CLOUD COMPUTING
11 | P a g e
CLOUD COMPUTING
1. When the reset pin is activated, the 8051 jumps to the address location 0000. This is power-
up reset.
12 | P a g e
CLOUD COMPUTING
2. Two interrupts are set aside for the timers: one for timer 0 and one for timer 1. Memory
locations are 000BH and 001BH respectively in the interrupt vector table.
3. Two interrupts are set aside for hardware external interrupts. Pin no. 12 and Pin no. 13 in
Port 3 are for the external hardware interrupts INT0 and INT1, respectively. Memory
locations are 0003H and 0013H respectively in the interrupt vector table.
4. Serial communication has a single interrupt that belongs to both receive and transmit.
Memory location 0023H belongs to this interrupt.
Figure 3: Shows a typical vector table of a real system. The undefined instruction handler is located so that a simple branch is
adequate, whereas the other vectors require an indirect address using assembler instructions specific for loading.
FETCH:
The "fetch" method loads the PC indirectly, using the address of some entry inside the interrupt
vector table to pull an address out of that table, and then loading the PC with that address.
Each and every entry of the IVT is the address of an interrupt service routine. All
Motorola/Freescale microcontrollers use the fetch method.
13 | P a g e
CLOUD COMPUTING
INTERRUPT ACKNOWLEDGE:
For the "interrupt acknowledge" method, the external device gives the CPU an interrupt
handler number. The interrupt acknowledge method is used by the Intel Pentium and many
older microprocessors.
14 | P a g e
CLOUD COMPUTING
INTERRUPT HANDLING
When an interrupt occurs, the hardware automatically switches a part of the context (at least
enough to allow the handler to return to the interrupted code). The handler may save
additional context, depending on details of the particular hardware and software designs. Often
only a minimal part of the context is changed in order to minimize the amount of time spent
handling the interrupt. The kernel does not spawn or schedule a special process to handle
interrupts, but instead the handler executes in the (often partial) context established at the
beginning of interrupt handling. Once interrupt servicing is complete, the context in effect
before the interrupt occurred is restored so that the interrupted process can resume execution
in its proper state.
THANK YOU
15 | P a g e