0% found this document useful (0 votes)
17 views13 pages

Os Key - Ans

The document discusses various interprocess communication concepts in operating systems, highlighting shared memory and message passing as fundamental models. It also explains system calls, their types, and distinguishes between multiprogramming and multitasking systems, as well as multiprocessor and clustered systems. Additionally, it covers the concept of processes, their states, virtual machines, and the dual-mode operation of operating systems.

Uploaded by

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

Os Key - Ans

The document discusses various interprocess communication concepts in operating systems, highlighting shared memory and message passing as fundamental models. It also explains system calls, their types, and distinguishes between multiprogramming and multitasking systems, as well as multiprocessor and clustered systems. Additionally, it covers the concept of processes, their states, virtual machines, and the dual-mode operation of operating systems.

Uploaded by

cikob37383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

OS IA-1 KEY ANSWERS

(1A) Analyze various inter process communication concepts used in


operating systems.
There are several reasons for providing an environment that allows
process cooperation:
1) Information sharing: Since several users may be interested in the
same piece of information (for instance, a shared file), we must
provide an environment to allow concurrent access to such
information.
2)Computation speedup: If we want a particular task to run faster,
we must break it into subtasks, each of which will be executing in
parallel with the others. Notice that such a speedup can be achieved
only if the computer has multiple processing elements (such as CPUs
or I/O channels).
3) Modularity: We may want to construct the system in a modular
fashion, dividing the system functions into separate processes or
threads.
4) Convenience: Even an individual user may work on many tasks at
the same time. For instance, a user may be editing, printing, and
compiling in parallel.
There are two fundamental models of interprocess communication.

(1) Shared memory: In the shared-memory model, a region of


memory that is shared by cooperating processes is established.
Processes can then exchange information by reading and writing
data to the shared region. Shared memory allows maximum speed
and convenience of communication. Shared memory is faster than
message passing, as message passing systems. ale typically
implemented using system calls.

(2) Message passing: In the message passing model, communication


takes place by means of messages exchanged between the
cooperating processes. Message passing is useful for exchanging
smaller amounts of data, because no conflicts need be avoided.
Message passing is also easier to implement than is shared memory
for intercomputer communication.

(1B) What are system calls? Briefly explain types of system calls.
System calls provide an interface to the services made available by
an operating system. These calls are generally available as routines
written in C and C++.
System calls can be grouped roughly into six major categories:
process control, file manipulation, device manipulation, information
maintenance, communication.
1. Process control: *end, abort
 load, execute
 create process, terminate process
 allocate and free memory
 get process attributes, set process attributes
2. File management:
 *create file, delete file
 *open, close
 *read, write, reposition
 *get file attributes, set file attribute
3.Device management:
 * request device, release device
 *read, write, reposition
 *get device attributes, set device attributes
 *logically attach or detach devices
4.Information maintenance:
 *get time or date, set time or date
 *get system data, set system data
 *get process, file, or device attributes
 *set process, file, or device attributes
5. Communications:
 *create, delete communication connection

 send, receive messages


 transfer status information
 * transfer status information
PART-B
(2A) Distinguish the following:(i) Multiprogramming and
Multitasking

Multiprogramming System:
sss*In a multiprogrammed system, the operating system simply
switches to, and executes, another job.
*Eventually, the first job finishes waiting and gets the CPU back.
Thus, the CPU is never idle.
*Multiprogrammed systems provide an environment in which the
various system resources (for example, CPU, memory, and peripheral
devices) are utilized effectively, but they do not provide for user
interaction with the computer system.
*Multiprogramming increases CPU utilization by organizing jobs, so
that the CPU always has one to execute.

Multitasking System:
*Time sharing requires an interactive (or hands-on) computer
system, which provides direct communication between the user and
the system.
*In Time sharing (or multitasking) systems, a single CPU executes
multiple jobs by switching among them, but the switches occur so
frequently that the users can interact with each program while it is
running.
*The response time should be short- typically less than one second.
*A time-shared operating system allows many users to share the
computersimultaneously. As the system switches rapidly from one
user to the next.

(ii)Multi processor systems and clustered system


Multi processor system:
1. This system allows many users to share the computer
simultaneously. As the system switches rapidly from one user to the
next.
2. In multiprocessor systems functions are shared among several
processors. If one processor fails, the system is not halted, it only
slows down.
3. Asymmetric multiprocessing - (Master/Slave architecture) Here
each processor is assigned a specific task, by the master processor.
4. Symmetric multiprocessing (SMP) - All the processors are
considered peers. There is no master-slave relationship. All the
processors have their own registers and CPU, master-slave only
memory is shared.

Clustered Systems:
1. Clustered systems are two or more individual systems connected
together via a network and sharing software resources.
2. Clustering provides high availability of resources and services.
3. The service will continue even if one or more systems in the
cluster fail.
4. High availability is generally obtained by storing a copy of files (s/w
resources) in the system.

(2B) What is a process? Explain different states of a process with a


neat diagram A process is the unit of work in a modern time-
sharing system.

As a process executes, it changes state. The state of a process is


defil1.ed in part by the current activity of that process. Each process
may be in one of the following states:
(1) New: The process is being created.
(2) Running: Instructions are being executed.
(3) Waiting: The process is waiting for some event to occur (such as
an 1/0 completion or reception of a signal).
(4) Ready: The process is waiting to be assigned to a processor.
(5) Terminated: The process has finished execution
Although two processes may be associated with the same program,
they are nevertheless considered two separate execution sequences.
For instance, several users may be running different copies of the
mail program, or the same user may invoke many copies of the Web
browser program. Each of these is a separate process; and although
the text sections are equivalent, the data, heap, and stack sections
vary.
The states that they represent are found on all systems, however.
Certain operating systems also more finely delineate process states.
It is important to realize that only one process can be running on any
processor at any instant. Many processes may be ready and waiting.

PART – B
3)
a) Calculate the average waiting Time and Turn around time for the
following

b) Explain the concept of virtual machines with a neat diagram.


> The fundamental idea behind a virtual machine is to abstract the
hardware of a single computer (the CPU, memory, disk drives,
network interface cards, and so forth) into several different
execution environments, thereby creating the illusion that each
separate execution environment is running its own private
computer.
> Creates an illusion that a process has its own processor with its
own memory.
> Host OS is the main OS installed in system and the other OS
installed in the system are called guest OS

Examples
VMware
 VMware is a popular commercial application that abstracts
Intel 80X86 hardware into isolated virtual machines. The
virtualization tool runs in the user-layer on top of the host
OS. The virtual machines running in this tool believe they
are running on bare hardware, but the fact is that it is
running inside a user-level application.
 VMware runs as an application on a host operating system
such as Windows or Linux and allows this host system to
concurrently run several different guest operating
systems as independent virtual machines.
In below scenario, Linux is running as the host operating system;
FreeBSD, Windows NT, and Windows XP are running as guest
operating systems. The virtualization layer is the heart of VMware, as
it abstracts the physical hardware into isolated virtual machines
running as guest operating systems. Each virtual machine has its own
virtual CPU, memory, disk drives, network interfaces, and so forth

Implementation
 The virtual-machine concept is useful, it is difficult to
implement.
 Work is required to provide an exact duplicate of the
underlying machine. Remember that the underlying machine
has two modes: user mode and kernel mode.
 The virtual-machine software can run in kernel mode, since it is
the operating system. The virtual machine itself can execute in
only user mode.
Benefits
 Able to share the same hardware and run several different
execution environments (OS).
 Host system is protected from the virtual machines and the
virtual machines are protected from one another. A virus in
guest OS, will corrupt that OS but will not affect the other guest
systems and host systems.
 Even though the virtual machines are separated from one
another, software resources can be shared among them. Two
ways of sharing s/w resource for communication are:
o To share a file system volume (part of memory).
o To develop a virtual communication network to
communicate between the virtual machines.
 The operating system runs on and controls the entire machine.
Therefore, the current system must be stopped and taken out
of use while changes are made and tested. This period is
commonly called system development time. In virtual machines
such problem is eliminated. User programs are executed in one
virtual machine and system development is done in another
environment.
 Multiple OS can be running on the developer’s system
concurrently. This helps in rapid porting and testing of
programmer’s code in different environments.
 System consolidation – two or more systems are made to run
in a single system.
4)
a) Apply the Scheduling algorithms to determine the average
waiting time , turn-around time and response time : using 1]pre-
emptive and non-pre-emptive SJF 2]pre-emptive priority 3] Round
Robin
b) Define operating system and Explain dual mode of operating
systems with neat diagram.
>>An operating system is system software that acts as an
intermediary between a user of a computer and the computer
hardware. It is software that manages the computer hardware and
allows the user to execute programs in a convenient and efficient
manner.

Dual-Mode Operation
Since the operating system and the user programs share the
hardware and software resources of the computer system, it has to
be made sure that an error in a user program cannot cause problems
to other programs and the Operating System running in the system.
The approach taken is to use a hardware support that allows us to
differentiate among various modes of execution.
The system can be assumed to work in two separate modes of
operation:
1. User mode
2. Kernel mode (supervisor mode, system mode, or privileged
mode).
3. A hardware bit of the computer, called the mode bit, is used to
indicate the current mode: kernel (0) or user (1). With the
mode bit, we are able to distinguish between a task that is
executed by the operating system and one that is executed by
the user.
4. When the computer system is executing a user application, the
system is in user mode. When a user application requests a
service from the operating system (via a system call), the
transition from user to kernel mode takes place.

At system boot time, the hardware starts in kernel mode. The


operating system is then loaded and starts user applications in user
mode. Whenever a trap or interrupt occurs, the hardware switches
from user mode to kernel mode (that is, changes the mode bit from
1 to 0). Thus, whenever the operating system gains control of the
computer, it is in kernel mode.
The dual mode of operation provides us with the means for
protecting the operating system from errant users—and errant
users from one another.

 The hardware allows privileged instructions to be executed


only in kernel mode. If an attempt is made to execute a
privileged instruction in user mode, the hardware does not
execute the instruction but rather treats it as illegal and
traps it to the operating system. The instruction to switch to
user mode is an example of a privileged instruction.

 Initial control is within the operating system, where


instructions are executed in kernel mode. When control is
given to a user application, the mode is set to user mode.
Eventually, control is switched back to the operating system via
an interrupt, a trap, or a system call.

You might also like