Operating System Module 1
Operating System Module 1
OPERATING SYSTEM
Module1
Solved Questions
1. Define an Operating System? What is the System’s view point of an Operating System?
Explain the dual mode Operation of an Operating System?
Ans : Definition:
An OS is a program that acts as an intermediary between computer-user and computer-hardware. It also
provides a basis for application-programs.
System’s view:
a) An Operating System as a resource allocator.
Resources used to solve a computing-problem:
→ CPU time
→ Memory-space
→ File-storage space and
→ I/0 devices.
The OS manages and allocates the above resources to programs and the users.
Problem: We must be able to differentiate between the execution of OS code and user-defined code. Solution:
Most computers provide hardware-support.
• Two modes of operation : 1)User mode and 2) Kernel mode
• A mode bit is a bit added to the hardware of the computer to indicate the current mode : i.e. kernel (0) or
user (1) Transition from user to kernel mode .
Working principle:
by user-program to ask the OS to perform the tasks on behalf of the user program.
Ans: User View: The user's view of the computer depends on the interface being used:
System View:
An OS as a resource allocator.
Resources used to solve a computing-problem:
1. CPU time
2. Memory-space
3. File-storage space and
4. I/0 devices.
The OS manages and allocates the above resources to programs and the users.
An OS is a control program The OS is needed to control:
Operations of I/0 devices and
Execution of user-programs to prevent errors.
Main requirements:
The system must provide a file-system.
The system must provide disk-management.
The system must provide CPU-scheduling to support concurrent execution.
The system must provide job-synchronization to ensure orderly execution.
Ans:
Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one to execute.
The idea is as follows:
OS keeps several jobs in memory simultaneously .
OS picks and begins to execute one of the jobs in the memory.
Eventually, the job may have to wait for some task, such as an I/O
operation, to complete.
OS simply switches to, and executes, another job.
When that job needs to wait, the CPU is switched to another job, and so on.
As long as at least one job needs to execute, the CPU is never idle.
If several jobs are ready to be brought into memory, and if there is not enough room for all of them, then the system
must choose among them. Making this decision is job scheduling.
If several jobs are ready to run at the same time, the system must choose among them. Making this decision is
CPU scheduling.
Figure below : Memory layout for a multiprogramming system.
Keeping track of which parts of memory are currently being used and by
whom.
Deciding which processes are to be loaded into memory when
memory space becomes available.
The CPU
To execute a program:
7. Explain the activities for which operating system is responsible for connecting with the Process
management?
The OS:
Maps files onto physical media and accesses the files via the storage devices
When multiple users have access to files, access control (read, write) must be specified.
The computer-systems are networked to provide the users with access to the various resources.
computation
protocols used
distances between nodes and
transport media.
Common network protocol are
TCP/IP → ATM.
Networks are characterized based on the distances between their nodes.
A local-area network (LAN) connects computers within a building.
A wide-area network (WAN) usually links buildings, cities, or
countries.
A metropolitan-area network (MAN) could link buildings within a city.
The media to carry networks are equally varied.
They include copper wires, fiber strands, and wireless transmission.
11. What are Virtual Machines? Explain the benefits of creating Virtual Machines?
12. What are Virtual Machines? Explain the Virtual Machine Architecture with a neat
diagram?
13. What are Virtual Machines? Explain how are they implemented?
Main idea: To abstract hardware of a single computer into several different execution
environments.
An OS creates the illusion that a process has → own processor & → own (virtual) memory.
The virtual-machine provides
An interface that is identical to the underlying hardware.
A (virtual) copy of the underlying computer to each process.
Problem: Virtual-machine software itself will need substantial disk space to provide virtual
memory.
Solution: provide virtual disks that are identical in all respects except size.
Advantages:
Complete protection of the various system resources.
It is a perfect vehicle for OS‟s R&D.
Disadvantage:
Difficult to implement due to effort required to provide an exact duplicate to underlying
14. Define System calls ? Explain any two types of System calls ?
Ans: System Calls:
15. What are the different categories of the System programs? (Explain).
Ans: They provide a convenient environment for program development and execution.
3. File Modification:
Text editors can be used to create and modify the content of files
stored on disk.
4. Programming Language Support:
5. Program Loading & Execution:
The system may provide absolute loaders , re-locatable
loaders linkage editors and overlay loaders.
6. Communications:
These programs are used for creating virtual connections between processes , users and computer-
systems.
They allow users to → browse web-pages
→ send email or log-in remotely.
→ log-in remotely.
16. Differences between Direct and Indirect communication with respect to the Message-
parsing system?
Ans:
Direct Communication Indirect Communication
Each process must explicitly name the Messages are sent to/received from mailboxes
recipient/sender. (or ports).
Symmetric addressing: Both sender and Mailbox owned by a process: The owner can only
receiver processes must name the other to receive, and the user can only send. The mailbox
communicate. disappears when its owner process
terminates.
Asymmetric addressing: Only the sender Mailbox owned by the OS: The OS allows a
names the recipient and the recipient needn't name process to Create a new mailbox , Send & receive
the sender. messages via it and Delete a mailbox.
1. Process State:
3. CPU Registers:
These include :
→accumulators (AX)
→ index registers (SI, DI)
→ stack pointers (SP) and
→ general-purpose registers (BX, CX, DX).
6. Accounting Information:
This includes :
7. I/O Status Information: This includes list of I/O devices and list of open files. Below
figure represents the PCB:
19. Explain
the
design → define goals and
goals of
→ define specifications.
the
Operatin
g → choice of hardware and
System? → type of system such as batch or time shared, and
single user or multiuser.
Ans: Design Goals:
20. Explain the Inter-process communication and also about the advantages of process
being called as Co-operative process?
1. Independent processes or
2. Co-operating processes.
2. A process is co-operating if :
21. Explain Shared memory systems and Message passing (Two basic models of the IPC) ?
Ans: Shared-Memory
Communicating-processes must establish a region of shared-memory.
A shared-memory resides in address-space of the process creating the shared-memory. Other processes must attach their
address-space to the shared-memory.
The processes can then exchange information by reading and writing data in the shared-memory.
The processes are also responsible for ensuring that they are not writing to the same location simultaneously.
For example: Producer-Consumer Problem: Producer-process produces information that is consumed by a consumer-
process
Advantages:
Faster.
Message-Passing
These allow processes to communicate and to synchronize their actions without sharing the same address- space.
If fixed-sized messages are used, the system-level implementation is simple. However, the programming task becomes
more difficult.
If variable-sized messages are used, the system-level implementation is complex. However, the programming task becomes
simpler.
Advantages:
Useful for exchanging smaller amounts of data („.‟ No conflicts need be avoided).
Easier to implement.
Useful for exchanging smaller amounts of data („.‟ No conflicts need be avoided).
Easier to implement.
23. Ans: Process Creation and Process Termination are the two operations on the process.
Process Creation:
A process may create a new process via a create-process system-call.
The creating process is called a parent-process. The new process created by the parent is called the child- process
(Sub-process).
OS identifies processes by p-id (process identifier), which is typically an integer-number.