0% found this document useful (0 votes)
6 views50 pages

A2 Chapter 4 System Software & VMs

The document outlines the functions and structures of an Operating System (OS), detailing its role in resource management, process scheduling, and interrupt handling. It describes the layered and modular structure of an OS, the differences between user mode and kernel mode, and the significance of process states and scheduling algorithms. Additionally, it explains how the OS maximizes resource utilization and manages I/O operations to ensure efficient system performance.

Uploaded by

Fatima Zahra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views50 pages

A2 Chapter 4 System Software & VMs

The document outlines the functions and structures of an Operating System (OS), detailing its role in resource management, process scheduling, and interrupt handling. It describes the layered and modular structure of an OS, the differences between user mode and kernel mode, and the significance of process states and scheduling algorithms. Additionally, it explains how the OS maximizes resource utilization and manages I/O operations to ensure efficient system performance.

Uploaded by

Fatima Zahra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

4 System Software

4.1 Purposes of an Operating System (OS)


Loading of an Operating System (OS):
 When a computer is first switched on, the basic input/output system (BIOS) – which is often
stored on the ROM chip – starts off a bootstrap program.
 The bootstrap program loads part of the operating system into main memory (RAM) from
the hard disk/SSD and initiates the start-up procedures.
 This process is less obvious on tablets and mobile phones – they also use RAM, but their main
internal memory is supplied by flash memory and therefore the start-up of tablets and mobile
phones is almost instantaneous.

Structure of an Operating System (OS):

Layered structure: each higher layer needs to be fully serviced by a lower layer.

Modular structure: The Kernel calls on individual services when required.

1
There are two modes of Operating System:

1) User mode: available for user or an application program

2) Kernel mode: it has sole access to part of the memory and to certain system functions that user
mode cannot access

One operating system task is to maximize the utilization of computer resources. Resource
management can be split into three areas:

1. the CPU
2. the memory
3. the input/output (I/O) system

Resource management of the CPU involves the concept of scheduling to allow for better utilization
of CPU time and resources
Resource management of memory involves optimum usage of main memory.

The input/output (I/O) system:


The operating system will need to deal with:

 any I/O operation which has been initiated by the computer user.
 any I/O operation which occurs while software is being run and resources, such as printers or
disk drives, are requested.

The bus structure in following diagram shows that there can be an option for the transfer of data
between an I/O device and memory. The operating system can ensure that I/O passes via the CPU
but for large quantities of data the operating system can ensure direct transfer between memory
and an I/O device:

 It must be understood that one second is a very long time for a computer system.
 A CPU typically operates at GHz frequencies.
 One second sees more than one trillion clock cycles.
 The slow speed of I/O compared to a typical CPU clock cycle shows that management of CPU
usage is vital to ensure that the CPU does not remain inactive while I/O is taking place.

2
The Kernel:
 The kernel is part of the operating system.
 It is the central component responsible for communication between hardware, software and
memory.
 It is responsible for process management, device management, memory management,
interrupt handling and input/output file communications as shown below:

One of the most important tasks of an operating system is to hide the complexities of the
hardware from the users in the following ways:

1. By using GUI interfaces rather than CLI.


2. By using device drivers (which simplifies the complexity of hardware interfaces).
3. By simplifying the saving and retrieving of data from memory and storage devices.
4. By carrying out background utilities, such as virus scanning

Example:

Transferring data from a hard disk to a floppy disk using an old computer required a command such
as:
copy C:\windows\[Link]

whereas latest/modern computers use a drag and drop method which removes any of the
complexities of interfacing directly with the computer.

3
One of the main tasks of an operating system is resource management.
Description of how an operating system can maximize the use of resources:
1) Primary memory:

 The OS can move frequently accessed instructions to cache for faster recall as SRAM is used
rather than DRAM for cache.
 It can make use of virtual memory with paging or segmentation to swap memory to and from
a disk.
 It can partition memory by dividing main memory into static/dynamic partitions to allow for
more than one program/task to be available (multiprogramming).
 It can remove unused items/tasks from RAM by marking a partition as available as soon as
the process using it has terminated.

2) Disk:

 The OS can do disk caching so that a disk cache holds data that is frequently transferred
to/from the disk and the cache can be held on disk or in RAM.
 It can use compression utility to decrease the size of a file stored on disk in order to fit
more/larger files on the disk.
 It can use defragmentation utility so files are rearranged to occupy contiguous disk space
which reduces the time taken to access files (decreases latency)

Process management (CPU):


Difference between a program and a process.

 A program is the written code (“static”).


 A process is the executing code (“dynamic”).
Multi-tasking:

 It manages the execution of many programs that appear to run at the same time
 Multitasking ensures the best use of computer resources by monitoring the state of each
process. It should give the appearance that many processes are being carried out at the same
time.

There are two types of multitasking operating systems:

1. preemptive (processes are pre-empted after each time quantum)


2. non-preemptive (processes are pre-empted after a fixed time interval)

4
The following table summarizes the differences between preemptive & non-preemptive:

To ensure multitasking operates correctly (for example, making sure processes do not clash),
scheduling is used to decide which processes should be carried out.

5
Process Scheduling:
 Scheduling is managing the processes running on the CPU.
 Process scheduling is the process of removing the running task from the processor and
selecting another task for processing.
 It schedules a process into different states like ready, waiting, and running.
Role of the high-level scheduler in a multiprogramming operating system:

 It decides which processes are to be loaded from backing store into memory/ready queue
Role of the low-level scheduler in a multiprogramming operating system:

 It decides which of the processes in ready state should get use of processor/be put in running
state based on position/priority
 It is invoked after interrupt/OS call.
Why an operating system needs to use scheduling algorithms // why process scheduling is
needed:

1. To allow multiprogramming / multitasking to take place.


2. To ensure fair usage of the processor by giving each process fair share of CPU time.
3. To ensure fair usage of peripherals.
4. To ensure fair usage of memory.
5. To ensure higher priority tasks are executed first.
6. To ensure all processes have the opportunity to finish.
7. To keep the CPU busy all the time.
8. To service the largest possible number of jobs in a given amount of time.
9. To minimize the amount of time users must wait for their results.

Process states:
A process control block (PCB) is a data structure which contains all of the data needed for a process
to run. This can be created in memory when data needs to be received during execution time.

The PCB will store:

1. current process state (ready, running or blocked)


2. process privileges (such as which resources it is allowed to access)
3. register values (PC, MAR, MDR and ACC)
4. process priority and any scheduling information •
5. the amount of CPU time the process will need to complete
6. a process ID which allows it to be uniquely identified.

There are three process states:

1) Ready
2) Running
3) Blocked

6
A process can be in one of three states: running, ready or blocked.

Description of states of process:

1) Ready:

 The process is not being executed.


 The process is in the queue waiting for the processor’s attention/time slice.
2) Running:

 The process is being executed by the processor.


 The process is currently using its allocated processor time/time slice.
3) Blocked:

 The process is waiting for an event so it cannot be executed at the moment


 e.g. input/output operation/events

7
The following diagram shows the simplified link between these states:

The following diagram shows the detailed link between these states along with conditions
that cause each change of state of a process:

8
For each of the following, the process is moved from the first state to the second state.

The following are the conditions that cause each of the following changes of the state of a
process:

1) From running to ready:

 When process is executing it is allocated a time slice (running state).


 When time slice completes, interrupt occurs and process can no longer use processor even
though it is capable of further processing (ready state).

2) From ready to running:

 The process is capable of using processor (ready state).


 The OS allocates processor time to process so that it can execute (running state).
3) From running to blocked:

 The process is executing (running state) but it needs to perform I/O operation.
 It is placed in blocked state until I/O operation completed.
4) From blocked to ready:

 The process is waiting for I/O operation to complete (blocked state).


 When the I/O operation is completed, process goes into ready queue (ready state).
Why a process cannot move directly from the ready state to the blocked state:

 For the processor to be in blocked state, a process must initiate some I/O operation.
 The process must be executing to initiate operation and if process is in ready state then it
cannot be executing.
 Therefore, the process must be in running state to go to the blocked state.
Why a process cannot be moved directly from the blocked state to the running state:

 When the I/O operation is completed for a process in blocked state then it is put into the
ready queue/ready state.
 The OS then decides which process should be allocated to processor choosing from the ready
queue.

Conditions that are necessary for a process to move from the ready to the running state.

 The current process is no longer running so processor is available.


 The process was at the head of the ready queue//process has highest priority.
Condition that is necessary for a process to move from the blocked to the ready state.

 The required resource becomes available//event is complete.

9
A process in the running state can change its state to something which is neither the ready
state nor the blocked state.

 This state is known as exit/termination/completion.


 A process would enter the exit/termination/completion state when it has finished execution.
Scheduling routine algorithms:
We will consider four examples of scheduling routines:

1. first come first served scheduling (FCFS)


2. shortest job first scheduling (SJF)
3. shortest remaining time first scheduling (SRTF)
4. round robin (RR)

These are some of the most common strategies used by schedulers to ensure the whole system is
running efficiently and in a stable condition at all times.

Why an operating system needs to use scheduling algorithms?

1. To allow multiprogramming / multitasking to take place.


2. To ensure fair usage of the processor by giving each process fair share of CPU time.
3. To ensure fair usage of peripherals.
4. To ensure fair usage of memory.
5. To ensure higher priority tasks are executed first.
6. To ensure all processes have the opportunity to finish.
7. To keep the CPU busy all the time.
8. To service the largest possible number of jobs in a given amount of time.

List of criteria used to determine the process/schedule which will be processed using
scheduling algorithms:

1. Priority of the process.


2. Category of the process:
Is it a batch, online or a real time process?
3. Whether the process is CPU-bound or I/O bound:
A large calculation such as finding 10,000 factorial would need long CPU cycles and short I/O
cycles whereas printing a large number of documents would require short CPU cycles but
very long I/O cycles.
4. Resource requirements:
Which resource does the process require, and how many?
5. The turnaround time, waiting time & response time for the process.
6. Whether the process can be interrupted during running.

10
The scheduling algorithm can be preemptive or non-preemptive. A preemptive algorithm can halt a
process that would otherwise continue running undisturbed. If an algorithm is preemptive then it
may involve prioritizing processes.

1) First come first served scheduling (FCFS):

 FCFS is non-preemptive.
 The data added to a queue first is the data that leaves the queue first and therefore it is first
to enter the running state.
 This is similar to the concept of a queue structure which uses the first-in first-out (FIFO)
principle.
 This is useful for long jobs but otherwise very inefficient if it is the only algorithm employed.
 It can be useful as a part of a more complex algorithm.
2) Shortest job first scheduling (SJF):

 SJF is non-preemptive.
 It sorts jobs in the ready queue in ascending order of time needed by each job.
 The new jobs are added to the queue in a such a way as to preserve this ascending order.
 The process requiring the least CPU time is executed first in SJF.
 This is useful for short jobs as they are processed first.

3) Shortest remaining time first scheduling (SRTF):

 SRTF is preemptive.
 The processes are placed in the ready queue as they arrive but when a process with a shorter
burst time arrives, the existing process is removed (pre-empted) from execution.
 The shorter process is then executed first.
 This is useful for short jobs as they are processed first. For SJF, the short jobs are processed
first depending on time required and they will remain sorted in that order. While SRT will
mean that once an interrupt occurs, the queue will be reshuffled again with the shortest job
first and hence SRTF favors short jobs more than SJF.

4) Round robin (RR):

 RR is preemptive because a process will be halted when its time slice has run out.
 It gives every job a maximum time slice after which the job is placed in the blocked queue.
 Then another process from the front of ready queue is executed in its own time slice.
 Context switching is used to save the state of the pre-empted processes.
 The ready queue is worked out by giving each process its time slice in the correct order.
 If a job is completed before the end of time slice, it leaves the system and then the next
process is brought into the ready queue.
 This is useful for distributing work evenly among all available resources.

11
Interrupt handling and OS kernels
Interrupt:

 It is a signal from a software source or hardware device seeking the attention of the processer.
Interrupt Handling:

 Transferring control to another routine when a service is required.


Describe the sequence of steps which would be carried out by the interrupt handler software
when an interrupt is received and serviced.

1. It will identify the source of the interrupt.


2. It will disable all interrupts of a lower priority.
3. It will save the contents of the PC and save the contents of the other registers onto the stack.
4. It will load and run the appropriate interrupt service routine (ISR) code.
5. Once the interrupting task is serviced then, it will restore the registers from the stack.
6. It will enable all interrupts.
7. It will continue execution of the interrupted process.

The system will enter the kernel mode if any of the following type of interrupt signals are
sent:

1. Device interrupt (for example, printer out of paper, device not present, and so on).
2. Exceptions (for example, instruction faults such as division by zero, unidentified op code, stack
fault, and so on).
3. Traps/software interrupt (for example, process requesting a resource such as a disk drive).

How the kernel of the OS acts as an interrupt handler and how interrupt handling is used to
manage low-level scheduling:

1. When an interrupt is received, the kernel will consult the interrupt dispatch table (IDT) – this
table links a device description with the appropriate interrupt routine.
2. IDT will supply the address of the low level routine to handle the interrupt event received.
3. The kernel will save the state of the interrupt process on the kernel stack and the process
state will be restored once the interrupting task is serviced.
4. Interrupts will be prioritized using interrupt priority levels (IPL)(numbered 0 to 31).
5. A process is suspended only if its interrupt priority level is greater than that of the current
task.
6. The process with the lower IPL is saved in the interrupt register and is handled (serviced) when
the IPL value falls to a certain level.

12
The following diagram summarizes the interrupt process:

13
Exam Style Questions:
Question 1:

Answer:

 Blank 1  JOB32
 Blank 2  JOB42
 Blank 3  JOB42

Question 2:

A computer process can be in one of three states: running, ready or blocked. Explain how the
processes are affected when the following events take place:

1) The running process needs to read a file from a disk:

 The running process is halted.


 The process moves to the blocked state from running state.
2) The running process uses up its time slice:

 The running process is halted.


 The process moves to ready state from running state.
 It stays in ready state until next time slice is allocated by the processor.

14
Question 3:

A computer at a remote weather station is performing three tasks:

1. measuring and recording the temperature every 10 seconds


2. measuring and recording the wind speed every 10 seconds
3. sending the previous day’s temperature and wind speed readings to a scientist at
another location via the Internet.

The operating system is managing the multitasking of these tasks. At one point in time:

 the temperature measuring and recording task is idle


 the wind speed is being recorded
 the task to send the previous day’s temperature and wind speed readings is waiting for
an internet connection.

Identify the process state for each task. Give a reason why each task is in that process state.

(i) Temperature measuring and recording:

Process state: Ready

Reason: It is waiting for the 10 seconds to be finished.

(ii) Wind speed measuring and recording:

Process state: Running

Reason: It is currently recording the wind speed.

(iii) Sending:

Process state: Blocked

Reason: it is waiting for the internet connection.

Question 4:

The weather station computer uses an operating system. Explain how this operating system
uses interrupts to schedule the measuring and recording tasks.

 The operating system uses timers.


 Each timer is continually checked to see if 10 seconds has passed.
 If it has passed, then an interrupt is sent to the OS.
 The OS checks interrupt status and may pass control to the interrupt handling routine
 If 10 seconds has passed, then the interrupt service routine (ISR) switches process state to
running/ready state.
 When finished it passes control back to OS.
 The timer is then restarted.

15
Question 5:
For each of the following, the process is moved from the first state to the second state.
Describe the conditions that cause each of the following changes of the state of a process:
1) From running to ready:
 When process is executing it is allocated a time slice (running state).
 When time slice completes, interrupt occurs and process can no longer use processor even
though it is capable of further processing (ready state).
2) From ready to running
 The process is capable of using processor (ready state).
 The OS allocates processor time to process so that it can execute (running state).
3) From running to blocked
 The process is executing (running state) but it needs to perform I/O operation.
 It is placed in blocked state until I/O operation completed.

Question 6:
For each of the following, the process is moved from the first state to the second state.
Describe the conditions that cause each of the following changes of state of a process:
1) From blocked to ready
 The process is waiting for I/O operation to complete (blocked state).
 When the I/O operation is completed, process goes into ready queue (ready state).
2) From running to ready
 When process is executing it is allocated a time slice (running state).
 When time slice completes, interrupt occurs and process can no longer use processor even
though it is capable of further processing (ready state).

Question 7:
Explain why a process cannot move directly from the ready state to the blocked state.
 For the processor to be in blocked state, a process must initiate some I/O operation.
 The process must be executing to initiate operation and if process is in ready state then it
cannot be executing.
 Therefore, the process must be in running state to go to the blocked state.
Explain why a process cannot be moved from the blocked state to the running state.
 When the I/O operation is completed for a process in blocked state then it is put into the
ready queue/ready state.
 The OS then decides which process should be allocated to processor choosing from the ready
queue.

16
Question 8:

State the conditions that are necessary for a process to move from the ready to the running
state.

 The current process is no longer running so processor is available.


 The process was at the head of the ready queue//process has highest priority.
State the condition that is necessary for a process to move from the blocked to the ready
state.

 The required resource becomes available//event is complete.

Question 9:

A process in the running state can change its state to something which is neither the ready
state nor the blocked state. Name this state.

 Exit/termination/completion
Identify when a process would enter this state.

 The process would enter the exit/termination/completion state when the it has finished
execution.

17
Memory management:
When a process starts up, it is allocated memory; when it is completed, the OS deallocates memory
space.

The following methods are used for memory management to allocate memory to different
processes/programs and data.

1) Single (contiguous) allocation:

 With this method, all of the memory is made available to a single application.
 This leads to inefficient use of main memory.
2) Paging (paged memory):

An operating system (OS) uses a memory management technique called paging. The process of
paging is given below:

 The main memory is divided into equal-size blocks, called page frames.
 Each process that is executed is divided into blocks of the same size, called pages.
 When a process is executed, process pages from logical memory are loaded into frames in
physical memory and not all pages of program need to be initially loaded.
 Each process has a page table that is used to manage the pages of this process.
 The page table maps logical addresses to physical addresses.
Key terms along with their descriptions:

(i) Paging:

 Reading/writing same-size blocks of data from/to secondary storage when required.


(ii) Page frame:

 The main memory is divided into page frames of the same size as a page.
(iii) Page table:

 The Page (Map) table shows the mapping of pages to page frames.

18
The page table will show:

1. page number
2. flag status
3. page frame address
4. the time of entry (for example, in the form 08:25:55:08).
The time of entry is important when considering page replacement algorithms.

Some of the page table status flags are shown in the table below:

19
The following diagram only shows page number and frame number (we will assume status flags
have been set and entry time entered). Each entry in a page table points to a physical address that
is then mapped to a virtual memory address – this is formed from offset in page directory + offset
in page table:

3) Segmentation (segmented memory):

The process of segmentation is given below:

 The logical address space is divided into variable-size memory blocks/partitions called
segments.
 Each segment has a name and size.
 Segments from logical memory are loaded into physical memory for execution and not all
segments are initially loaded.
 The address is specified by the user which contains the segment name and offset value.
 The segments are numbered (called segment numbers) rather than using a name and this
segment number is used as the index in a segment map table.

The offset value decides the size of the segment:

address of segment in physical memory space = segment number + offset value

20
The segment map table given below contains the segment number, segment size and the start
address in physical memory:

The memory management methods of segmentation and paging work in almost similar ways with a
few differences such as pages are usually smaller than segments.

The following table summarizes the differences between paging and segmentation:

21
Linking & Loading:

 The key difference between linking and loading is that the linking generates the
executable file of a program whereas, the loading loads the executable file obtained
from the linking into main memory for execution.

(i) Static linking:

 It means that the code for all routines called by a program becomes part of the executable
file.

(ii) Dynamic linking:

 It means that the code for some external routines is located and loaded when the program
is first run.

(iii) Static loading:

 It is loading of the entire program into main memory before start of the program execution.
 Program execution will be faster.
(iv) Dynamic loading:

 It is loading of a program into main memory on demand.


 Program execution will be slower.

22
4) Virtual memory:

Virtual memory is basically using secondary storage to stimulate additional main memory.

 The disk/secondary storage is used to extend the RAM/memory available so the CPU can
access more memory space than available RAM.
 The only part of program/data in use needs to be in RAM.
 The data is swapped between RAM and disk.
Physical memory is managed using virtual memory and paging. The following points describe
how paging is used to manage virtual memory:

 It divides memory/RAM into frames.


 It divides virtual memory into blocks of same size called pages.
 The frames/pages are a fixed size.
 It sets up a page table to translate logical to physical addresses.
 It keeps track of all free frames.
 It swaps pages in memory with new pages from disk whenever needed.

Benefits of using virtual memory:

1. The programs can be larger than physical memory and can still be executed.
2. It leads to more efficient multi-programming with less I/O loading and swapping programs
into and out of memory.
3. There is no need to waste memory with data that is not being used (for example, during error
handling).
4. It eliminates external fragmentation/reduces internal fragmentation.
5. It removes the need to buy and install more expensive RAM memory.

Drawback of using virtual memory:

1. Disk thrashing

Disk thrashing:

 The pages are required back in RAM as soon as they are moved to disk.
 There is a continuous swapping of the same pages.
 This results in no useful processing (deadlock) because the pages that are in RAM and on disk
are inter-dependent.
 This results in nearly all processing time to be used for swapping pages.

23
The following diagrams show differences between paging without virtual memory and paging
using virtual memory:

(i) Without virtual management:

(ii) With virtual management:

The virtual memory management now moves the oldest data to disk and the 4 GiB map is
updated so that:

 Data 0 is now mapped to the HDD


 Program/process 4 now maps to 3 in RAM.

24
Page replacement:

 Page replacement occurs when a requested page is not in memory (P flag = 0).
 When a new page is requested but is not in memory, a page fault occurs and the OS replaces
one of the existing pages with the new page(s).
 There are several methods for page replacement and its purpose is to minimize the number
of page faults.

Page fault:

 A page fault occurs when there is an attempt to load an instruction for a page not in memory.
 This generates an interrupt.
 The interrupt service routine (ISR) code is executed.
 This causes the OS to load the page into memory.

Page replacement algorithms for paging process:

1. First-in-first-out (FIFO)
2. Least-recently-used page (LRU) // Least-used-page
3. Optimal page replacement (OPR)
4. Clock page replacement // Second-chance page replacement

1) First-in-first-out (FIFO):

 A queue structure is used to keep track of all pages in memory.


 The oldest page is at the front of the queue and is the first to be removed when a new page
needs to be added.
 Page usage is not considered when replacing pages and so a page may be replaced simply
because it arrived earlier than another page.
 This results in more page faults when increasing the number of page frames.
2) Least-recently-used page (LRU):

 The page which has not been used for the longest time is replaced.
 It is necessary to maintain a linked list of all pages in memory with the most recently used
page at the front and the least recently used page at the rear.

3) Optimal page replacement (OPR):

 The pages are replaced with the ones that will not be used for the longest duration of time
in the future.
 The pages that will be referred farthest in the future are replaced in this algorithm.
 It results in the least number of page faults.

25
4) Clock page replacement:

 It uses a circular queue structure with a single pointer serving as both head and tail.
 When page fault occurs, the page pointed to is inspected.
 The action taken next depends on the R-flag status.
 If R = 0, the page is removed and a new page is inserted in its place whereas if R = 1, the next
page is looked at and this is repeated until a page where R = 0 is found.

Summary of the basic differences between processor management and memory


management:
 The processor management decides which processes will be executed and in which order to
maximize resources.
 The memory management decides where in memory data/programs will be stored and how
they will be stored.
 Both are essential to the efficient and stable running of any computer system.
The two Operating System operations are summarized in the following diagram:

26
Exam Style Questions:
Question 1:

27
28
29
Answer:

30
Question 2:

31
32
33
Answer:

34
Question 3:

35
Answer:

36
Question 4:

Answer:

37
Question 5:

38
Answer:

39
Virtual Machine (VM):
 It is a software/program that emulates a physical/different computer system (hardware set-
up).
 A virtual machine allows multiple guest operating systems to run on one computer using a
host operating system.

Host operating system:

 The operating system that is actually controlling the physical hardware.


 The operating system that is used by the physical machine.
 The OS is running the virtual machine (VM) software.

Guest operating system:

 An operating system running in a virtual machine.


 It controls virtual hardware during emulation.
 This OS is being emulated.
 The Guest OS is running under the control of Host OS software.

Virtual machine software tasks:

1. It creates/deletes/manages virtual machine.


2. It translates instructions used by guest operating system to that required by host operating
system.
3. The existing hardware is made available to guest operating system // hardware emulation.
4. It ensures each virtual machine is protected from actions of another virtual machine.

Benefits of virtual machine:

1. New system can be tried on different virtual hardware without need to purchase the hardware.
2. It is easier to recover if software emulating the new computer causes system crash as VM
provides protection to other software.
3. It allows to emulate programs for the new computer system that are not compatible with the
host operating system by using the guest operating system on the old computer.
4. More than one new computer system can be emulated which allows multiple operating
systems to coexist on a single computer.

Limitations of virtual machine:

1. Virtual machines may not be able to emulate the new hardware because this hardware may
have been developed since the virtual machine was developed.
2. Using virtual machine means execution of extra code and so processing time is increased.
3. A virtual machine might not be as efficient because resources e.g. memory or processor time
are shared so processing time increases and performance degrades.
4. Use of a virtual machine increases the maintenance overheads because both host system and
the virtual machine must be maintained.

40
The following diagram shows how the hardware and operating systems are
linked together to form a virtual machine:

We can see this diagram as having 5 layers from top to bottom:

1. The 1st layer is for the applications running on a virtual machine system.
2. The 2nd layer is for the guest operating systems which are being emulated.
3. The 3rd layer is for the virtual machine software that manages the whole machine.
4. The 4th layer is for the host operating system that is actually controlling physical hardware.
5. The 5th layer is for the hardware.

Description of steps after Guest Operating System has received a data request from an
application which is executing:

 Guest OS handles request as if it were running on its own physical machine.


 Guest OS handles the request as usual.
 I/O requests are translated by the virtual machine software into instructions executed by Host
OS.
 Host OS retrieves the data from the file and passes the data to the virtual machine software.
 The virtual machine software passes the data to the Guest OS.
 Guest OS passes the data to the application

41
Exam Style Questions:
Question 1:

Answer:

42
Question 2:

43
44
Answer:

45
Question 3:

46
47
Answer:

48
Question 4:

49
Answer:

50

You might also like